Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions ai/global/agent-roles.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@ A trusted commenter is a human whose comment can approve a plan or ask for work.

### Check Live State Before Asking or Reporting (MANDATORY)

Before asking the human a question, or reporting that something is waiting on them (an approval, a review, a merge, a manual step), gather the answer yourself from what a command can show, because a question a command could have answered costs the human time and a stale report misleads them:

- Live GitHub state, read with the `cfwf` MCP tools or `cfwf`, as [Choosing a GitHub Tool](github-cli.instructions.md#choosing-a-github-tool-mandatory) describes. For a PR, read it in one call first with `cfwf pr status --repo <owner/repo> --pr <number>`, which prints the board status, review decision, merge state, auto-merge, labels, check verdict, ready-at and comment counts together; use these single-purpose reads only for detail it does not print: the Workflow board status (`cfwf workflow-status --check --repo <owner/repo> (--pr <n> | --issue <n>)`), the review decision, merge state, auto-merge and labels (`cfwf pr view --repo <owner/repo> --pr <number> --field review-decision --field merge-state --field auto-merge --field labels`), the comments, reviews and review threads (`cfwf pr comments --repo <owner/repo> --pr <number>`), the required checks read as [CI Checks](#ci-checks-mandatory) describes, the Actions runs (`cfwf run list --repo <owner/repo> --branch <name>`), and when the PR was last marked ready (`cfwf pr ready-at --repo <owner/repo> --pr <number>`).
- The repository itself and the instruction files.

Read state that can change (the review decision, the merge state, auto-merge and check states) immediately before reporting it, without polling, and never present an earlier read as current, because any of these can change while other work runs. Read check states as [CI Checks](#ci-checks-mandatory) requires, where an all-passed result is accepted only if it is still true on the next check after it was first seen, so a single all-passed sighting is never reported as passed. When no second sighting is available, report that sighting as seen once and not yet confirmed. This is not a check on your own write, which [GitHub State Lags Behind Writes](github-cli.instructions.md#github-state-lags-behind-writes-mandatory) covers.

Ask only for what no command can show, such as a design choice, an approval, a priority or a fact about the human's own environment. When you do ask, or report that something is waiting on the human, say what you checked and what it returned (for example "open, review required, no auto-merge set"), so the human can see the claim rests on a current read.
This rule applies to every role and lives in [Check Live State Before Asking or Reporting](task-workflow.instructions.md#check-live-state-before-asking-or-reporting-mandatory).

### Issue Workflow: Plan First (new issues only)

Expand Down Expand Up @@ -119,7 +112,7 @@ When picking up an **Issue** that has no existing PR:

In an interactive session, keep watching the issue rather than ending the turn; see [Waiting for Approval in an Interactive Session](#waiting-for-approval-in-an-interactive-session). Also raise the pending approval and any open `Q` questions in chat, in the [NEEDS YOU block](communication.instructions.md#needs-you-block-mandatory); the plan is still posted and `Blocked` still added as above, because the plan comment is the record approval is judged against.

**Check GitHub's live state, not just chat.** A human's approval action may land directly on the issue/PR (a comment, a label change, moving the board card) without also being repeated in chat; they already have to open the item to read the posted plan, so relaying it a second time in chat is not something to wait on. Before treating an item as approved, still blocked, or unchanged, re-check its live state (`cfwf issue plan-status`/`cfwf issue view` for an issue, `cfwf pr view`/`cfwf pr comments` for a PR, plus the board's workflow status via `cfwf workflow-status --check`) rather than relying on stale memory or assuming silence in chat means nothing has happened on GitHub. This cuts both ways: a literal chat-only approval (a human typing one of the keywords above directly into the chat session, rather than posting them as a GitHub comment) is still valid on its own, but must be mirrored as a GitHub comment per the live-chat rule in [Blocked Label](#blocked-label) so the record survives even if the chat session is lost; do not treat chat-only approval as a substitute for checking GitHub, and do not treat an unexplained GitHub-side state change as approval without confirming a human actually made it (an automated board rule or a stray process flipping a field is not a human decision). The same applies beyond Plan First: see [Check Live State Before Asking or Reporting](#check-live-state-before-asking-or-reporting-mandatory).
**Check GitHub's live state, not just chat.** A human's approval action may land directly on the issue/PR (a comment, a label change, moving the board card) without also being repeated in chat; they already have to open the item to read the posted plan, so relaying it a second time in chat is not something to wait on. Before treating an item as approved, still blocked, or unchanged, re-check its live state (`cfwf issue plan-status`/`cfwf issue view` for an issue, `cfwf pr view`/`cfwf pr comments` for a PR, plus the board's workflow status via `cfwf workflow-status --check`) rather than relying on stale memory or assuming silence in chat means nothing has happened on GitHub. This cuts both ways: a literal chat-only approval (a human typing one of the keywords above directly into the chat session, rather than posting them as a GitHub comment) is still valid on its own, but must be mirrored as a GitHub comment per the live-chat rule in [Blocked Label](#blocked-label) so the record survives even if the chat session is lost; do not treat chat-only approval as a substitute for checking GitHub, and do not treat an unexplained GitHub-side state change as approval without confirming a human actually made it (an automated board rule or a stray process flipping a field is not a human decision). The same applies beyond Plan First: see [Check Live State Before Asking or Reporting](task-workflow.instructions.md#check-live-state-before-asking-or-reporting-mandatory).

**Scope of the Approved gate: once a PR exists, this section no longer applies.** The gate above governs only picking up an Issue that has **no existing PR**. A Pull Request is never opened for an Issue until that gate has already been passed by a human: the PR's own existence *is* the authorisation. A PR-phase session must never re-derive or re-check approval from the PR's own Workflow board card: that card is purely a phase marker for the PR Workflow below, not a second approval gate. If a PR's own card still reads "Not Started", "Planning", or "Approved" (e.g. the session that opened the draft PR died before advancing its card, or a freshly-seeded board has not caught up yet), treat that as "Development" and continue with the PR Workflow below; never block pending approval, and never treat it as evidence the linked Issue was never approved. The two cards are kept in step automatically (issue → PR, forward-only) by the orchestrator itself; this is not something a session needs to reconcile by hand.

Expand Down
2 changes: 1 addition & 1 deletion ai/global/communication.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In an interactive session, a question, decision, approval or manual step that ne
- `✅ **NEEDS YOU:** nothing right now.`: nothing is outstanding.
- **P4.** Keep the block at the top of every reply while anything is still outstanding, so it never scrolls out of view. Once nothing is outstanding, either show `> ✅ **NEEDS YOU:** nothing right now.` or leave the block out.
- **P5.** Number questions in the block as [Numbering and Cross-Reference Conventions](task-workflow.instructions.md#numbering-and-cross-reference-conventions-mandatory) describes: a `Q` prefix, continuing from the highest number already used in the work item as [Numbers Are Never Reused](task-workflow.instructions.md#numbers-are-never-reused) requires. Phrase each as a yes/no question where possible, so it can be answered in one word.
- **P6.** Before asking, gather what a command can show, as [Check Live State Before Asking or Reporting](agent-roles.instructions.md#check-live-state-before-asking-or-reporting-mandatory) requires; ask only for what no command can show.
- **P6.** Before asking, gather what a command can show, as [Check Live State Before Asking or Reporting](task-workflow.instructions.md#check-live-state-before-asking-or-reporting-mandatory) requires; ask only for what no command can show.
- **P7.** Only the main session talks to the human. A role working from a hand-off puts anything that needs the human in its hand-off report, and the main session raises it in the block.

## Ask in Chat First (MANDATORY)
Expand Down
4 changes: 2 additions & 2 deletions ai/global/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Read all of these before starting any task, regardless of language or context.
| [tool-preferences.instructions.md](tool-preferences.instructions.md) | Which tool to reach for when more than one could do the job: `Glob` over `find` for simple file listing; repo searches exclude `.env`, `.database` and `.claude/`; `cfwf` or a local clone over fetching `github.com`/`githubusercontent.com` URLs |
| [codegraph.instructions.md](codegraph.instructions.md) | When a `.codegraph/` directory exists at the repo root: use the `codegraph_explore` MCP tool before `grep`/`find`/reading files (verbatim symbol source plus call paths, including dynamic dispatch; name a file or symbol for its line-numbered source), load it by name when deferred, MCP tool only (never the `codegraph` CLI or a shell fallback), skip CodeGraph entirely when there is no `.codegraph/`, re-query or read the file when the index lags a fresh edit |
| [git-rebasing.instructions.md](git-rebasing.instructions.md) | When to rebase (fetch/check/rebase), the mandatory `pre-commit-check` after every rebase, force-pushing a rebased branch (personal branches only, local and remote HEAD equal, `--force-with-lease` only), version-conflict resolution when merging or rebasing |
| [task-workflow.instructions.md](task-workflow.instructions.md) | Agent routing table, model selection, failure handling, issue/PR assignment, Workflow project board, commit cadence, preserving work that cannot be committed, resuming work, command timeouts, one long-running command at a time, ad-hoc prompt intake, prompt traceability, numbering and cross-reference conventions including presentation in label order (enforced in CI), numbers never reused within a work item (issue and PR) |
| [task-workflow.instructions.md](task-workflow.instructions.md) | Agent routing table, model selection, failure handling, issue/PR assignment, Workflow project board, commit cadence, preserving work that cannot be committed, resuming work, command timeouts, one long-running command at a time, ad-hoc prompt intake, prompt traceability, checking live state before asking the human or reporting (every role), numbering and cross-reference conventions including presentation in label order (enforced in CI), numbers never reused within a work item (issue and PR) |
| [communication.instructions.md](communication.instructions.md) | Raising anything that needs the human: in an interactive session, a NEEDS YOU block at the top of every reply while anything is outstanding (`🛑` work stopped, `⚠️` question open but work continues, `✅` nothing right now), markers written as the emoji characters (never GitHub shortcodes) as the user's explicitly requested format, raised immediately rather than at the end of a batch, `Q`-numbered yes/no questions, ask in chat first and post the question with `Blocked` only if still unanswered when the session would stop (unattended runs post and block straight away), chat answers still mirrored on GitHub, plan approval unchanged; full URLs (never only `#N`) every time an issue, PR, comment, workflow run or commit is named to the human in chat, final reports and relayed hand-offs, while content posted on GitHub keeps its short references |
| [code-quality.instructions.md](code-quality.instructions.md) | Code coverage, tests, async, immutability, parameterised tests, never bypassing constructors (stop and ask for a real instance), refactoring, incidental cleanup, suppressed and unsuppressed analyzer findings from `sarif-summary` PR comments, pattern sweep, pre-existing bugs found during work, pre-commit failure handling |
| [documentation.instructions.md](documentation.instructions.md) | README, CHANGELOG conventions |
Expand Down Expand Up @@ -50,7 +50,7 @@ Load these only when the work involves the relevant technology or context.
| [performance.instructions.md](performance.instructions.md) | Performance-critical code is being written or optimised | Design principles, benchmarks, optimisation workflow |
| [coverage-ratchet.instructions.md](coverage-ratchet.instructions.md) | Acting as Orchestrator running the AI Coverage board phase | Whole-repo per-language coverage ratchet gated on the committed `COVERAGE.md` (per-component + overall figures with line counts, written by the build MCP `coverage` tool and never by hand, read live from `origin/main`, no PR comment), bootstrap/dependency-only-branch skip rules, per-language extraction commands, phase decision procedure |
| [github-cli.instructions.md](github-cli.instructions.md) | Any GitHub operation | Full GitHub command reference: choosing a tool (the `cfwf` MCP tool whenever one covers the operation, how command names map to tool names, the `cfwf` command line only when no tool covers it or the server is not connected; no other route), raising `tool(cfwf):` issues for missing commands, the `cfwf` commands for issues (and the issue title format, plans, blocking questions, comments, closing, sub-issues), PRs (create, checks, comments, inline review comments, blocking, label sync, hand-off, take-back, close), labels, search, runs, repos and workflows, releases and advisories, new inline review comments, the API proxy and HEREDOC bodies, GitHub state lagging behind writes (do not spam while waiting), common mistakes |
| [agent-roles.instructions.md](agent-roles.instructions.md) | You are acting as a named agent (Orchestrator, Code Writer, Code Tester, etc.) | Detailed per-agent responsibilities and behaviour, including the Workflow board (`cfwf`) and checking live state before asking the human or reporting |
| [agent-roles.instructions.md](agent-roles.instructions.md) | You are acting as a named agent (Orchestrator, Code Writer, Code Tester, etc.) | Detailed per-agent responsibilities and behaviour, including the Workflow board (`cfwf`) |
| [changelog.instructions.md](changelog.instructions.md) | You need to add or update a changelog entry, or you are the Changelog agent | Format, tooling (`changelog` MCP tools first, `dotnet changelog` CLI as fallback), when to add entries, add/remove commands |
| [git-commits.instructions.md](git-commits.instructions.md) | You are about to commit, or you are the Committer agent | Commit size rules, empty commit check, push cadence, Conventional Commits format, pattern sweep commit body (per-file rationale) |
| [gitignore.instructions.md](gitignore.instructions.md) | Any `.gitignore` file is being created or modified | IDE file exclusions, root `.gitignore` ownership, consistency checks |
Expand Down
11 changes: 11 additions & 0 deletions ai/global/task-workflow.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ If a factual claim or finding you previously posted in an issue/PR body or comme

This is distinct from [PR Title, Body, and Label Sync](#pr-title-body-and-label-sync-mandatory) below, which requires routine in-place edits to keep a PR's title/body/labels synced with its linked issues; that is not a correction and needs no comment. This rule is about retracting or fixing something substantive that was previously asserted as true.

## Check Live State Before Asking or Reporting (MANDATORY)

Before asking the human a question, or reporting that something is waiting on them (an approval, a review, a merge, a manual step), gather the answer yourself from what a command can show, because a question a command could have answered costs the human time and a stale report misleads them:

- Live GitHub state, read with the `cfwf` MCP tools or `cfwf`, as [Choosing a GitHub Tool](github-cli.instructions.md#choosing-a-github-tool-mandatory) describes. For a PR, read it in one call first with `cfwf pr status --repo <owner/repo> --pr <number>`, which prints the board status, review decision, merge state, auto-merge, labels, check verdict, ready-at and comment counts together; use these single-purpose reads only for detail it does not print: the Workflow board status (`cfwf workflow-status --check --repo <owner/repo> (--pr <n> | --issue <n>)`), the review decision, merge state, auto-merge and labels (`cfwf pr view --repo <owner/repo> --pr <number> --field review-decision --field merge-state --field auto-merge --field labels`), the comments, reviews and review threads (`cfwf pr comments --repo <owner/repo> --pr <number>`), the required checks read as [CI Checks](agent-roles.instructions.md#ci-checks-mandatory) describes, the Actions runs (`cfwf run list --repo <owner/repo> --branch <name>`), and when the PR was last marked ready (`cfwf pr ready-at --repo <owner/repo> --pr <number>`).
- The repository itself and the instruction files.

Read state that can change (the review decision, the merge state, auto-merge and check states) immediately before reporting it, without polling, and never present an earlier read as current, because any of these can change while other work runs. Read check states as [CI Checks](agent-roles.instructions.md#ci-checks-mandatory) requires, where an all-passed result is accepted only if it is still true on the next check after it was first seen, so a single all-passed sighting is never reported as passed. When no second sighting is available, report that sighting as seen once and not yet confirmed. This is not a check on your own write, which [GitHub State Lags Behind Writes](github-cli.instructions.md#github-state-lags-behind-writes-mandatory) covers.

Ask only for what no command can show, such as a design choice, an approval, a priority or a fact about the human's own environment. When you do ask, or report that something is waiting on the human, say what you checked and what it returned (for example "open, review required, no auto-merge set"), so the human can see the claim rests on a current read.

## Pre-Closure Decision Check (MANDATORY)

Before closing any issue or PR, check whether its Implementation Plan (Approach/Files-to-change text or an Open Question) or a later comment on it flagged a specific decision as required or pending (e.g. "needs policy sign-off", "pending a decision on X", an unresolved `Qn.`). If so, do not close until that specific item has a visible resolution of its own (a comment recording the decision, a link to the resolving issue/PR, or an explicit retraction), not just implicitly overtaken by whichever branch of the plan got implemented.
Expand Down
Loading