Skip to content

Latest commit

 

History

History
1086 lines (789 loc) · 117 KB

project-context.md

File metadata and controls

1086 lines (789 loc) · 117 KB

Convoke Project Context

Rules and conventions that BMAD dev agents and contributors must follow when working in this repository. These are encoded here (not just in retros) so that the dev agent reads them before writing code.

Authoring a new skill, workflow, or agent under _bmad/bme/? Before anything else, read The Convoke Operator Covenant — one axiom and seven Operator Rights every Convoke skill must honor — and self-check against the Covenant Compliance Checklist. The rule is covenant-compliance-for-convoke-skills below. Covenant compliance is an architectural concern, not a styling concern: it's what makes a _bmad/bme/ skill a Convoke skill rather than a generic one.


Rule: test-fixture-isolation

Statement. Tests that invoke a CLI script via runScript(...) or scan the project tree via findProjectRoot() / runAudit() / similar must run against an isolated fixture directory, never against PACKAGE_ROOT.

Operational check. Every call to tests/helpers.js::runScript must pass { cwd: tmpDir } — where tmpDir is created in a before() hook, populated with the minimum state the test requires, and cleaned up in after(). Bare runScript(script) calls (no cwd) are forbidden.

Why. Tests that couple assertions to live repo state turn any drift — a README typo, a config version bump mid-PR, a banner rename, a new doc finding — into a CI failure across every Node version simultaneously. The failure appears as "CI is flaky" when it is actually correctly reporting that the test's implicit assumption about the project state no longer holds. This class of failure has bitten Convoke multiple times (see tests/unit/docs-audit.test.js pre-fix, tests/integration/cli-entry-points.test.js pre-fix, tests/integration/postinstall.test.js:11-21 pre-fix — all fixed 2026-04-11).

How to apply.

  • Writing a new test that shells out to a CLI. Use createValidInstallation(tmpDir) (from tests/helpers.js) or a minimal hand-built fixture in a before() hook. Pass { cwd: fixtureDir } to every runScript call in that suite.
  • Writing a new test that scans the project tree. Pass { projectRoot: fixtureDir } to runAudit() or equivalent APIs. Do not rely on findProjectRoot() walking up from the test process cwd.
  • Assertions. Assert on behavior (exit code validity, JSON shape, presence of a specific header the script emits for a given fixture input), never on counts against live state (findings.length === 0, "all 7 agents mentioned") unless the fixture itself guarantees the count.
  • Rescuing an existing bare call. Create a fixture in before(), thread cwd through the test's helper, convert assertions to behavior-based. If the test was a pure smoke test ("does it run against our own repo?") and the same behavior is already covered by a fixture-based test in the same file, delete it — do not fixture-ize redundant coverage.
  • Reviewing a PR. If a diff adds runScript(...) without a cwd: option, block and cite this rule.

Exception. One, and it is narrow: committed-artifact-integrity. A test whose subject is the integrity of a committed artifact — where the artifact itself is what may have rotted, not the code that reads it — may read that artifact from PACKAGE_ROOT. A fixture copy would test the copy. Everything else escalates, and is almost certainly a sign the test is checking something that belongs in a separate gate (e.g., npm run docs:audit as its own CI step), not in the unit/integration suite.

Conditions — all four, or you do not have the exception.

  1. Assert only about the artifact. The moment the test asserts on the behaviour of code, the exception is gone and the code side needs a fixture.
  2. Take expectations from a source the artifact does not control — a registry, a committed record — never from the artifact's own contents. Otherwise a corrupted artifact chooses the standard it is judged against.
  3. State in the file what the test cannot detect. A green run against data is easy to over-read.
  4. Accept that new data makes it red until the data is complete. That is the point, not a flake: adding an 8th agent to the registry turns the personality suite red until that agent's capture exists.

Ruled 2026-09-23, on the escalation this rule asks for, from T135, raised by tests/lib/personality-fixtures.test.js — which cites the exception and meets the four conditions. This ruling is not a survey of the suite. 22 test files read paths under PACKAGE_ROOT; most do so legitimately (resolving the script under test, seeding a fixture), but at least two assert on a live artifact's integrity in exactly this shape — tests/lib/covenant-packaging.test.js (the shipped covenant directory) and tests/unit/validate-marketplace.test.js (.claude-plugin/marketplace.json) — and have not been checked against the conditions. Filed as T208. Not a separate gate, because the rule's separate-gate advice fits a test of the live project (docs:audit), while this is a test of committed data; a new CI job would be one more thing to wire, and a gate not in publish.needs is documentation. Condition 2 is there because the first draft of that test took each capture's prompt-id prefix from the capture itself — so a capture filed under the wrong agent was judged against the wrong slice of the record, and passed.


Rule: fixture-determinism

Statement. A test must not assert on anything it does not control. If the asserted value can change without the code under test changing, the test is a clock, a race, or a census — not a test.

Operational check. Before writing an assertion, name what determines the value. These axes each produce non-determinism and none is covered elsewhere in this file:

  • Wall-clock time — new Date() / Date.now() feeding date maths.
  • Process lifetime you did not await — a detached child or background writer still running after the call that spawned it returned.
  • A fixed delay — setTimeout/sleep standing in for an event you could have awaited.
  • Ambient environment — inherited env vars, global config, the developer's own git settings.

A fifth axis, live repository state, is owned in full by test-fixture-isolation; treat that rule as this one's filesystem case rather than repeating it here.

Why. Five instances, each found separately, each fixed separately, none recognised at the time as the same defect:

Uncontrolled input How it surfaced Already owned by
T12 wall-clock ±1 day flake across UTC midnight —
I131 fixed delay CI flake plus wasted seconds per suite —
I124 live tree, timed 30s timeout flake only under c8 test-fixture-isolation
CI run 32115225495 detached git maintenance child ENOTEMPTY in teardown, three jobs red —
02cb6d72 live repo census failed on corpus growth, not regression derive-counts-from-source

Two of the five already had a rule and still recurred, because the rule named the instance and not the class. The other three had nothing. fc59c190 states the cost best: "the magic number rotted while the property it stood for did not."

How to apply.

  • Pin the input rather than widen the tolerance. A fixed offset instead of new Date(); a fixture tree instead of a longer timeout; an awaited event instead of a sleep. Raising a limit hides the coupling and the next person pays for it again.
  • Remove the writer, then survive it. Where concurrency is the input, suppress the source if you can prove one exists, and make the failure self-diagnosing where you cannot — see initGitFixture and removeTempDir in tests/helpers.js, whose failure message names what survived, precisely because the race could not be reproduced locally.
  • A guarded test that cannot run must say so (t.skip('reason')). Silence reads as coverage. Proving the guard itself can fail is verification-must-be-falsifiable, not this rule.
  • Reviewing a PR. If a diff adds an assertion whose value depends on any axis above, block and cite this rule. Known trap: runScriptWithInput in tests/unit/convoke-update.test.js defaults cwd to PACKAGE_ROOT, so omitting cwd silently opts into live repo state.

Exception. A test whose subject is the non-deterministic thing — a clock helper, a retry policy, a concurrency primitive. Control the input explicitly (inject the clock, drive the scheduler); the subject being time does not license reading the real time.


Rule: no-hardcoded-versions

Statement. Never hardcode version strings in source code. Always read via getPackageVersion() from scripts/update/lib/utils.js.

Why. Convoke's update/migration system depends on a single source of truth for the current package version (package.json). Hardcoded versions rot silently and cause update logic to compare against stale values.

How to apply. When you need the current version, require('../../package.json').version or use the getPackageVersion() helper. If you find an existing hardcoded version string, replace it.


Rule: no-process-cwd-in-libs

Statement. Library code under scripts/update/lib/ and similar must not call process.cwd() directly. Accept a projectRoot parameter or use findProjectRoot() from utils.js.

Why. Direct process.cwd() calls make functions untestable against fixtures (they're implicitly bound to the test runner's working directory) and produce subtle bugs when callers invoke them from a nested directory.

How to apply. Every library function that needs a project path takes it as a parameter. CLI entry points are the only place findProjectRoot() is called, and they pass the result down.


Rule: path-safety-for-destructive-ops

Statement. Any script that accepts a user-provided path and performs destructive operations (delete, overwrite, cleanup) must include a safety analysis in its spec and refuse to operate on paths outside the project root.

Why. See feedback_path_safety.md in auto-memory. A script that writes to user paths without validation is one typo away from deleting the wrong tree.

How to apply. When writing such a script, include:

  1. A resolve + normalize + contains-check against the project root.
  2. An explicit refusal path for /, $HOME, and any path that isn't under the project root.
  3. A story-level safety analysis in the spec (not just the code).

Rule: namespace-decision-for-new-skills

Statement. Every new skill or workflow story must include a "Namespace decision" section in its spec, explaining whether the skill lives under Convoke's _bmad/bme/ namespace or upstream BMAD's namespace, and why.

Why. Convoke is an extension of BMAD Method, and keeping the boundaries clean prevents accidental upstream contamination and makes future merges tractable. See feedback_namespace_audit.md in auto-memory.

How to apply. Include the section in the story. If the choice isn't obvious (mixed-namespace work, refactoring that crosses the boundary), escalate to the user before coding.


Rule: covenant-compliance-for-convoke-skills

Statement. Before authoring a new skill, workflow, or agent under _bmad/bme/ (Convoke's owned namespace), the author must read The Convoke Operator Covenant and self-check the deliverable against the Covenant Compliance Checklist before marking the story ready-for-review.

Why. The Covenant encodes one axiom ("the operator is the resolver") and seven Operator Rights that distinguish a Convoke skill from a generic skill. Authoring without consulting it produces skills that look structurally correct but violate the operator-experience standard the rest of the ecosystem relies on. The baseline audit (2026-04-18) found 10 violations across 56 cells (~82% compliance) in existing skills — all of them introduced by authors who never had the Covenant to consult. Making the Covenant required reading at the point of authorship is how we stop adding new violations while we retrofit the old ones.

How to apply.

  • Authoring a new _bmad/bme/ skill or workflow. Read the Covenant before you start. When drafting the deliverable, satisfy the Checklist's OC-R0 enumeration precondition first (record the full 3-layer interaction surface — workflow.md + all step files + all invoked scripts/CLIs), then work through OC-R1 through OC-R7 and confirm each either PASSes or has a declared N/A variant with rationale. Cells answered against an incompletely-enumerated surface are invalid per OC-R0.
  • Reviewing a _bmad/bme/ skill PR. Check whether the author ran the Checklist. If the diff introduces new operator-facing behavior (prompts, errors, output formats, decision points), verify the relevant Right's compliance — cite the specific OC-Rn rule in the review comment, not a generic "improve UX" note.
  • Exception: upstream BMAD contributions. Skills contributed upstream (_bmad/core/, _bmad/bmm/, _bmad/bmb/, etc.) are out of scope for the Covenant — it's a Convoke-specific standard, not a BMAD Method requirement. If the skill is genuinely upstream-appropriate (see namespace-decision-for-new-skills), the Covenant does not apply.
  • Reference, not boilerplate. Cite the Covenant by its display name and link, with a sentence explaining why compliance matters for the surface in question. "See the Covenant" with no rationale violates OC-R3 (the Right to rationale that the Covenant itself encodes).

Rule: slash-command-ux-for-user-facing-tools

Statement. Any user-facing tool must be exposed as a BMAD slash-command skill, not as a bare CLI script. CLI scripts are an implementation detail, not a user interface.

Why. See feedback_slash_command_ux.md in auto-memory.

How to apply. When planning a new user-facing feature, the story's deliverables must include a slash-command skill that wraps the underlying script. If you find yourself writing CLI-only documentation, you've missed a layer.


Rule: no-code-in-party-mode

Statement. When multiple BMAD agents are in party mode, no agent writes code. Exit party mode first, create stories via the appropriate agent (typically SM), then implement.

Why. See feedback_no_code_in_party_mode.md in auto-memory.

How to apply. If a user asks for code inside party mode, the agent proposes exiting party mode and creating a story instead.


Rule: a-remediation-is-an-unreviewed-change

Statement. A fix applied in response to a review finding is new work, not a correction. It gets the same adversarial scrutiny the original did, scoped to what it touched. A round does not close on "findings applied"; it closes when the applied findings have themselves been checked.

Two obligations follow, and they fail differently — do both:

  1. Re-derive, don't reason. Run the command that proves the fix, from the directory the reader will be standing in. Do not accept that a change is correct because it was written to be correct.
  2. Fix the CLASS, not the instance. Before closing a finding, grep for every other occurrence of the value, the shape, or the code path being fixed. "Closed" must not mean "closed for the input the reviewer happened to send".

Why. Measured across the seven stories of the 4.0.2 documentation-accuracy epic: every single remediation introduced defects. docs-1-2's generator regenerated the very defect it was built to remove, into two shipped files, with a green gate. docs-1-3's Round 2 found 9 of 10 of Round 1's corrections defective. In docs-1-5, docs-1-6 and docs-1-7, every high-severity finding of the later round had been created by the earlier round's fixes. Five separate incomplete fixes occurred — a figure appearing twice and corrected once, a character class fixed for _ and left broken for *.

This is not carelessness. It is that applying a fix feels like closing work rather than opening it, so the step that would catch it is the step that gets skipped.

How to apply. When a review round produces fixes: scope a follow-up pass to what the remediation touched, not to the whole diff. Rewritten executable logic earns one; rewritten prose does not — see the stopping rule below. State in the record which of the two obligations each fix satisfied.

Falsification. A remediation lands, a later pass examines it, and finds nothing. That has not yet happened in this project; when it does twice running, relax this rule.

Companion — the stopping rule. Judge by what the remediation touched and by where the findings are landing. When findings about the record (tallies, round histories, basis figures) approach findings about the artifact, stop patching and delete the narration: keep the defect, the fix, and the command that re-derives it. Careful rewrites generate the next round's findings; deletion ends it. docs-1-6 stopped that way after three rounds; docs-1-7 correctly continued, because its remediation had rewritten a gate's parsing logic rather than its prose.

Rule: code-review-convergence

Statement. Code reviews follow a bounded convergence rule:

  • Round 1 fires automatically when a change reaches a landing point, with no operator request required. The landing points are: a story moving to review, and — for Fast Lane / out-of-story work, which has no story status to move — the moment a commit is prepared (see commit-preparation). Waiting to be asked is a rule violation, not a default.
  • Round 1 is mandatory.
  • Round 2 is triggered only if Round 1 produces any HIGH-severity finding.
  • Round 3 is triggered only if Round 2 introduces structural changes (new files, renamed functions, altered control flow) — not for wording fixes, comment edits, or cosmetic patches.
  • No Round 4. If Round 3 still has issues, defer remaining findings to the backlog (via bmad-enhance-initiatives-backlog Triage mode) rather than running another review pass.
  • Restructure, do not patch, when a round is correcting the previous round. If a round's HIGH findings are predominantly defects in the previous round's corrections rather than in the work under review, the next action is to change the instrument, not to patch again. Two failed attempts at the same fix predict a third. This is a routing rule, not a stopping rule — it does not reduce review depth, it redirects it.
  • Batch the remediation; do not apply findings one at a time as they arrive. Collect every layer's findings for the round, design ONE coherent remediation, then apply it. Incremental fixing inside a round is how fixes collide: in dist-2-2 Round 1 added an unterminated-fence tripwire and a zero-extraction guard in the same round, each individually correct, and the guard swallowed the tripwire's finding and exited 2 — which the harness treats as advisory, so the run reported nothing at all. Neither diff read wrongly on its own. Round 2 then fixed one of the two sibling guards and left the other, and Round 3 found the same defect alive in it. A remediation designed as a whole would have seen both.
  • When a fix keeps leaking in the same place, suspect OVER-BUILD, and prefer deletion to a further rewrite. Repeated defects concentrated in one component usually mean it does more than its acceptance criterion asked. dist-2-2's self-referential-URL half leaked in two successive rounds — http/https and www. found in Round 2, then host case and port still open in Round 3, each a case where two strings differ and the URLs are the same — because it had been built well past AC5: npm bare shorthands, transport ports and multi-segment repository paths, none specified, none used by the package, and each a fresh way to return a confident wrong answer that passes a fail-closed guard. repositoryIdentity('../owner-repo') returned a real identity. Round 3's instrument change was to delete the excess, not rewrite it a third time. Narrowing an implementation back to what the AC specifies is restoring scope, not cutting it, and needs no ruling — but it does need a record: name what was removed and why in the story, so the narrowing is visible rather than silent. If the excess turns out to be load-bearing for a consumer the AC does not mention, that is a ruling, not a deletion.
  • The reviewed set must equal the committed set. A round only covers the files that were in the diff handed to it. Before emitting a commit plan, assert that the set of files the review saw is the same set the plan stages. If they differ, either re-review the delta or say so explicitly in the commit Description — never let the earlier round's verdict silently extend to text it never saw.
  • At story close, audit the consumers — not only the diff. Every round above reviews a diff, and a diff cannot show a caller that was never edited. When a story deletes, renames or changes the behaviour of an exported function, a context key, a run:/CLI contract or a documented capability, run one extra layer before it moves to done: enumerate those changes, then find every consumer across the whole repository — code, tests, workflows, agent menus, module-help.csv, docs — including consumers no hunk touched, and judge each still correct. The layer must be independent of the implementer, and it must search for behavioural claims in prose, not only symbol names. This is an extra layer, not an extra round: it does not reset or extend the Round 1–3 bound.

Why the Round-4 cap was exceeded once, and what it taught. dist-1-7 ran a Round 4 at explicit operator request, against this rule's cap. It found two HIGHs — an unsatisfiable git gate and a banner that overclaimed in the opposite direction — so the cap's premise (diminishing returns) did not hold. The reason is diagnostic rather than exculpatory: rounds 2-4 were fixing fixes, not reviewing work, and each patch asserted a fresh unverified external claim (see external-claims-must-be-executed-or-hedged). The restructure-not-patch clause above exists to end that loop at Round 3 — when it was finally applied to ADR-003, a document-wide scope banner closed in one pass what four sentence-level sweeps could not. Do not read this as licence for Round 4; read it as the signal that Round 3 chose the wrong instrument.

Why. Story 7.3 went through 3 unbounded review rounds producing 30 findings. The unbounded "keep reviewing until clean" pattern wastes time and generates diminishing-return findings. Retrospective: ag-epic-7-retro-2026-04-10, Action Item #3.

Why the set-equality clause. Twice in the 2026-08-15 issue #7 / BUG-12 session, a review diff was built from a hand-typed file list, work continued, and the committed changeset ended up larger than the reviewed one — both times because a test file was written after the review was already in flight. The second instance shipped 89 unreviewed lines in commit d9e15713 under a commit message reading "Round 1: no HIGH; 2 MEDIUM + 5 LOW applied or logged", which reads as covering what shipped. Reviewing that gap found a HIGH: the /g flag was unpinned on both escapers, so a non-global replace — the canonical form of the js/incomplete-sanitization class the commit existed to close — passed the suite while leaving every occurrence after the first unescaped. The gap was in tests written in response to a review finding, which is the easiest place to lose coverage and the least likely to be re-checked.

Why the consumer-audit clause. In tfr-1-1, a whole-story consumer audit run at the operator's request after the story reached review found breaks that every diff-scoped round on that story had missed, because the broken call sites were never in a changed hunk: [VT] Validate Team could no longer pass, and step-02 §5's run: block could not run in the documented order (story §"Review Findings — operator-requested additional layers"). A third, the extension validators calling a check without the baseline it now required, was found only by reading the whole validator file during that story's Task 8 (§Completion Notes, "Found during the run"). In tfr-2-1 the story's own consumer audit searched symbol names and missed docs/development.md, which restated the deleted behaviour in prose containing none of them; the independent Acceptance Auditor's audit caught it (story §"Review Findings — Round 1"). Hence both conditions: whole-repository, and independent of the implementer.

How to apply.

  • Never wait for the operator to ask. The failure mode this rule now guards against is not "too many rounds" (the original concern) but "zero rounds" — Fast Lane work shipping unreviewed because the operator was tired and nobody else was watching. If you are preparing a commit plan and no Round 1 has run on the changes it covers, run it first, or state explicitly in the plan that it was skipped and why.

  • When running bmad-code-review, track the current round number. The skill's step-04-present enforces the stopping criteria at the "Re-run code review" prompt.

  • If you're manually re-running a review, check whether the stopping criteria are met before proceeding.

  • If Round 2 produces only LOW/MEDIUM findings (no HIGH), stop — do not trigger Round 3.

  • Remaining findings after the final allowed round go to the initiatives backlog as deferred items, not into another review cycle.

  • Derive the review diff from git, never from memory. Build it with git diff HEAD --name-only (or the equivalent for the chosen baseline) rather than typing the paths you believe you touched. Then, immediately before emitting the commit plan, run the equality check:

    diff <(grep '^diff --git' review.diff | sed 's|^diff --git a/||; s| b/.*||' | sort) \
         <(git diff HEAD --name-only | sort)

    Empty output means the round covered everything the plan stages. Any output is the delta you must re-review or disclose. Costs one command; both 2026-08-15 gaps would have been caught by it.

  • Applying a finding is not a reviewed change. Remediation written after a round is unreviewed text by default. Small in-place fixes to what the round already saw are fine; new code or new tests are not, however directly they answer a finding. Note that the bound still applies — if no HIGH was found, this does not license another round; disclose in the Description instead.

  • Scope the consumer audit from the change, then search outward. List what the story changed (exported symbols, context keys, run:/CLI contracts, documented capabilities), then git grep the whole repository for each — and for the behaviour each implements, phrased as a reader would describe it, since prose restating a deleted behaviour contains no symbol. Record every consumer with a disposition (updated, deleted, historical record left as-is). Falsification: if two consecutive story-close consumer audits find nothing the diff-scoped rounds had not already found, relax this clause to operator-requested.

  • A verification that cannot fail is worse than none. Both 2026-08-15 gaps had a sibling failure: a check that reported success without doing its work (a mutation harness whose perl/shell escaping silently no-op'd, and a test asserting the negation of its own function's exit condition). When a check is the evidence for a claim, prove it can fail — assert the mutation applied, or show the test red against the pre-fix code — before citing it.


Rule: lint-passes-before-review

Statement. Before marking a story review (or submitting a PR for review), run npm run lint and verify it exits 0 with zero warnings in any file the story modifies. The scope is the story's diff, not the whole repo — pre-existing warnings in files the story does not touch are owned by whichever story currently owns those files (or by a follow-up lint-cleanup backlog item).

Why. Story 1A.2 (v63-1a-2-create-config-loader-js-with-direct-yaml-loading) shipped with 1,224 tests passing and two full code-review rounds converged — but produced 8 ESLint preserve-caught-error errors in scripts/update/lib/config-loader.js that were first surfaced by CI run #714 (2026-04-21). Review Round 1 + Round 2 both gated on npm test, not npm run lint, so the regression slipped past both rounds. The existing dev-story DoD checklist said "Linting and static checks pass when configured in project" — a weasel qualifier that made the gate skippable despite ESLint being configured. This rule closes that gap: the DoD checklist is amended (via lint-1.1) to remove the weasel wording, and this rule restates the norm so dev agents see it as a citable convention before touching code.

How to apply.

  • Before marking a story review. Run npm run lint unprefixed (no file filter — the CI gate is unfiltered). If it surfaces any error in files this story modifies, fix before review. If it surfaces any warning in files this story modifies, fix before review. Pre-existing warnings in untouched files are out of scope — log a deferred backlog item if the warning count is growing, but do not scope-creep the current story.
  • Scoping the "files modified by this story". Run git diff --name-only main...HEAD (or equivalent) — that's your touched-files set. The DoD gate applies to every .js / .mjs / .cjs in that set.
  • When the weaker ESLint-rule default hides a real problem. no-unused-vars defaults to args: "after-used" (only trailing unused args are flagged). TypeScript's language server flags all unused args, which is stricter than ESLint. If the IDE reports an unused arg that ESLint misses, use judgment — if it's public API, prefix with _; if it's dead, delete. Do not disable the IDE hint without replacing it with the corresponding fix.
  • Reviewing a PR. If the diff touches scripts/** or tests/** and the author has not explicitly cited npm run lint output in the PR description or commit message, ask for it before approving. An author whose DoD step ran npm run lint and saw errors would have fixed them — their silence about lint is evidence the gate wasn't walked.
  • When CI lint fails but your local doesn't. Different ESLint versions, different rule sets, or uncommitted changes. Run npm ci && npm run lint (clean install, matches CI) before assuming the failure is spurious.

Scope exemptions. None under normal circumstances. If the story amends ESLint configuration itself (e.g., disabling a rule project-wide), the new rule set is what npm run lint exercises — the DoD still applies. If the story is authored specifically to clean up lint (like lint-1.1 itself), the DoD applies forward: the story's own diff must be lint-clean. Pre-existing WIP warnings from parallel in-flight stories (e.g., the 1A.4 migration script in progress during lint-1.1's implementation) are scope-excluded only if the scope exclusion is documented in the story file at authoring time, not retroactively.


Rule: verification-pipefail

Statement. Story Task verification commands that use shell pipes MUST either set set -o pipefail at the script level OR capture the upstream command's exit code via ${PIPESTATUS[0]} (Bash) / ${pipestatus[0]} (zsh) or the per-shell equivalent. The pattern cmd | head/tail/grep ; echo $? is forbidden in any verification context — it captures the rightmost command's exit code (which is always 0 for head/tail in normal operation), not the upstream command's actual exit code. The same rule applies to verification steps in CI workflow run: blocks (see GitHub Actions defaults.run.shell: bash -eo pipefail {0}).

Why. Story cov-1.1 Task 4.4 used npm run test:coverage 2>&1 | tail -15; echo "EXIT: $?" to verify the test suite. The ; separator means $? captures tail's exit code (always 0), not npm run test:coverage's. The cov-1.1 Task 4.4 HALT was triggered when R1 code review independently re-ran the command with set -o pipefail and got a different exit code — exposing that the dev Task had reported "EXIT: 0" while the actual exit was 1 with 12 P0 failures in tests/p0/p0-{emma,wade,mila}.test.js. The story had been marked done on a false positive. Scar-story documented in session-retro-2026-05-05-cov-and-i97-bug.md §"What didn't go well" — i97-bug-epic-1 was authored as the forward-going hotfix and the action item AC-RETRO-1 logged this verification-pipefail rule as required forward-prevention.

How to apply.

  • Authoring a Task verification command. If the command pipes its output (e.g., to tail, head, grep, awk, tee), prefix with set -o pipefail for multi-command sequences OR use ${PIPESTATUS[0]} (Bash) / ${pipestatus[0]} (zsh) for a single pipeline. Example: set -o pipefail; npm run test:coverage 2>&1 | tail -15; echo "EXIT: $?" — now $? is npm's exit code. Or: npm run test:coverage 2>&1 | tail -15; echo "EXIT: ${PIPESTATUS[0]}" — explicit capture of the first pipeline element's exit code (use ${pipestatus[0]} if running locally under zsh). Cite this verification-pipefail rule in the Task body so reviewers can verify the discipline was deliberate.
  • Picking the form. set -o pipefail is recommended when the Task runs multiple commands and you want any upstream failure to short-circuit. ${PIPESTATUS[0]} is recommended for one-off pipelines where you need the exit code of a specific stage. Avoid relying on bare $? after any pipeline.
  • CI workflow steps. GitHub Actions' default bash invocation includes -e but not -o pipefail. Set defaults.run.shell: bash -eo pipefail {0} at the workflow top level (between concurrency: and jobs:) so every run: step inherits pipefail without per-step overrides.
  • Reviewing a story spec. Grep Task bodies for | head, | tail, | grep, | awk followed by ; echo $?. Block at story authoring time if the rule isn't honored — the cost of catching this at authoring is seconds; the cost of catching it after a false-positive ship is hours of dual-cause diagnosis.
  • Reviewing a PR. If a story's Dev Agent Record cites a Task that piped a verification command, verify the pipefail discipline was followed. If not, the verification didn't actually verify what the AC claims.

Scope exemptions. Display-only pipes (formatting output for human reading, where the upstream command's exit code doesn't gate Task completion) are exempt. The rule applies only to verification pipes — those whose exit code is what the Task or AC actually checks.


Rule: capability-form-factor-evaluation

Statement. When a new capability enters the qualifying gate (§1.2 of the initiative lifecycle), and the question is "what form should this take?" — run it through the Capability Evaluation Framework decision tree before assigning a lane or committing to a form factor.

Reference document. _bmad-output/planning-artifacts/convoke-note-capability-evaluation-framework.md — contains the 3-tier model (Skill → Agent → Team), decision tree, promotion/demotion triggers, and overlap analysis template.

Input feed. Friction logs from consulting engagements (_bmad-output/planning-artifacts/convoke-note-friction-log-template.md). No capability gets built without friction log evidence — vision is not demand.

Why. Convoke's ecosystem grows through Enhance skills (Tier 1), new agents in existing teams (Tier 2), and new teams (Tier 3). Building at the wrong tier wastes effort (over-engineering) or creates shallow tools (under-engineering). The framework prevents both by requiring evidence-based tier selection and providing bidirectional promotion/demotion triggers.

How to apply.

  • At the qualifying gate: if the intake describes a new capability (not a bug, not a point fix), check whether the form factor question is relevant. If yes, run the decision tree from the framework doc.
  • For Tier 2+ (Agent or Team): run the overlap analysis template against existing scopes before building.
  • After 3 engagements using a shipped capability: check the promotion/demotion triggers table.
  • Quarterly: review accumulated friction log entries, cluster by scope, and run clusters with 3+ entries through the framework.

Rule: derive-counts-from-source

Statement. Tests and deliverables that assert or report counts (number of agents, skills, findings, taxonomy entries, etc.) must derive those counts from the authoritative source data at runtime — never hardcode them.

Why. Hardcoded counts rot silently. Adding an agent, a taxonomy entry, or a skill changes the real count but not the assertion. The test passes when it should fail. This class of bug has bitten Convoke across multiple initiatives: agent counts in validator tests, taxonomy entry counts in migration tests, skill counts in portability tests — all required fixing after the underlying data grew. SP Epic 5 retro A1.

How to apply.

  • In tests: compute expected counts from the source (registry arrays, manifest files, config entries) — e.g., AGENTS.length + GYRE_AGENTS.length instead of 12.
  • In deliverables (audit tables, coverage reports): generate counts programmatically from the data, not by hand-counting table rows.
  • Reviewing a PR. If a diff adds a magic number that represents a count of something that can change, block and cite this rule.

Rule: shared-test-constants

Statement. Test suites that validate the same invariants (forbidden strings, expected patterns, canonical IDs) must import from shared constant files — not duplicate the lists inline.

Reference. scripts/portability/test-constants.js is the established pattern: FORBIDDEN_STRINGS is the single source of truth for the portability suite.

Why. Duplicated constant lists drift. When a new forbidden string is added in one test file but not the others, coverage has a silent hole. Carried through SP Epic 2–5 retros as the #1 test-reliability debt item until test-constants.js was extracted.

How to apply.

  • Before adding a constant list to a test file, check if a shared constants file already exists for that domain.
  • If it does, import from it.
  • If it doesn't and the list will be used by 2+ test files, create one following the test-constants.js pattern.

Rule: catch-all-phase-review

Statement. Any processing phase that uses a catch-all or fallback matcher (e.g., regex-based text substitution that operates on "everything not already handled") must have its output reviewed for false positives before the deliverable is accepted.

Why. The portability export engine's Phase 6 catch-all produced 400+ warnings and false positives on patterns like [your context] (valid markdown links misidentified as framework references). The catch-all is necessary for coverage but inherently noisy. SP Epic 5 retro A2.

How to apply.

  • When writing a catch-all phase: add a --dry-run or --verbose mode that shows what would be matched before applying.
  • When reviewing output from a catch-all: spot-check at least 10 matches for false positives. If false-positive rate exceeds ~10%, tighten the matcher before shipping.
  • In tests: include at least one test fixture containing known false-positive patterns to verify the catch-all doesn't match them.

Rule: spec-verify-referenced-files

Statement. Story specs that reference specific files (by path or by name) must verify those files exist before the story is marked ready-for-dev. The dev agent must re-verify at implementation time.

Why. Specs written against a moving codebase accumulate stale file references. The dev agent follows the spec, can't find the file, improvises, and produces work that doesn't match the spec's intent. Story 7.3 went through 3 review rounds partly because non-mechanical enumeration missed files that had moved. AG Epic 7 retro A1.

How to apply.

  • When writing a spec: for every file path mentioned, run a quick existence check (ls or glob). If the file doesn't exist, note the correct path or mark it as "to be created."
  • When picking up a story: before coding, grep/glob for every file referenced in the spec. Flag any that are missing — don't silently skip them.
  • Reviewing a spec. If a spec references a file path, verify it. If it references a pattern ("all files matching X"), run the glob and confirm the count matches the spec's claim.

Rule: mechanical-research-enumeration

Statement. Research, catalog, audit, or inventory deliverables must enumerate their subject space via a mechanical search (grep, glob, rg) — not by eyeballing section headers, tables of contents, or file listings.

Why. Eyeballed enumeration silently undercounts. Section headers may not match what the story actually needs ("all skills invoking X" ≠ "sections titled X"), files may have moved, and a human scanning hundreds of files misses edges a grep would catch. Story 7.3 went through 3 review rounds because its inventory was built from section-header eyeballing rather than pattern-based search — edges found in Rounds 2 and 3 should have been found in Round 1. AG Epic 7 retro A1.

How to apply.

  • When the deliverable is "list all X": run the grep/glob first, paste the raw output into the working notes, then transform it to the presentation format. The raw output is the evidence of completeness.
  • In story specs for research/catalog work: include the exact search command as a required input. Example: grep -l 'OC-R6' _bmad/**/*.md rather than "review all Covenant-related files for OC-R6 references".
  • Reviewing a research/catalog PR. If the deliverable doesn't cite a mechanical search, ask how the enumeration was built. If it was eyeballed, request a grep-based re-verification pass before approving.

Rule: staleness-preflight-for-backlog-pickup

Statement. Before starting implementation of any Bug Lane, Fast Lane, or Initiative Lane item qualified more than 3 calendar days ago, OR when parallel tracks have been active since qualification regardless of age, run a four-check pre-flight. An item whose pre-flight returns yellow/red must be re-qualified or re-scoped before work begins.

The rule fires at two moments, not one. Everything above is the pickup arm. There is an earlier one — see Qualification-time arm below — because a row can be dead on arrival, and the pickup checks cannot see it.

Why. Parallel work tracks silently drift backlog items. On 2026-04-19 alone, Convoke's lifecycle backlog absorbed three distinct drift events in a single session: (1) a Vortex audit initiative shipped in a sibling session while the main session worked on unrelated test infrastructure — overlapping file paths that would have caused re-discovery if the main session had then picked an adjacent item; (2) deferrals from a Covenant adoption-surface story were triaged by a prior session using a different IN-ID space than the current session, caught only because the Triage workflow has built-in overlap detection; (3) most instructively, four intakes were logged with lane-ID pointers but the corresponding Fast Lane rows were never materialized — a partial-write that remained invisible until a human eyeballed the backlog and noticed. Without a systematic pre-flight, each of these drift classes cascades: operators pick up already-shipped work, re-triage duplicates, implement against rotted file anchors, or build against semantically-obsolete rubrics.

How to apply. Relationship to sibling rules: Check #3 is a pickup-time application of spec-verify-referenced-files (the existing rule covers authoring + story-ready gates; this rule covers backlog-pickup time). Don't double-execute — if a recent spec-verify-referenced-files run passed and the cited files haven't changed since, treat Check #3 as already-satisfied. Run four checks before coding:

  1. Existence check. grep -r recent commits (since the qualification date) and deferred-work.md changes for the item's ID, key file anchors, and distinctive symbols. Any hit post-qualification = review whether a sibling track already shipped or superseded the work. YELLOW example: a commit touched a cited file but not in the described way. RED example: a commit message says "closes BUG-X" where X is this item's ID.

    Known blind spot — this check cannot see a fix that predates the row. Searching by ID only finds commits written after the ID existed. A row qualified from an aged intake describes a defect that may already have been fixed, and no commit can name a row that did not yet exist when the fix landed. The ID search comes back clean and the row looks healthy. When the row is younger than the work it describes, only the anchor and semantic checks (#3, #4) can catch it — and those must be run against source, not against commit messages. See the Qualification-time arm.

  2. Dependency check. Parse the row's Dependencies column. For each referenced ID (deferred-from:, depends-on:, blocks:, bundles-with:, blocked-on:), verify the target is still in its expected state — not moved to §2.5 Completed, not re-qualified into a different lane, not itself blocked by something newly added. YELLOW example: a bundle-partner item's scope expanded. RED example: a hard dependency shipped with a different API than this item assumed.

  3. Code-anchor validity check. Glob or grep every file path the item's Description cites (format scripts/foo.js:42, backticked filenames, directory references). Missing files = the anchor has rotted. YELLOW example: the file exists but the cited line number now points to unrelated content. RED example: the cited file was deleted or moved outside the repo.

  4. Semantic-anchor check. If the item refers to rubrics, rules, concept definitions, or methodology (any item where the Description cites a spec by name — e.g., "Compliance Checklist §2.6", "A10 threshold semantics", "T1 rule"), verify those sections haven't been amended since qualification. Syntactic checks catch file rot but miss the case where an adjacent ship redefined concept boundaries under the item. YELLOW example: the cited section was edited but the edits don't change the item's framing. RED example: the concept the item is scoped to has been renamed, merged, or removed.

Verdict:

  • GREEN (all checks clean) — proceed to implementation.
  • YELLOW (one or more checks flagged an ambiguous signal per the examples above) — confirm with the operator / qualifier before proceeding; may need a one-line description refresh.
  • RED (any check found definitive drift per the examples above) — re-qualify the item via [R] Review mode in bmad-enhance-initiatives-backlog, or if obsolete, move the row to §2.5 Absorbed per backlog-format-spec.md (never delete outright — every removal becomes a §2.5 entry).

Scope exemptions.

  • Age exemption: items qualified within the last 3 calendar days are exempt from the date-triggered arm — pre-flight on fresh work is theater. Threshold rationale: Convoke's observed drift-to-surface lag from parallel sessions has been ≤24h in practice (3× multiplier gives reviewer-latency slack). Revise if evidence shifts.
  • Parallel-tracks trigger has no age exemption — if a sibling session was active between qualification and pickup, run the pre-flight regardless of item age. "Active" = commits or backlog edits from a different session since the item's qualification timestamp.
  • Trigger-blocked exemption: items whose Dependencies column lists an explicit trigger criterion (e.g., "blocked-on: X ships") defer the pre-flight until the trigger fires. At unblock-time, the pre-flight runs against the full elapsed window from original qualification — not a fresh clock. This is deliberate: the accumulated drift is exactly what the check is catching.
  • No-cited-surface exemption: items with neither file anchors nor dependency references nor ID references in the Description (e.g., external-setup tasks like gh auth or NPM_TOKEN setup) are exempt by construction — the four checks have no surface to examine. The exemption is structural, not a judgment call; if you can construct a surface, run the checks.

Qualification-time arm

Statement. Before qualifying an intake older than 7 calendar days into a lane row, verify its claim against current source — read the cited file, run the cited command, check the cited behaviour. Do not qualify from the intake's own text. If the claim no longer holds, close the intake with a note instead of materialising a row.

Why. An intake is append-only by design: it is the audit trail, and that is correct. But append-only means an intake is a snapshot of a belief on the day it was written, and nothing ages it. Meanwhile sibling sessions fix things incidentally, in commits about something else, with no reason to revisit an intake they never read.

Measured instance. IN-187 was filed 2026-08-15 stating that the Review-mode step files hardcoded lane column counts of Bug 10 / Fast 9 / Initiative 10 against real tables of 11 / 10 / 11, so pre-write validation failed on every run. True when written. Commit 69c0eba6 fixed it on 2026-08-16 — inside a commit titled "bind lane ordering to every writer, not the workflow", which is why nobody connected the two. On 2026-08-24 the intake was qualified into T57, scored 9.5, and placed at the top of the Fast Lane, where it was twice reported to the operator as the highest-priority open item. It had been fixed for eight days. Closed 2026-08-25 by audit; the pickup pre-flight would never have caught it, because check #1 searches for T57 and T57 postdates the fix.

The exposure is not one row. As of 2026-08-25 the backlog holds 178 unqualified intakes, 162 of them filed in April or earlier, across two shipped releases. Each is a candidate for the same failure.

How to apply.

  • Qualifying an intake ≤ 7 days old. Proceed normally; the belief is probably still current.
  • Qualifying an older one. Verify against source first, then qualify. Record what you verified in the lane row's Description — one clause is enough ("re-verified against foo.js:42 on YYYY-MM-DD"), and it converts the row's age from unknown to known.
  • When the claim no longer holds. Annotate the intake in place — *(closed YYYY-MM-DD — fixed by <commit> before qualification)* — and do not create a lane row. Nothing is deleted; §2.1 stays append-only.
  • When it partly holds. Qualify the surviving part only, and say which part died. Three rows in the 2026-08-25 audit (BUG-9, I133, I157) each bundled an instance with a missing gate; every time, someone fixed the instance incidentally and the gate outlived it while the row kept a score priced for both. Prefer filing instance and gate as separate rows — they decay at different rates.

Scope exemption. Intakes with no verifiable surface — external-setup tasks, operator decisions, questions — are exempt by construction, the same exemption the pickup arm grants.

When to skip. Skip only via the exemptions above. If the pre-flight feels expensive on a regular item, the item is probably over-scoped and should be split — the four checks are bounded by the item's cited surface, not the whole codebase.

Reviewing a PR that implements a backlog item. Ask the author: did you run the staleness pre-flight? If the answer is no and the item was qualified more than 3 days before the PR opened (or a parallel-tracks event intervened), request a retroactive run and hold the review until it's clean.

Forward-looking note. This rule is the Phase 1 convention-test for a future [P] Preflight step file in bmad-enhance-initiatives-backlog (tracked as I62 in the lifecycle backlog, Blocked). I62 unblocks when either: (a) the rule is applied ≥ 3 times with ≥ 1 real-drift hit documented in the backlog Change Log, OR (b) 2 weeks elapse since this rule's ship date (2026-04-19) — evidence-freshness deadline to prevent Phase 1 rotting. Applications are recorded via Change Log entries of the form "Staleness pre-flight run on item X: GREEN/YELLOW/RED" — this is the verifiable substrate the I62 trigger counts. No applications logged = Phase 1 rotted; unblock on (b) path but revisit whether the rule itself needs reshaping.

preflight-soft-warn

Rule. Runtime preflight checks (BMAD compatibility, environment sanity) emit yellow WARNINGs to stderr but exit 0 — never block the install/update flow. Operators see the WARNING but the operation continues.

Why. Story v63-3-2 (FR23) shipped the first preflight in scripts/update/lib/compat-preflight.js. Detection is best-effort: Convoke is a parallel BMAD extension installed side-by-side, not a dependent. Amended 2026-11-04 (BUG-20): the preflight reads BMAD's own install record, _bmad/_config/manifest.yaml, first and node_modules/bmad-method/ only as a fallback. Reading node_modules alone made "BMAD core not detected" fire on every project where BMAD was installed by its installer — this repository included — so the warning was false wherever it was most often seen, and the version floor never ran. False-positive hard-blocks would trap operators with legitimate non-standard installs (git-clone, monorepo, alternative distribution channels). Higher-fidelity gates ship in Story 3.3 (publish-gate) and Story 4.x (behavioral-equivalence) where the cost-benefit favors strict failure.

How to apply. Future preflight helpers (e.g., environment-preflight, dependency-preflight) MUST follow the same contract: stderr WARNING + exit 0 pass-through; never process.exit(non-zero); never throw to the caller. Use chalk.yellow(...) so WARNING text stays under non-TTY (chalk auto-disables colors only). Live smoke against the dev tree MUST report what it detected. "Report" means the returned result (detected, version, source) and the installers' BMAD Method <version> found line — a passing preflight writes nothing, and convoke-update adds no line for it (operator ruling 2026-11-04, BUG-20 Round 1 D1). This tree has BMAD installed and its install record committed, so the correct preflight output here is silence, with the recorded version in the result (tests/unit/compat-preflight.test.js, the live-smoke test). The WARNING branch is proven against a fixture with no BMAD install record — silent green on THAT fixture is a fixture-or-gate bug, not a success signal. (Until 2026-11-04 this sentence required the dev tree to emit the WARNING; it was asserting the bug.)


Rule: backlog-write-discipline

Statement. The lifecycle backlog's three lanes are sorted at all times — §2.2 Bug, §2.3 Fast and §2.4 Initiative each ordered per §"Lane Ordering" in backlog-format-spec.md: live rows by composite score descending, then untriaged rows, then closed rows. Any writer who adds a lane row, edits a score, or flips a status is responsible for restoring that order in the same edit — whether or not the write went through bmad-enhance-initiatives-backlog. A row left where it landed is an incomplete edit, not a deferred chore.

Why. The sort rule is not new and was never missing. It is stated four times in the format spec (once per lane plus a global tiebreak) and implemented in all three workflow write paths. The lanes were unsorted anyway, because the workflow is not what writes to the backlog. Of the four lane rows added on 2026-08-15, zero arrived through Triage: T37 came in 73528ea6 (a BUG-12 fix commit), BUG-17 and BUG-18 in c841fcd2 (a BUG-16 fix commit), BUG-19 in cc28ee5c (a Story 4.5 docs commit). Two of them arrived malformed — 10 columns against an 11-column table — because no validation ran on a hand-edit. Restating the rule inside the skill would have changed nothing; the obligation has to sit where the hand-editors read, which is this file.

The cost is not tidiness. Position is the first thing a reader uses to pick up work, so an unsorted lane misdirects. Measured 2026-08-16: the Bug Lane held a closed row scoring 17.1 at position 4, directly above BUG-15 (17.9, Open) — the highest-scoring open item in the project, reading as fifth-most-important. That is the same class of harm as BUG-8 sitting Open for six days after shipping: the table asserted something false and everyone downstream believed it.

How to apply.

  • Adding a lane row by hand. Compute the RICE composite first, then insert at its sorted position — not at the top, not at the bottom. Copy the column layout from an adjacent row in the same table rather than from memory; that is what BUG-17/BUG-18 got wrong.
  • Closing a row is a MOVE, not a status edit. The row leaves its lane for §2.5 in the same edit that closes it — see "Closing a Row" in backlog-format-spec.md. Demoting it to the bottom of the lane is the superseded rule; leaving it in the lane at all is now a detectable error rather than a judgement call about position.
  • Rescoring. Re-place the row; a changed score with an unchanged position is a silent lie.
  • Before emitting a commit plan that touches the backlog. Run the check below and paste its result into the commit Description. It costs one command.
  • Reviewing a diff that adds or edits a lane row. Verify the position. If the row was appended to the end of a table that is not sorted ascending, block and cite this rule.
  • Prefer the workflow when it fits. bmad-enhance-initiatives-backlog Triage mode logs the intake, cross-references it, sorts, and writes the Change Log entry. A hand-edit does none of that for free. Use it for anything larger than a single row.

The check — node scripts/audit/backlog-integrity.js. Shipped by T58 (2026-08-25) and wired into CI at .github/workflows/ci.yml:161, so it runs on every push whether or not anyone remembers it. Run it locally before emitting a commit plan that touches the backlog and paste the result into the Description.

It asserts four things; two of them are this rule: lane shape (lanes are score-ordered and hold no closed rows) covers clauses 1 and 3, alongside referential integrity, per-table arity, and structure and coverage. Verified by mutation 2026-08-26 — moving T51 (7.65) below a 2.8 row and marking a lane row ✅ Done in place were both caught, exit 1, with the offending ID and line named.

An inline Python check used to live here and was deleted 2026-08-26 — do not restore it. It hardcoded column positions (f[6] for Score, f[8] for Status). When T69 added the Filed column the Fast Lane went from 10 fields to 11, and those indices silently became E and Portfolio: the check reported 51 violations against a correctly-sorted backlog, with scores like BUG-19 (2.0) for a row scoring 5.7. Anyone following this rule got a wall of false failures and either ignored the gate or "fixed" a lane that was already right. backlog-integrity.js reads each table's own header, so it survived the same schema change untouched — which is the argument for a script over a snippet, and an instance of derive-counts-from-source.

Scope exemptions. §2.1 Intakes are append-only and carry no score — they are never sorted. §2.5 sub-tables are append-only receipts and are never sorted. Untriaged lane rows (? for R/I/C/E, — for Score) have no sort key and park after the live block per clause 2 — there is no closed block in a lane to park before, since clause 3 evicts closed rows to §2.5.

Note. This section is the pointer the previous version anticipated. It read: "The durable version is a shape-and-order assertion wired into docs:audit or convoke-doctor so that any writer is caught — tracked in the lifecycle backlog, qualified from IN-188. When that ships, this section reduces to a pointer." IN-188 was qualified into T58, T58 shipped, and the section has been reduced accordingly.


Rule: external-claims-must-be-executed-or-hedged

Statement. Any assertion about the behaviour of a system outside this repository — a registry, a package manager's internals, a third-party API, a CI runner environment, a hosted setting — must be one of:

  1. Executed, against the basis that will actually be used — not a fixture, not a different OS, not a summary — with the command and its output recorded; or
  2. Quoted verbatim from primary source, with the source identified (raw doc file, source code with file:line, live API response); or
  3. Explicitly marked unverified, naming what would settle it.

A claim that is none of these does not enter a governed artifact — not an ADR, an epic, a story AC, a backlog row, or an operator runbook. "I read the docs" is not execution, and a documentation summary is not the docs.

Why. dist-epic-1 produced 36 correction rounds across 7 stories, and the defects sort almost perfectly along this line. Everything executable locally — gate composition, pack counts, lane order, backlog integrity — was correct on the first attempt. Every claim about npm's behaviour was wrong, unverifiable, or still open:

Claim Outcome
EPUBLISHCONFLICT is npm's duplicate-version error False — no thrower exists; it lives only in a formatter
The 2FA setting makes hand-publishing impossible Inverted — npm's wording is that a maintainer "must publish interactively"
git status --porcelain --ignored=matching gates a clean tree Verified in a fixture; returns 161 lines in this repo and can never pass
BSD vs GNU sort -V agree Disclosed, never closed; still unexecuted on a runner
auth-only satisfies the package publishing policy Still unknown — shipped as a recorded open risk

Each wrong claim generated its own correction round, and the corrections asserted new unverified claims in turn — ADR-003's central premise was swept four times before the approach itself had to change.

How to apply.

  • Before writing an external fact into an artifact, ask: did I run this, or did I read about it? If read — quote the primary source and say so, or hedge.
  • Prefer raw source over rendered docs and over search summaries. Two summarisers disagreed about which npm 2FA option carried which sentence; fetching the raw .mdx settled it in one command.
  • When execution is impossible (a hosted setting with no read-back, an account state you cannot reach), say "documented, not observed" and name the observation that would close it. That phrasing is the deliverable — not a weaker version of one.
  • Correcting an overclaim with an unhedged counter-claim is the same defect pointed the other way. It happened here: "impossible" was replaced with "never removed", when the evidence supported only "documented, not observed".
  • Reviewing a PR. If a diff asserts external behaviour with no command, no quote, and no hedge, block and cite this rule.

Rule: documentation-claims-must-be-derived

Statement. Any sentence in project documentation that asserts something about this repository's own behaviour — a command, a CI gate, a threshold, a convention, a policy — must be derived from the source that determines it, at the time of writing. Recalled, inferred, or pattern-matched claims do not enter documentation. A policy that does not exist yet is a proposal, not a fact, and must not be written in the indicative.

Operational check. For each assertion in the diff, name the file that determines it and read it. Conventions come from git log, gates from .github/workflows/, thresholds from their config file, rules from this file. If no file determines the claim, it is not a fact about the system — get it ratified, then write it.

Why. Commit 832a18db (2026-08-25) added CONTRIBUTING.md, SECURITY.md and the GitHub templates. Five mechanical checks passed — docs:audit, install-scope-check, backlog-integrity, lint, npm pack --dry-run — and all 12 relative links plus 4 asserted paths resolved. It shipped with two defects, both inside the section that declares itself normative and says it overrides everything else in the file:

Claim written Reality
Commit types are feat, fix, docs, test, chore, refactor, governance test and refactor appear in none of the last 400 commits; ci and release are used and were omitted
"Entries are written at release time" stated as established policy No such policy existed. Inferred from how CHANGELOG.md reads, then published under the maintainer's authority

Three shell commands found both, after the commit was pushed. No gate could have: docs:audit walks the agent/workflow registry and checks link shape. Nothing in this repository has an opinion about whether a sentence is true.

How to apply.

  • "Shape passed" is not "content verified." Link checkers, YAML parsers and pack listings verify shape only. When reporting verification of a documentation change, say which of the two you ran.
  • For a documentation change, verifying the assertions substitutes for reviewing the diff. It is the higher-yield pass, not a lighter one — a diff review reads prose for plausibility, which is exactly what a wrong-but-plausible claim survives.
  • Do not invent policy while documenting it. If the artifact needs a rule that does not exist, name it as an open decision and route it to the operator. If the ratified rule binds contributors or agents, it belongs in this file, not only in prose docs.
  • Reviewing a PR. If a docs diff asserts repository behaviour and the change shows no derivation — no command, no cited file — block and cite this rule.

Related, and deliberately distinct. derive-counts-from-source covers counts; spec-verify-referenced-files covers whether a referenced file exists; external-claims-must-be-executed-or-hedged covers systems outside this repository. This rule covers claims about this repository that are neither counts nor paths — the ones that are true or false rather than present or absent.


Rule: verification-must-be-falsifiable

Statement. Before citing a check as evidence, establish that it could have said something else. Run it against a known-bad input, or mutate the thing it inspects and confirm it goes red. A check that cannot fail is not weak evidence — it is no evidence, and it is worse than none because it reads like proof.

verification-pipefail is one instance of this defect. This rule is the general case, and it applies to ad-hoc verification during work, not only to checks cited in a review.

Why. Nine failures, every one of which produced a confident wrong answer. The first four fell in three days; the fifth is from dist-2-5 (2026-09-02) and is the same error one level in. The last four are from dist-epic-2's closing stories and T102, after this rule was already written and being followed — which is the point: the rule did not stop them, running the falsification did. Every one was caught by execution, none by reading:

What was run What it looked like What it was
npm run badges:check | tail -8; echo $? exit=0, gate passes $? was tail's. True exit was 1; the gate was blocking the release
grep -c 'convoke-agents@${getPackageVersion()}' file 0 — "the fix isn't in the tarball" {} is a grep interval expression. The fix was there; a false alarm was raised against a correct build
npx -p convoke-agents convoke-version → 3.3.0 "good, -p bypasses the stale global" It did — and also served a version two releases old. Half the claim was verified, all of it was reported. This became BUG-16
Generator mutation harness, 4 cases all exit=1 — "guards work" No node_modules in the scratch tree. All four died on Cannot find module 'yaml'. Nothing was tested
node --test <file> after a mutation → ℹ pass 8 / fail 1 "the mutant is caught; the suite guards this" Something failed; not the thing claimed. The atomicity test survived every mutant — the race test died each time. Reported as mutation-verified twice, in two successive review rounds (dist-2-5, 2026-09-02)
Bare-identifier extractor run over the pin (dist-2-7, 2026-09-05) the pin matches; the interpolation site is covered The extractor could not see quoted keys, so the site it was written for was invisible to it. It matched, and it was blind
Ratchet plant + node --test → 16 pass (dist-2-8, 2026-09-06) "the planted defect is caught" The plant script threw before planting anything. Sixteen tests passed against an unmodified tree. The number was real and meant nothing
declaredUnits({registry:{}}) asserting C1 fires (T102 (e), 2026-09-07) "the fix is pinned" The defect was in the CALLER, which substituted a literal {} instead of calling declaredUnits at all. The test exercised the callee and stayed green when the fix was reverted
Probe agent pushed into agent-registry.js, harness → tree=0 (T102 NFR10, 2026-09-08 — in-session, no story record; the mechanism is checkable at refresh-installation.js:854) "the gate ran and the tree is clean" The mutant was absorbed by a derived expectation. Wrapper generation READS that registry (refresh-installation.js:854), so the probe entered the expected set and the actual set together. The two sides agreed because they share a source

A sixth was caught only by luck: a backlog column-arity check that flagged 71 correct rows, which would have made the gate unreadable had it shipped.

Historical record — do not "repair" these rows. All four are real incidents and stay verbatim; they are this rule's entire justification. Two of them now name a surface that no longer exists: row 1's npm run badges:check and row 4's generator mutation harness both targeted the badges pipeline, deleted by ADR-001 (story dist-1-1). What the rows document is the reasoning error, not the command — rewriting them against a live command would destroy the evidence and teach nothing.

The common shape is not carelessness about shell syntax. It is reading a check's output as evidence without ever seeing it produce the other answer. The last row is that error one level in: the check did produce the other answer, and the other answer was never read. A count is not an attribution.

How to apply.

  • Before citing any check, show it red. Mutate the input — inject the defect, delete the file, revert the fix — and confirm the check fails and names the right thing. Then restore and confirm it passes. Both directions, or it is not a check.
  • When the check is a SUITE, name the assertion that died — a pass/fail count is not evidence. fail 1 says something broke; it does not say what, and the difference is the whole claim. Run the mutant with the failing test names visible (node --test … | grep '^ ✖', or --test-name-pattern to isolate) and record mutant → test as a table, not a tally. Two consequences follow, and both have bitten:
    • A test that no mutant uniquely kills is not proven to guard anything. In dist-2-5 two successive versions of an atomicity test passed against a zero-atomicity implementation; each time a sibling test absorbed the mutant and the count read fail 1. The phantom survived a review round because the evidence for it was a number.
    • Choose mutants that target one property each. A mutant that breaks several properties at once cannot distinguish a load-bearing test from a bystander. Aim for a battery where every test is the sole executioner of at least one mutant; a test that never is should be deleted or rewritten, because nothing would notice its removal.
  • For a VALIDATOR, an assertion of "no finding" tests nothing. A check that skipped an input produces exactly the observation a check that validated and passed it produces, so a test whose expected value is the empty result cannot distinguish the two. Assert with an input that MUST be reported — a missing target, a broken reference — so that a finding has to appear. In dist-2-2 every self-referential test used a target that existed; folding owner/repo case-sensitively therefore survived the entire suite, because the resulting silent skip and the intended pass were the same green. Rewritten against a missing target, the same edit dies immediately.
  • Cite the TEST, never a mutant identifier. Mutation harnesses are scratch scripts and are not committed, so an M14-style identifier is a pointer to nothing: a reader cannot reproduce the row, and per verification-claims-must-name-their-evidence a pointer to nothing reads as evidence and is worse than none. This recurred in three consecutive dist-2-2 rounds — the last time inside the very paragraph written to remove the previous such citation. Key the matrix on (edit to make → test that goes red); both halves exist in the repository, so any row can be re-run with one command.
  • A survived mutant may be an EQUIVALENT mutant, and the difference must be established rather than assumed. Where guards are layered, no single line is solely load-bearing and removing any one of them changes no behaviour — that is redundancy, not a coverage hole. Distinguish the two with a combined mutant that strips the whole defence at once: in dist-2-2 three separate edits each survived, while removing all of them together produced https://github.com/../owner-repo/ — the exact defect under review — and was killed by two named tests. Record the survivor as redundant. Do not write one test per redundant line so that every row shows a kill; that manufactures the appearance of coverage instead of the fact of it. This refines the "sole executioner" bullet above: that bullet is about a test nothing needs, this one is about a line whose neighbours already enforce its property — delete-or-rewrite applies to the first, honest annotation to the second.
  • The mutant must be the defect you are claiming to guard against, not merely a defect. "Delete the call" is a weaker mutant than "replace the call with the wrong-but-plausible alternative": the first is caught by anything downstream, the second is what a future maintainer actually writes. dist-2-5's decisive mutant was not remove the atomic write but write the same bytes to the published name instead of the temp — the shape of an innocent refactor.
  • The mutant must not be ABSORBED by a derived expectation. Where a check compares two sets, establish that your injection lands on ONE side before reading the result. T102's NFR10 demonstration pushed a probe agent into agent-registry.js expecting a missing wrapper — but the installer generates wrappers from that same registry, so the probe joined the expected and the actual set at once and the gate correctly reported clean. Read as "gate ran, tree=0, fine", it would have shipped a blocking gate whose demonstration proved nothing. Ask what the expectation is derived FROM. If the answer includes the thing you just mutated, the mutant is inert; inject at the point where the two sides genuinely disagree — there, an installer that DROPS a unit the registry declares.
  • A demonstration that trips several gates at once has not isolated yours. T102's replacement injection produced tree=1 and a red run — and also doctor=1, so it proved the harness fails on a broken tree, not that the $TREE wiring is what fails it. Isolating it needed a defect the sibling gate treats as a soft warning. When a verdict is a conjunction, a demonstration that moves two terms tests neither.
  • A new gate is not shippable until it has failed once on purpose. backlog-integrity.js was proven against the pushed commit that had actually lost the rows; cli-guidance-check (withdrawn) shipped twice matching nothing because that step was skipped.
  • State the falsification in the commit Description, per commit-preparation field 5. "Verified by execution" without naming the failing case is the phrasing this rule exists to catch — it appeared in three commit messages this week, none of which had run a negative case. Where the claim is about what the CODE guarantees rather than about a check you ran, verification-claims-must-name-their-evidence is the governing rule.
  • Prefer a check that fires on the real artifact. Verify the published tarball rather than the source, the emitted string rather than the code that emits it, the committed file rather than the working tree. Every failure above inspected a proxy.
  • Scratch harnesses need their dependencies. A mutation matrix where every case fails identically is testing your harness, not your code. If all rows of a matrix agree, suspect the harness first.
  • Watch for the check that only ever passes. If you cannot construct an input that makes it fail, it is asserting nothing — delete it or narrow it until it can.

Exception. None. If a check genuinely cannot be falsified — a tautology, a count of itself — it must not be cited as evidence at all.

Companion — a fix must change BEHAVIOUR, not just the verdict. This rule's subject is a check that cannot fail. Its dual is a change that makes a check pass without touching what the check is about. Before accepting a fix that turns a signal green, name the observable behaviour that now differs. If the honest answer is "the check's verdict", it is not a fix.

Measured, T104. loadYaml was rewritten from require('js-yaml') to require(require.resolve('js-yaml', { paths: [__dirname] })). That reads as an explicit, deliberate resolution root, and it resolves to exactly the same file, because __dirname is inside $REPO. Re-derive — this is the whole rule in one command:

node -e "console.log(require.resolve('js-yaml', { paths: ['./scripts/audit/lib'] }))"
# -> <repo>/node_modules/js-yaml/index.js   — the same place a bare require finds

The static gate under review flipped from red to green on that edit; both versions still died identically on a tree with no node_modules. The rewrite was reverted before it was committed, so the gate itself is not reproducible — the command above is, and it is the part that transfers. The same session produced a second instance: an "anchor" exemption silenced by a JSDoc sentence describing the pattern it excused, which made the gate unable to fail for the one module it was built for.

The class was recognised independently before this. T140 (2026-09-11, a different defect and a different session): "Do NOT close by widening VOICE_MARKERS; that would make the decorative gate pass harder without making it detect drift." Two people reaching it from two directions is why it is written down rather than treated as one bad session.

Falsification. If two consecutive fixes challenged this way turn out to have changed real behaviour, relax the rule.

Not enforced, and unenforceable. No check can see this — a gate that could tell a real fix from a verdict-shaped one would have to know what the fix was for. It sits here, where authors read before writing, for the same reason verification-claims-must-name-their-evidence states outright that it carries no grep.


Rule: verification-claims-must-name-their-evidence

Statement. Any sentence asserting that the code guarantees, proves, checks, cannot do, or is independent of something must name the thing that makes it true — a file:line that implements it, or a command whose output demonstrates it. This binds comments, spec text, acceptance criteria and test names, not only commit messages. A claim of this shape with no pointer is a plan, not a description, and must be written as one.

Operational check. For each such sentence in the diff, answer: which line of code does this, and what would I run to see it fail? If the answer is "I did it in a shell once", the sentence is false — the shell is not the artifact. If the answer is "the mutation kills it", name which assertion goes red, because a mutation can die on an unrelated one.

There is deliberately no grep here. The obvious one — cannot|never|always|guarantee|proves|independent of over added comment lines — returns 30 hits on the T103 diff, nearly all legitimate history prose. Per catch-all-phase-review that false-positive rate disqualifies it, and a gate nobody trusts is worse than an explicit human step.

Why. T103 (f192117a → 810f1788) ran three adversarial review rounds plus a delta review of the remediation: eight HIGH findings. Seven distinct false claims about the code's own correctness apparatus were found, and three of them were introduced by corrections written to fix earlier ones:

Claim written Where Reality
"the caller cross-checks the two counts against an independently-derived total" code comment No such computation was ever written. It was run once in a shell, then described as if the code did it
"Assumptions audited — do not re-derive in review" spec Design Notes The assumption it protected was false on the tree that day. Both reviewers found the blocker only by ignoring the instruction
"the mutation … makes the message appear and kills it" test comment The kill came from an unrelated arithmetic assertion. The guard it claimed to prove had zero coverage — removing it survived the suite
"blind to the block bound" / "counts every line ANYWHERE in the file" 2 comments + 1 AC Gated entirely on inBlock; not blind to it, and not file-wide
"cannot detect one that never opened" correction to the above It detects exactly that, loudly
"real sibling keys in this file carry underscores" correction to the above generated: and project: carry none and do match; safety came from ordering
verb distribution "on story-shaped scopes" code comment + spec Measured over the story + epic population; the story-only figures differ

The cost is not tidiness. The first row is why a second silent data-loss path survived a whole round: the remedy for the class was written into a comment claiming it had been implemented, so nobody built it, and one de-indented key went on discarding 302 of 451 keys while printing a clean result and exiting 0.

None of these was caught by a test, by lint, by CI, or by the mutation matrix — every one of those instruments reads code, and a comment is not code. Only an adversarial reader caught them, which is why this is a rule about writing rather than a check.

How to apply.

  • Point at it or don't claim it. "Cross-checked against an independent count" needs the line that computes it. If you cannot cite one, write "not cross-checked" — that phrasing is the deliverable, not a weaker version of one.
  • Negative claims are the dangerous ones. "This cannot happen", "it cannot detect X" invite the reader to stop looking. Run the negative case before writing it; two of the rows above are negative claims that were simply false.
  • Never instruct a reviewer not to verify something. "Do not re-derive in review" manufactures the blind spot it sits in front of. If a figure is expensive to re-derive, record the command instead so re-deriving is cheap.
  • When a fix is defended by a mutation, name the assertion. "M6 kills it" is insufficient; "M6 turns it('…') red on its second assertion" is checkable.
  • Correcting a false claim is where the next one gets written. Three of the seven arrived that way. Re-run the check after editing the sentence, against the sentence you actually wrote.
  • Reviewing a PR. For every sentence asserting a guarantee, ask for the file:line or the command. If the author cannot produce one, the claim is the finding — regardless of whether the code is correct.

Related, and deliberately distinct. verification-must-be-falsifiable governs a check you ran and cite as evidence — show it can fail. documentation-claims-must-be-derived governs claims about repository behaviour in documentation. external-claims-must-be-executed-or-hedged governs systems outside this repo. All three assume the thing being described exists. This rule covers the case those three cannot see: a sentence describing the code's own correctness apparatus when that apparatus is absent, weaker than stated, or credited to the wrong assertion.

Exception. Prose that records history or intent rather than a present property — "this exists because c841fcd2 deleted the BUG-16 row" — is exempt, and this file depends on such prose. The test is tense and mood: a claim about what the code does now needs a pointer; a claim about what happened does not.


Rule: commit-preparation

Statement. The operator commits through GitHub Desktop and does not hand-author commits. Therefore the agent MUST produce an explicit commit plan for any change it makes, and the operator executes that plan rather than improvising. A commit plan is an ordered list of commits; each entry carries exactly three things:

  1. Files — the complete list to stage for that commit, and nothing else.
  2. Summary — one line, ≤ 72 chars, <type>(<scope>): <intent>. Types: feat, fix, test, docs, refactor, chore, governance. Scope is the story ID (v63-4-5), backlog ID (T25), or module (doctor). The summary states intent, never the filename.
  3. Description — why the change exists, what it affects, and the review status of the change (Round 1: PASS / Round 1: findings applied / Round 1: skipped — <reason>).
  4. Staged set — the command that proves the staged set equals the Files list: git diff --cached --name-only. Run it after staging and before committing.
  5. Falsifiable — for every check the Description cites as evidence, one clause naming how it was shown able to fail. lint 0 is not evidence unless lint can go red on this change; a new gate is not evidence until it has been run against a known-bad input. See verification-must-be-falsifiable.

Never acceptable: Update <filename> / Create <filename> as a summary. It carries zero intent and makes git log unreadable as a history of decisions.

Why. Every commit in this repository as of 2026-08-15 is a single file with a GitHub-Desktop-default message. The consequence is not cosmetic: scripts/lib/taxonomy-merger.js and its test landed in two separate commits on 2026-08-15, violating the Phase 3 Epic 1 atomic-commit rule — not through carelessness but because file-by-file staging in a GUI makes atomic multi-file commits the harder path. A history of Update X cannot be bisected by intent, cannot be reviewed as a changeset, and cannot answer "why did this change?" for any future reader, human or agent.

How to apply.

  • Agent side. After completing any change, emit the commit plan before the operator asks. Group by logical change, not by file — source and its test belong in one commit, a rename and its call sites belong in one commit. If a change genuinely splits into several commits, order them so each one leaves the tree green.

  • Operator side. In GitHub Desktop, check only the files listed for commit 1, paste Summary and Description, commit; then repeat for commit 2. Do not commit files the plan didn't list — an unlisted modified file means the plan is stale, so ask for a refresh.

  • ⚠ Never instruct line-level staging on a MODIFIED line. This is the most damaging instruction in this rule's history. A modified table row appears in the diff as -old followed by +new; staging the - side without the + side deletes the row outright, silently, with every check green. It has destroyed backlog records twice: c841fcd2 dropped the BUG-16 row while shipping BUG-16's own fix, and 3a3de195 dropped T35 (an open risk item) and T39 while its message claimed to have repaired them. Both times the agent had instructed line-level staging because a concurrent session shared the file.

    • Prefer whole-file staging whenever the only dirty hunks in that file are the agent's own. Check first with git diff --name-only; if a file is shared, say so explicitly rather than defaulting to line-level.
    • When line-level is genuinely unavoidable (a file carrying two sessions' work), stage whole hunks, never individual lines, and verify before committing — git diff --cached must show both sides of every modified line.
    • Backstop. scripts/audit/backlog-integrity.js runs in CI and fails on any BUG-n/T-n cited by a row that no longer has one. It catches the symptom after a push; the guidance above is what prevents it.
  • Review coupling. A commit plan is a landing point per code-review-convergence. Preparing a plan without a Round 1 on the changes it covers is a rule violation; if review is deliberately skipped (e.g. a docs typo), say so in the Description rather than leaving it silent.

  • Enforcement — the chokepoint exists; the backstop does not. The commit-plan handoff is the chokepoint gate, and it only covers commits that pass through an agent session. There is currently no automated backstop. An earlier version of this bullet asserted one in the indicative — "a story cannot reach done without a review record, and a commit touching scripts/**/*.js must touch its test or carry an explicit opt-out" — and that gate was never built. Verified 2026-08-26: no job in .github/workflows/ci.yml asserts a review record or a test-touch, and no script under scripts/audit/ mentions review.

    The correction matters because the false sentence had a cost. On story gen-1-1, code-review-convergence's mandatory Round 2 was skipped, the reasoning "the HIGH is fixed" was written into a pushed commit, and 132 lines shipped unreviewed — caught only when the operator asked whether reviews had been included. Rounds 2 and 3 then found four more HIGH, including a fix that deleted 41 of 53 manifest rows while reporting "other modules preserved". Nothing caught the bypass, because nothing was watching for it. This is the same defect class as documentation-claims-must-be-derived, occurring inside the file that defines that rule: a policy written in the indicative before it exists tells the next reader they are protected when they are not.

    Building the gate is tracked as T77. Until it ships, the chokepoint is the only enforcement, which means a skipped round is invisible unless a human asks — and that has now happened twice across sessions.


Rule: team-state-directories

Statement. A Convoke team that keeps state between runs owns .<team>/ at the project root — its own, never another team's. That directory is distinct from the team's output_folder, which stays {project-root}/_bmad-output/<team>-artifacts/ for every team without exception. Every file the state directory can hold carries a declared VCS treatment, and the declaration is implemented in .gitignore. A treatment stated only in an architecture document or a PRD is not a treatment.

Why. Gyre is the only stateful Convoke team today, and .gyre/ got all three parts wrong for six months without anyone noticing, because nothing was watching.

Four sources stated a policy and disagreed. gyre-arch.md classified findings.yaml and history.yaml as gitignored — at ed6a692a:164-167, cited by commit because the same 2026-09-12 change that produced this rule corrected those lines, so the current file says the opposite (git show ed6a692a:_bmad-output/planning-artifacts/gyre-arch.md | sed -n '164,167p'). It also contradicted its own AD2 paragraph, which had findings.yaml committed all along. gyre-prd.md:438-440 classified three files and stayed silent on four. README.md:78 said "committing the directory is the intended workflow." .gitignore had no .gyre rule at all. The tree matched only the README — the one source that never enumerated the files.

Nothing implemented any of it. All five files were tracked, each landed under a GitHub Desktop default message (Update findings.yaml, Create feedback.yaml), March 24-25. The classification was decided by whatever was dirty in the GUI. .gyre/cache/ had carried a Gitignore row in the PRD since March and no rule anywhere, so it would have been committed the first time Gyre created it; .gyre/.lock would have been cloned into every fresh checkout, where full-analysis/steps/step-01-initialize.md:39-42 warns on any lock older than five minutes.

And a second team was already proposing to squat. gyre-note-hc-forge-gyre-handoff.md:228,230 has Forge writing findings to .gyre/knowledge-gaps/ and a queue to .gyre/forge-queue.yaml, and forge-epic-phase-a.md:245 carries it as an acceptance criterion. Forge would have inherited an unruled directory belonging to another team.

How to apply.

  • Adding state to a team. Create .<team>/, and in the same change add its .gitignore rules. The rules are part of the feature, not follow-up work — this rule exists because they were treated as follow-up work and never arrived.
  • Deciding a file's treatment. Commit what a human or a future run reads; ignore what only the current run writes. For Gyre that resolves to committed iff it is a declared GC contract artifact (GC1-GC4), with history.yaml, cache/ and .lock ignored. Name your team's equivalent boundary explicitly rather than deciding file by file.
  • Never write into another team's state directory. A handoff between teams goes through a declared contract artifact in the producing team's directory, which the consumer reads. Forge does not write to .gyre/; it reads GC3 and writes its own.
  • Verify the rule in both directions. git check-ignore --no-index <path> for each file that must be ignored and each that must not — an over-matching pattern silently untracks the artifacts the team depends on. Use --no-index: without it, git check-ignore consults the index and reports an already-tracked file as not-ignored, which measures tracked-ness rather than the pattern and reads as a broken rule. This bit during the 2026-09-12 pass that wrote this rule.
  • Untracking an already-committed state file needs git rm --cached <path>; adding the .gitignore rule alone changes nothing, because ignore rules do not apply to tracked files. GitHub Desktop cannot do this — the agent runs it and says so in the commit plan per commit-preparation.
  • Reviewing a PR. If a diff adds a state directory, or a file inside one, with no corresponding .gitignore change and no statement that the file is meant to be committed, block and cite this rule.

Scope. output_folder contents are documents, not state, and are governed by artifact taxonomy rather than by this rule. This rule covers only machine-read state a team writes and reads back.

No state, no directory — and "state" is narrower than "reads its own output". The condition in the Statement binds in both directions: a team that keeps no state gets no .<team>/ at all, and symmetry with a team that does is not a reason to create one. An empty state directory is worse than no directory, because it is an unowned namespace at the project root and nothing in the tree says who may write to it — the same condition that let Forge propose writing into .gyre/, but without even a state model to justify the directory's existence.

The test is whether a workflow branches on a project-root state file. Gyre passes it explicitly: full-analysis/steps/step-01-initialize.md:34 routes to Anticipation mode and skips model generation when .gyre/capabilities.yaml exists. That is machine-read state deciding control flow, and it is what makes a team stateful for this rule's purposes.

Vortex is the worked example, and it is the one that carries a trap. .vortex/ was considered and declined on 2026-09-12, alongside the 1c9aff30 pass that produced this rule. Vortex does re-read its own prior output, and that does not make it stateful under this rule — pivot-resynthesis revises an existing HC2 rather than creating one (workflow.md:19, step-03-jtbd-reframing.md:21 "Start from your existing JTBD (from the original HC2...)"), and HC6 routes Max's pivot decision to Mila carrying Isla's original artifacts (compass-routing-reference.md:114). All of that flows through documents in output_folder, which the Scope paragraph above excludes. Anyone who reads pivot-resynthesis as evidence that Vortex is stateful will award it a .vortex/ this rule does not grant — that reading is why the distinction is spelled out here rather than left to the Statement.

Re-derive rather than trust the paragraph: grep -rnE '\.vortex/|\.gyre/|\{project-root\}/\.' _bmad/bme/_vortex returns nothing, and the same pattern against _bmad/bme/_gyre matches — so the empty result measures Vortex rather than a broken pattern, per verification-must-be-falsifiable. Should a Vortex workflow ever branch on a project-root file, it earns .vortex/ under the Statement and the How-to-apply bullets, with no amendment needed here.

This paragraph exists because the rule first shipped stating only the positive condition and naming no stateless team (git show 1c9aff30:project-context.md — the rule as shipped contains no occurrence of either Vortex or stateless), and the question "why .gyre/ and no .vortex/" was re-asked within a day with the opposite answer recalled. A convention that has to be inferred gets re-litigated; one that names its declined case and the near-miss reading does not.

Not yet generalized. There is exactly one stateful team. This rule states the convention so the second one inherits it, but the .<team>/ shape has an N of 1 and no ADR ratifies it — deliberately, per meta-model ADR-001's _team-factory ruling: "Rule what Loom is first; the directory name is downstream of that." Rule what Forge's state is before ruling where every team's state lives. If Forge adopts this unchanged, that is the two-instance evidence an ADR would ratify.


Rule: generic-agents-specific-knowledge

Statement. Teams, agents, skills and workflows stay as generic as possible. Domain specificity is carried by curated knowledge that agents read — never by specialising the agent itself. This applies to what Convoke authors under _bmad/bme/, and to what Convoke advises operators to do with their install.

Operational check. Before writing a line into an agent, skill or workflow file, ask: is this true of the work, or only of one domain, one client, one stack? If it is only true of one, it belongs in a knowledge artifact the agent reads at run time. The test is substitution — if replacing the domain would require editing the agent, the domain is in the wrong place.

The knowledge layer is meant to grow through a deliberate progression, and starting at the far end is its own failure: markdown files → wiki → RAG → graph. Begin with files. Move up only when the corpus makes the previous form the bottleneck.

Why. Maintenance economics, and they are the reason Convoke is built on top of BMAD rather than beside it. A generic agent is maintained by the commons — upstream BMAD, open-source contributors, other adopters. A specialised agent is maintained by whoever specialised it, forever, alone. Shared maintenance requires shared artifacts; the moment an agent carries your domain, it stops being shareable and the bill comes to you. Every argument for living inside someone else's ecosystem collapses if the things living there are bespoke.

Field evidence, 2026-09-19/20 (five client organisations, five roles):

  • A CTO, unprompted: "when adopting BMAD and Convoke, we start customizing agents and skills." Immediately, on landing. That is the failure mode this rule exists to prevent, and it is what adopters currently do by default because nothing tells them otherwise.
  • The same corpus named knowledge engineering as the capability they most lack at scale — which is this rule's other half. Genericity without a knowledge layer produces a well-mannered stranger.
  • An engineering lead asked for the loop to run both ways: agents that report which architectural approach and patterns they applied, and why. Knowledge flows into a generic agent; it should be able to flow back out.

How to apply.

  • Authoring an agent, skill or workflow. Keep it domain-neutral. A client name, a sector term, a stack-specific rule or a house convention inside an agent file is a defect, not a feature.
  • Adding domain capability. Put it in knowledge — a markdown artifact first — and have the agent read it. Inventory it, curate it, and expose it; knowledge nothing can find is knowledge you do not have.
  • Advising an operator. Tell them to customise the knowledge, not the agent. Behaviour overrides belong in _bmad/custom/; domain belongs in artifacts. Any page that teaches customisation must carry this distinction, or it teaches the acquisition of maintenance debt with excellent citations.
  • Reviewing a PR. If a diff puts domain-specific content inside an agent, skill or workflow file, block and cite this rule.

Exception. Functional specialisation is not domain specialisation. Vortex is discovery-shaped, Gyre is readiness-shaped, TEA is test-shaped — that is what a team is, and it stays generic across every domain that does discovery, readiness or testing. The rule forbids binding an agent to a customer, a sector or a codebase, not to a craft.

Not enforced. Nothing mechanical distinguishes generic content from domain content today, and until something does, this rule is a declaration — the same class of gap this file documents elsewhere. It was also, until 2026-09-20, unwritten: it existed only in the operator's head and in advice given verbally in workshops, which is why adopters who never attended one do the opposite on day one.


Rule: file-stale-knowledge-when-you-find-it

Statement. When you find evidence that a sentence in a committed document is false, stale or misleading, and fixing it is not your current task, file it in _bmad-output/planning-artifacts/convoke-note-pieces-of-knowledge-to-review.md with enough context that someone else can investigate without repeating your work. Do not fix it in passing, and do not carry it only in a conversation.

Why. Stale prose here is load-bearing and it misleads silently. The maturity ledger told a leadership audience "Convoke is not listed" while a Convoke agent had been publicly listed for three months, and ci.yml:228-230 justifies a check's scope by citing .gitignore:62 — a comment line, whose operative neighbours un-ignore the path the comment calls ignored. Both were found incidentally, by someone whose task was something else. A finding that lives only in a chat window is lost at the end of the session, and a drive-by edit to a document you have not investigated is how a correct sentence gets replaced with a confident wrong one.

How to apply.

  • One entry per sentence. Where it is, what it says, what contradicts it, and the command that shows the contradiction. An entry without a reproducing command is a suspicion — file it and say so in the Basis line rather than dressing it as fact.
  • State your basis honestly. verified means you ran the command. If the count came from a reviewer, a subagent or another document, say whose it is and that it is unchecked.
  • Forward-dated rot is filable. A sentence that is true today and will be false when a named story lands belongs in the queue, attributed to that story.
  • Resolving is a move, not a delete. Edit the source, then strike the row and record the outcome and the commit. An entry that turns out to be wrong is struck the same way — the finder can be mistaken, and that is worth keeping.
  • Your own memory is in scope. The first thing this rule caught was an assistant memory asserting that docs/testing.md still carried stale coverage figures; the file had already been corrected to refuse stating totals at all.

Rule: derive-before-you-write

Statement. In an authored artifact — a story, epic, ADR, PRD, note or review — every figure, command, file reference and cross-artifact attribution is produced by running something before the sentence containing it is written. Writing first and verifying afterwards is forbidden, because the verification pass reliably misses what the writing pass invented.

Why. derive-counts-from-source and documentation-claims-must-be-derived already bind documents about the project, and they did not reach authored artifacts — measured on 2026-09-27, when three consecutive stories each shipped wrong figures that a single command would have caught. The failures were not carelessness but a pattern: an inference and a measurement read identically once they are prose, so nothing in the finished document distinguishes them.

Concrete instances from that day, each cheap to have prevented:

  • node scripts/audit/agent-surface-parity.js was named as a gate in two stories. It takes two git refs and exits 1 with a usage error. Nobody ran it.
  • A story claimed refs:audit covered the paths it was fixing. Scoped to those files it reports 0 references checked — it space-fills inline code spans and every path there is backticked.
  • "git log --grep=T214 confirms it touched only Team Factory files." The quoted output contained the contradicting filename. The command ran; the output was read for confirmation.
  • An export blocker was derived by calling a transformation function on a hand-written line rather than running the exporter. A real export showed the line was already absent, so the blocker did not exist — and an operator ruling had already been requested on it.

How to apply.

  • Every figure carries its command, inline, in the artifact. If the command is too long to include, the figure is too fragile to state.
  • Never cite a document for a fact about code. Cite the code. A document is evidence of what someone believed when they wrote it.
  • Do negative checks by machine. "Is there anything here that is not X?" is grep -v, a count or a set difference — never a human reading a list. Confirmation-scanning long output is where this fails.
  • Run every command you name, in the form you name it, from the directory a reader would use.
  • Mark what you could not verify with a visible [UNVERIFIED] and leave it ugly. A smoothed unknown is indistinguishable from a checked fact, which is the whole defect.
  • Verify against the basis the claim is about. A function call is not a pipeline run; a local generated directory is not the current pipeline; a backlog row is not the row's summary in an epic.

The mechanism clause — added 2026-09-27 after six instances of one mistake. The rule above catches figures, because it was written about numbers and commands. It did not catch designs, and every draft rescued in that session failed the same way: a mechanism was prescribed without reading the mechanism.

  • the hub was designed as a generated standalone: true wrapper without reading how wrappers are delivered — they load {project-root} paths that are absent by definition in the case the hub exists for, and gitignored wrappers can never be a marketplace.json path;
  • refs:audit was cited as covering 22 paths without reading it — it space-fills inline code spans and reports 0 references checked over those files;
  • agent-surface-parity.js was cited as catching a broken activation block without reading it — its check is /config\.yaml|load.{0,20}config/i, a presence regex that passes the defect and the fix alike;
  • resolve_config.py was prescribed without reading _bmad/bme/config.yaml, the file the instruction it replaced actually loaded — so the design was more machinery and less coverage;
  • uv run was prescribed without grepping for whether the repo forbids it — Convoke ships zero .py and no _bmad/bme/ skill invokes Python, and the absorption architecture records that pair as what made upstream's churn inert;
  • grep -rc was written as a falsifier without running it — it exits 0 whether or not the string is present, so the AC read satisfied while the defect was live.

So, before prescribing a mechanism, open it:

  • Naming a script? Read it, and run it in the form you are naming.
  • Claiming a gate covers something? Read the assertion. A presence regex is not coverage, and "it passed" is not evidence of detection — feedback_verification_basis: "ran it" ≠ "it detects failure".
  • Replacing a call? Read what the call actually loaded. The file you assume is not the file it read.
  • Adding a dependency or a language? Grep for a prohibition before adding it. Prohibitions here are usually written in an architecture document and enforced nowhere.
  • Writing a story? Grep the backlog for the defect first. cir-1-2 duplicated T183, which had been filed ten days earlier, named the same three agents and was already cited by two epics.

Rule: commit-plans-assume-no-amend-window

Statement. A commit plan never instructs an amend. The operator commits and pushes in one motion through GitHub Desktop, so the window between the two does not exist. Work that can only be computed after a commit lands is a second commit with its content pre-computed, not an amendment to the first.

Why. tfu-1-1's AC#14 required the wrapper baseline to be regenerated from the committed generator — agent-surface-parity's extractor reads git show <ref>:<generator>, so it genuinely cannot see an uncommitted tree. The AC therefore said "commit the generator change, then regenerate and amend". The operator committed and pushed. agent-surface-parity is in publish.needs, so main sat red behind a release gate until a follow-up commit landed. The instruction was not wrong about the mechanism; it was unfollowable by the person executing it.

How to apply.

  • When a value can only be derived post-commit, emit two commits in the plan. State the exact command for the second and its expected output, so it can run immediately without re-deriving anything.
  • Say out loud that the gate will be red between them, and name the gate. An operator who sees red CI and was not warned reasonably assumes something broke.
  • --amend and force-push over published history are never in a plan. If a plan needs one, the plan is wrong.

Falsification. If two consecutive plans that prescribe an amend are executed without a red interval, relax this.


Rule: all-green-means-every-step-from-the-committed-state

Statement. "The gates pass" is a claim about every step CI runs, evaluated at the committed state. A sweep of a self-chosen subset, or of a working tree holding uncommitted fixes, is not that claim and must not be reported as it.

Operational check. Two things, both cheap. Enumerate the steps from the workflow file rather than from memory — grep -nE '^\s+- name:|^\s+run: (npm|node|bash|python)' .github/workflows/ci.yml — and run git status --porcelain first. A non-empty tree means you are reporting on something CI will not see.

Why. In tfu-1-1 I reported "all green" having run six of roughly fifteen steps, against a tree holding the uncommitted fix for the one gate that was failing. The operator found main red and had to say so. The subset omitted test:coverage, validate-marketplace, coverage-denominator, the manifest-vs-registry diff, npm audit, npm pack and node index.js — none of which I had a reason to exclude beyond not having listed them.

How to apply.

  • Name which steps you ran. "All gates green" with no enumeration is the phrasing this rule exists to catch.
  • Where a step cannot run locally, say so and say why. tfu-1-1's python-test was untouched because the commit contained zero .py files — that is a statement with evidence, not an omission.
  • A green sweep bounds regression, not correctness. Twelve gates were green before tfu-1-1's consumer audit and after it, and the audit found a vacuous assertion, three rotted citations and a load-bearing denominator wrong in six places. None of that is gated. Do not let a sweep stand in for a review.

Rule: freeze-the-tree-before-an-audit

Statement. Before dispatching a review or audit that reads the working tree, either stop editing it or tell the auditor it is moving. An audit against a tree that changes underneath it can report a finding that is already fixed, miss one that appears after it looked, and cannot be re-derived afterwards.

Why. tfu-1-1's consumer audit was told "the tree is clean and pushed." It was not: fourteen files were edited underneath it while it worked, and it correctly said so in its own report rather than trusting the brief. It changed nothing — but a less careful agent, or one with write access and a mutation harness, is the feedback_never_git_stash hazard with a second actor in it.

How to apply.

  • Commit or hold. A clean tree is the cheapest way to make an audit reproducible.
  • If you must keep working, say which paths are in flight and tell the auditor to report against HEAD.
  • Every review subagent is read-only and told so in absolute terms, including no scratch files inside the repo. That rule already exists for mutation harnesses; this extends it to the tree's stability.
  • An audit's own statement that the tree moved is a finding about the process, not noise. Record it.

Rule: closing-a-row-greps-for-its-own-citations

Statement. Closing a backlog row is not finished until you have searched for prose that cites it. A sentence written as "X is true until TNNN lands" becomes false the moment TNNN closes, and nothing in this repository detects that.

Why — and the instance is the previous retrospective's own action item. tfr-epic-1-2's retro (commit 0e1f2ed2) had action 3 "file the unshipping as ONE row" — which became T179 — and action 4 "correct docs/development.md to describe the factory as internal for now". Action 4 wrote:

"It still installs (it is in package.json files[] and both manifests), and withdrawing that is filed as T179; until then, treat it as internal."

True when written. T179 closed in tfu-1-1, at which point all three clauses were false. The sentence survived an edit four lines above it in the same section and was caught only by a blind prose auditor two weeks later. Re-derive the pair with git log --oneline -S "withdrawing that is filed as \T179`" -- docs/development.md`, which returns the commit that wrote it and the commit that removed it.

How to apply.

  • In the same edit that closes a row: git grep -n '<ID>' and read every hit. Code and prose, not just the backlog.
  • file-stale-knowledge-when-you-find-it already makes forward-dated rot filable when you notice it. This is the other direction and the cheaper one: the row's own closing is the moment you know.
  • A retrospective action item that writes a forward-dated claim must name the row that expires it, and that row's Description must name the sentence. One of the two will be read; neither alone was.

Not enforced. Nothing can see this. reference-integrity.js validates paths and heading anchors and cannot know whether a sentence is still true — see T230 for why even the line numbers are unguarded.


Rule: search-the-shipped-set-not-the-tree

Statement. When a change alters what an operator receives, the search key is package.json files[] — or better, the actual tarball — not a grep over the working tree. A grep finds hits; it cannot tell you which of them reach a user.

Operational check.

npm pack --dry-run --json | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{
  console.log(JSON.parse(s)[0].files.map(f=>f.path).join('\n'))})"

files[] is a declaration; the tarball is the fact. Note that package-check in CI runs only npm pack --dry-run — scripts/audit/try-fresh-install.sh is the only gate that packs a tarball and installs it.

Why. tfu-1-1 un-shipped a module and then, reviewing its own prose by grep, fixed one copy of a duplicated sentence and shipped the other: 12 agents was corrected in docs/host-framework-sync-playbook.md, which is not in files[], and left standing in docs/migration/3.x-to-4.0.md, which is. The same shape recurred in CREDITS.md, which ships and listed the withdrawn agent under its own lede "These ship with Convoke. They are the ones you get.", and in _bmad/bme/covenant/compliance-checklist.md, a shipped normative file whose worked examples all named the withdrawn module. Three shipped prose files were never opened, because grep ranked hits by count rather than by reach.

How to apply.

  • Enumerate the shipped set first, then intersect it with your grep. The shipped subset is reviewed first and most carefully, because it is the only part an operator can be misled by.
  • A file being in the repository says nothing about whether it ships. CREDITS.md, UPDATE-GUIDE.md, docs/migration/ and _bmad/bme/covenant/ all ship and are all easy to forget.
  • The same asymmetry runs the other way: a claim about the source tree, the test suite or contributor workflow stays true after an unship, and "fixing" it makes a correct document wrong. docs/testing.md's npm test line and package.json's test globs were correctly left alone for exactly this reason.