qfai 1.9.2 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +67 -6
  2. package/assets/init/.qfai/assistant/README.md +27 -0
  3. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +1 -0
  4. package/assets/init/.qfai/assistant/agents/backend-engineer.md +1 -0
  5. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +29 -2
  6. package/assets/init/.qfai/assistant/agents/delivery-planner.md +17 -0
  7. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +1 -0
  8. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +17 -0
  9. package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
  10. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +183 -5
  11. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +22 -3
  12. package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +2 -2
  13. package/assets/init/.qfai/assistant/catalog/spec_required_files.json +2 -1
  14. package/assets/init/.qfai/assistant/catalog/test-layers-ci-lanes.md +60 -0
  15. package/assets/init/.qfai/assistant/catalog/test-layers.md +430 -13
  16. package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +165 -0
  17. package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
  18. package/assets/init/.qfai/assistant/constitution/constitution.md +1 -1
  19. package/assets/init/.qfai/assistant/constitution/drift-protocol.md +359 -10
  20. package/assets/init/.qfai/assistant/constitution/quality.md +35 -5
  21. package/assets/init/.qfai/assistant/constitution/requirements-decomposition.md +37 -0
  22. package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +419 -8
  23. package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +122 -5
  24. package/assets/init/.qfai/assistant/constitution/workflow.md +53 -7
  25. package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +439 -946
  26. package/assets/init/.qfai/assistant/manifest/agent-routing.yml +116 -4
  27. package/assets/init/.qfai/assistant/manifest/review-profiles.yml +9 -0
  28. package/assets/init/.qfai/assistant/process/migrations/v1.4.27-atdd-alignment.md +1 -1
  29. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +150 -53
  30. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/credential-reuse.md +146 -0
  31. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/red-provenance.md +456 -0
  32. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/review-fix-rounds.md +128 -0
  33. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/scaffolding.md +29 -0
  34. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/shared-test-artifacts.md +96 -0
  35. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/stale-manifest.md +34 -0
  36. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +52 -5
  37. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +16 -8
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +8 -4
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +2 -2
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +17 -7
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +10 -4
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +5 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +4 -4
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +1 -1
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +17 -7
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +1 -1
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
  49. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +11 -3
  50. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +5 -2
  51. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
  52. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +7 -4
  53. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
  54. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
  55. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
  56. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +14 -7
  57. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
  58. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +16 -7
  59. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +9 -6
  60. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +2 -0
  61. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +3 -2
  62. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -2
  63. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +252 -130
  64. package/assets/init/.qfai/assistant/skills/qfai-implement/references/change-request-reset.md +93 -0
  65. package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +210 -0
  66. package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +73 -0
  67. package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +291 -0
  68. package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +389 -0
  69. package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +28 -0
  70. package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +49 -0
  71. package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -0
  72. package/assets/init/.qfai/assistant/skills/qfai-implement/references/oracle-strength.md +81 -0
  73. package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +235 -0
  74. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-admissibility.md +91 -0
  75. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +112 -0
  76. package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +87 -0
  77. package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +44 -0
  78. package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +118 -0
  79. package/assets/init/.qfai/assistant/skills/qfai-implement/references/selector-granularity.md +24 -0
  80. package/assets/init/.qfai/assistant/skills/qfai-implement/references/upstream-artifact-ordering.md +33 -0
  81. package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +149 -0
  82. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +35 -18
  83. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +1 -1
  84. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +106 -7
  85. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +40 -11
  86. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +48 -1
  87. package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample +6 -0
  88. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +87 -22
  89. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +148 -0
  90. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +10 -4
  91. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +5 -1
  92. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +4 -2
  93. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +18 -0
  94. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +44 -3
  95. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +60 -7
  96. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +171 -6
  97. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +125 -0
  98. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/db-contract.sample.sql +6 -0
  99. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +92 -0
  100. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/01_Objective.md +27 -0
  101. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/02_Initiative.md +30 -0
  102. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +16 -6
  103. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/06_Glossary.md +19 -0
  104. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/07_Constraints.md +25 -0
  105. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/08_Decisions.md +22 -2
  106. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +37 -10
  107. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +20 -0
  108. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/03_Acceptance-Criteria.md +19 -0
  109. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/04_Business-Rules.md +32 -3
  110. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +56 -0
  111. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/07_Decisions.md +29 -2
  112. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/10_Plan.md +41 -0
  113. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/16_Traceability-ledger.md +58 -0
  114. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +56 -0
  115. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +57 -102
  116. package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +24 -0
  117. package/assets/init/.qfai/assistant/skills/qfai-verify/references/context-load.md +22 -0
  118. package/assets/init/.qfai/assistant/skills/qfai-verify/references/verify-output-contract.md +48 -0
  119. package/assets/init/.qfai/assistant/skills/qfai-verify/templates/verify-evidence.md +48 -0
  120. package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +25 -7
  121. package/assets/init/.qfai/waivers.yml +11 -5
  122. package/assets/init/root/.github/workflows/qfai-tests.yml +318 -0
  123. package/assets/init/root/.github/workflows/qfai-validate.yml +327 -24
  124. package/assets/init/root/DESIGN.md +6 -0
  125. package/assets/init/root/qfai.config.yaml +15 -12
  126. package/dist/cli/index.cjs +20646 -13620
  127. package/dist/cli/index.cjs.map +1 -1
  128. package/dist/cli/index.mjs +22101 -15061
  129. package/dist/cli/index.mjs.map +1 -1
  130. package/dist/index.cjs +13954 -8829
  131. package/dist/index.cjs.map +1 -1
  132. package/dist/index.d.cts +423 -14
  133. package/dist/index.d.ts +423 -14
  134. package/dist/index.mjs +9330 -4224
  135. package/dist/index.mjs.map +1 -1
  136. package/package.json +22 -19
@@ -0,0 +1,291 @@
1
+ # Evidence revision (what state the observation describes)
2
+
3
+ Four of the twelve gate items — 3, 5, 7 and 8 — are sub-agent observations, and
4
+ `#evidence-hard-rules` says stale evidence MUST NOT be reused. That rule needs
5
+ something to compare against. This file defines it.
6
+
7
+ ## The field
8
+
9
+ Every observation records the revision it was made against.
10
+
11
+ ```
12
+ Revision: <git rev> | working-tree+<content hash>
13
+ ```
14
+
15
+ - **`<git rev>`** — the output of `git rev-parse HEAD` at the moment of the
16
+ observation. Preferred: it is exact and someone else can reproduce from it.
17
+ - **`working-tree+<content hash>`** — for an uncommitted tree. Not as good as
18
+ a rev, and honest about not being as good: it says "this observation was made
19
+ against a state that was never committed".
20
+
21
+ **The procedure, exactly.** "A hash over HEAD, the diff and the untracked
22
+ files" is not one value: producer and reviewer can each pick a defensible
23
+ separator, diff option or record shape and get different answers for the same
24
+ tree, and then an ordinary uncommitted item is stale for nobody's mistake.
25
+ Four steps, the same shape as `Audited evidence hash`:
26
+ 1. **Collect.** `git rev-parse HEAD`; the tracked diff from
27
+ `git diff HEAD --no-color --no-ext-diff --binary --` followed by the
28
+ exclusions below; and every untracked file
29
+ `git ls-files --others --exclude-standard` reports, after the same
30
+ exclusions.
31
+ 2. **Exclude.** `.qfai/specs/*/tdd/test-list.md`, `.qfai/evidence/**` and
32
+ `.qfai/review/**`, from **both** the diff and the untracked list — they are
33
+ the record of the observation, not the thing observed. The review pack is
34
+ on that list for the same reason the others are: a project may legitimately
35
+ track `.qfai/review/**`, and then every reviewer answer written into it
36
+ moved the address the previous reviewer had just recorded, so items 7-8
37
+ could not agree on one revision and a correct item never reached `done`.
38
+ What protects the pack is a **pack seal**, not the audit hash: that one
39
+ addresses the evidence a reviewer _read_, and the pack is what it _wrote_.
40
+ When the last reviewer of a round has stored its response, record the seal
41
+ in the item's evidence entry as `Review pack seal` — by the **audit-hash**
42
+ procedure in
43
+ `../../../constitution/shared-skill-delegation-baseline.md#reviewer-response-template`,
44
+ not the working-tree one below: its step 2 normalization (LF, trailing
45
+ whitespace, leading and trailing blank lines, one final newline), its
46
+ `path + NUL + SHA-256` record sorted by path, its final hash over the
47
+ joined records. The subject is every file in that `review-<timestamp>/`
48
+ directory, each under its repo-relative path. "The procedure below" was
49
+ ambiguous between the two, and the two produce different values. It is
50
+ recorded **outside** the pack, so nothing in the pack hashes itself, and
51
+ **gate item 10 recomputes it from the pack** and compares — that is the
52
+ check, and without it the field was a value nobody read. It is **not** in
53
+ any reviewer's audit subject: the seal is written after the last reviewer
54
+ has hashed, so putting it there would make that verdict stale on being
55
+ recorded. Editing `Result`, `Reviewed revision` or `overall_status`
56
+ afterwards therefore moves the recomputation rather than the stored value,
57
+ which is what a seal is for. Excluding the pack from the revision without this left an
58
+ edited PASS reading as fresh.
59
+
60
+ **Record it per round, and name the pack it seals**: `Round N: Review pack`
61
+ (the `review-<timestamp>/` directory) and `Round N: Review pack seal`
62
+ beside it. A spec has several packs and a blocking REVISE opens more, so a
63
+ bare hash left the gate unable to say which directory to recompute over —
64
+ it either checked another round's pack or stopped a correct item.
65
+
66
+ **What a seal does and does not catch — say it once, plainly.** It is
67
+ recorded at one moment and recomputed at another, and it catches every
68
+ change between them: a pack edited after the round closed, a checkpoint
69
+ result edited after a row reached `done`, a stage evidence file edited
70
+ after the verdict. That is drift, and drift is what actually happens.
71
+
72
+ It does **not** catch an author who rewrites the sealed artifact and the
73
+ seal together in one consistent pass. Nothing recorded in the repository
74
+ can: the expected value has to live somewhere, and wherever that is, the
75
+ same hand can update it. Three successive homes were tried and each fell to
76
+ the same move — beside the artifact, in a commit, in the newest commit that
77
+ introduces the line — and a fourth would fall too. **Committing the seal is
78
+ not the answer either**, and not available: stage evidence is regenerable
79
+ and deliberately not committed (`.qfai/evidence/*` is ignored, with only
80
+ the governance records negated back in), so a rule requiring a committed
81
+ copy of `implement-<spec-id>.md` would have stopped every completion.
82
+
83
+ A consistent rewrite is caught where consistent rewrites are caught: by
84
+ review of the change itself, against a history the seals make legible.
85
+ Recording it is what makes an inconsistent one impossible to miss; do not
86
+ read it as more than that, and do not add a fourth mechanism.
87
+
88
+ 3. **Serialize.** `HEAD` + NUL + the rev; then `DIFF` + NUL + the SHA-256 of
89
+ the diff bytes; then one record per untracked file,
90
+ `path + NUL + kind + NUL + mode + NUL + the SHA-256 of its bytes`, sorted
91
+ by path in byte order. `kind` is `file` / `symlink` / `dir` and `mode` is
92
+ the octal permission bits. **On a `symlink` the bytes are the link's own
93
+ payload** — what `readlink` returns — never the target's contents: the two
94
+ are both defensible readings, so producer and reviewer could compute
95
+ different addresses for one tree, and a dangling link has no second reading
96
+ at all. On a `dir` the hash is over the empty string; the entries under it
97
+ are records of their own. The point of `mode`: a tracked diff carries a mode change, and
98
+ without these an uncommitted `chmod +x` on a new script left the address
99
+ unmoved — same bytes, different behaviour under test, CI and packaging,
100
+ with a reviewer PASS taken before it still reading as fresh.
101
+ Join the records with
102
+ `\n`. Path, boundary and order are all in it on purpose: contents alone
103
+ collide — renaming a file, or swapping the contents of two, leaves the hash
104
+ unchanged.
105
+ 4. **Hash.** SHA-256 of that string; record the hex digest.
106
+
107
+ An empty diff and an empty untracked list still contribute their records, so
108
+ "clean but uncommitted" has a value rather than a special case.
109
+
110
+ **The ledger is excluded from it.** Phase Green step 3 writes `green` and
111
+ Refactor step 3 writes `refactor` into `test-list.md` between the
112
+ observations, and gate item 10 requires the GREEN and the two reviews to name
113
+ the **same** revision — so a hash over the whole of `git diff HEAD` moved on
114
+ its own bookkeeping and no uncommitted item could reach `done`. Compute it
115
+ over the tree **minus `.qfai/specs/*/tdd/test-list.md` and `.qfai/evidence/**`\*\*:
116
+ those are the record of the observation, not the thing observed. Everything the
117
+ observation is about — production code, tests, fixtures — stays in.
118
+
119
+ **What that exclusion costs, and the address that pays it back.** Leaving
120
+ `.qfai/evidence/**` out keeps the revision stable across the phase's own
121
+ writes, but it also puts the RED/GREEN output the reviewers audit — and the
122
+ committed `.qfai/evidence/coverage-depth-<spec-id>.md` whose per-`❌`
123
+ justifications they accept — outside every address the gate checks: edited
124
+ after a PASS they leave `Reviewed revision` unchanged, and gate item 10 reads
125
+ the old verdict as fresh. Each reviewer therefore records an **`Audited
126
+ evidence hash`** beside its `Reviewed revision`. **What it covers is the
127
+ named subject for that observation** — RED, GREEN or completion review —
128
+ defined once in
129
+ `../../../constitution/shared-skill-delegation-baseline.md#reviewer-response-template`.
130
+ Do not restate it here and do not derive it by subtraction: an entry that goes
131
+ on growing means "the section minus what is written later" is a different
132
+ value for every reader, and each observation is judged against the fields that
133
+ existed when it was taken. Gate item 10 recomputes each verdict against its
134
+ own subject; a mismatch means the audited evidence moved after the verdict,
135
+ and the verdict is not fresh.
136
+
137
+ **A `git status --porcelain` digest is not sufficient**, which is what this
138
+ field used to specify. Porcelain names the changed paths and their states, so
139
+ editing the very file under test after the RED leaves it identical and a stale
140
+ observation passes the freshness check this field exists for — and a new
141
+ acceptance test, the ordinary case, is untracked, so its content has to be in
142
+ the hash explicitly. `git stash create` does not do it either: it has no
143
+ `-u`, and the tree it builds omits untracked files.
144
+
145
+ It appears in three places, all carrying the same address:
146
+
147
+ 1. **Reviewer responses** — as `Reviewed revision`, per
148
+ `../../../constitution/shared-skill-delegation-baseline.md#reviewer-response-template`.
149
+ 2. **The per-item evidence contract** — one `Revision` per round block, beside
150
+ the RED / GREEN commands and results, and one for the refactor-verify pair.
151
+ 3. **The review pack** — `summary.json`'s `revision` field, which is what makes
152
+ the fact machine-checkable (`QFAI-REVIEW-009`). Write
153
+ `"revision_form": "content-hash"` beside it — **required**, not optional.
154
+ That marker is how a pack says which contract produced it. Neither the pack's
155
+ age nor its rank among siblings can stand in for it: a directory stamp
156
+ carries no timezone, and "the newest pack" stops being the current one the
157
+ moment another spec produces its own. Nor can the marker be optional — a
158
+ producer that omitted it would downgrade its own check to a warning, which
159
+ makes the strict form opt-in and lets a stale verdict through
160
+ `--fail-on error`.
161
+
162
+ **A pack written before the form says `"revision_form": "legacy"` _and is
163
+ listed in `.qfai/review/.legacy-packs`_, and only that excuses a malformed
164
+ `revision`** (reported as a warning instead of an
165
+ error): the tree its verdict described is not reconstructible, so there is no
166
+ content hash to migrate to. Write those markers **once, from the history** —
167
+ `npx qfai doctor --autoremediate` does it: it records every pack already on
168
+ disk that does not declare the form, additively and idempotently, so a repeat
169
+ run is a no-op and a pack that forgets its marker _afterwards_ is not
170
+ excused. The pack's own word is not enough on its
171
+ own: it is exactly as writable as the `revision` it excuses, so a current
172
+ producer with a broken value could downgrade its own finding by typing
173
+ `legacy`. The manifest is one file a reviewer reads whole, and adding a pack
174
+ to it later is a visible change to a migration record. Until that pass has run those packs are reported rather than
175
+ accepted, which is the safe direction, and running it is what clears them.
176
+
177
+ ## A transient observation names its own revision
178
+
179
+ **Every RED is one.** A RED is observed before the code that makes it pass
180
+ exists — that is what a RED _is_ — so on an uncommitted tree Phase Green's write
181
+ moves the content address by construction, and requiring item 3 to name the same
182
+ `Revision` as items 5, 7 and 8 made an ordinary `Unit` / `Component` /
183
+ `Integration` cycle stale the moment it went green. Framing the exemption as
184
+ two special cases was reading the handed-over RED and the falsifiability
185
+ mutation as exceptions to a rule they are instances of. **Item 3 records
186
+ `RED revision` on every row**; a `falsifiability` row records
187
+ `Falsifiability revision` in its place, because its observation is the mutation
188
+ run and that tree is reverted before the GREEN. Both are exempt from the
189
+ same-revision rule, because the property that makes them worth having is that
190
+ they were taken somewhere else — a mutation run against the final tree would
191
+ prove nothing, since the mutation is not in it. The remaining observations still
192
+ agree with each other.
193
+
194
+ ## Why an address, not a timestamp
195
+
196
+ A timestamp orders observations; it does not identify what was observed. Two
197
+ runs a second apart against different trees have different meanings and nearly
198
+ identical timestamps. The revision is the only thing that survives the question
199
+ "which code did this verdict actually rule on?".
200
+
201
+ Reviewers and `qa-gatekeeper` are dispatched against the **integrated** tree by
202
+ design — `../../../constitution/workflow.md`'s worktree-separation rule constrains
203
+ implementers, not reviewers — so the tree a reviewer reads is legitimately
204
+ allowed to move under it. A fully independent reviewer reading a tree that is
205
+ being edited mid-review produces a verdict that is honest, independent and
206
+ unattributable. That is the failure this field exists for, and it is not fixed
207
+ by choosing a better reviewer.
208
+
209
+ ## Blobs are derived — cite the revision, not the hash
210
+
211
+ A blob hash is **derived state**: `git rev-parse <rev>:<path>` determines it from the revision the
212
+ observation already names. Writing it into prose beside the revision duplicates information the
213
+ revision fixes, and a duplicate can diverge from its source.
214
+
215
+ **Do not enumerate blob hashes in per-item prose.** Record the `Revision`; where a specific file's
216
+ state matters, name the file and let the revision determine it — the reader runs
217
+ `git rev-parse <rev>:<path>`.
218
+
219
+ Why this is not fussiness. When several items share a test file or a production module — which is
220
+ normal, because one `TC-*` split across items lands in one file — every commit touching that file
221
+ changes the blob for **every item that cites it**, including items the commit has nothing to do with.
222
+ So a written blob goes stale for reasons belonging to a sibling; an item's own landing commit re-stales
223
+ its siblings' citations; and a repair to one item's record re-stales the others'. The count of stale
224
+ citations then grows with the number of commits rather than with the number of real defects, and each
225
+ repair writes more claims of the same kind. A revision has none of that behaviour: it is an address,
226
+ and addresses do not drift.
227
+
228
+ **The one exception, because no revision determines it: a _mutant_ blob.** A mutation is written to the
229
+ working tree and never committed, so there is no object to derive. Record a mutant as **base revision +
230
+ literal needle text + literal replacement text** — that is what makes it reproducible — and keep its
231
+ `git hash-object` value if you took one. The base half still follows the rule above: name the revision,
232
+ not the base blob.
233
+
234
+ ## What makes evidence stale
235
+
236
+ Mechanically, so it can be checked rather than judged:
237
+
238
+ > Evidence is **stale** when the revision it names differs from the revision the
239
+ > item's work finally landed at.
240
+
241
+ Consequences:
242
+
243
+ - An item's four verdicts (gate items 3, 5, 7, 8) MUST all name the **same**
244
+ revision. Verdicts from different revisions do not compose into a ruling about
245
+ one state — the earlier ones ruled on code that no longer exists.
246
+ - **The exception is item 3, on every row, above under _A transient
247
+ observation names its own revision_.** A RED is observed before the code that
248
+ makes it pass exists, so on an uncommitted tree Phase Green moves the content
249
+ address by construction — an ordinary `Unit` / `Component` / `Integration`
250
+ cycle as much as a handed-over one. Listing two special cases here left a
251
+ reviewer applying this section to reject the very cycle the section above
252
+ permits. A RED `/qfai-atdd` handed over is
253
+ taken before the production code exists, so its revision is earlier than the
254
+ GREEN's by construction; a `falsifiability` row's mutation run is taken
255
+ against a tree that is reverted before the GREEN, so its revision names a tree
256
+ that no longer exists. In both, that is the property the observation is worth
257
+ having, not decay. Each records its own field — `RED revision` beside the RED
258
+ pair, `Falsifiability revision` beside the trio — and leaves `Revision` for
259
+ the GREEN and the two reviews, which must still agree with each other. Folding
260
+ either into `Revision` made a correct row permanently stale and unable to
261
+ reach `done`: the `observed-red` E2E/API rows first, and every branch-2 row
262
+ once the gate began reading the mutated tree.
263
+ Everything else about staleness is unchanged: `RED revision` is judged
264
+ against the tree the RED was observed on, and a later commit touching the
265
+ test itself invalidates it the same way.
266
+ - A commit that changes any file the observation covered invalidates it. Re-run
267
+ the observation; do not carry the verdict forward because "the change was
268
+ unrelated". Whether it was unrelated is exactly the judgement the evidence
269
+ exists to remove.
270
+ - **Read that bullet by what it says: _any file the observation covered_.** A commit that changes only
271
+ the record — this evidence file, the ledger's `Status` / `DR-ID` / `Evidence` cells — covers no file
272
+ any observation ran against, so it does not stale one. This is what allows an item's anchors to be
273
+ written in the same commit that closes it, which is the only ordering under which several items
274
+ sharing a file can all be current at once. Measure at the tip, then commit the record and the
275
+ `done` transition together.
276
+ - A reviewer that noticed the tree moving mid-review says so and pins its ruling
277
+ to a named revision. A pinned ruling is a valid verdict for **that** revision
278
+ and a stale one for any later revision.
279
+
280
+ ## When the tree moved under a reviewer
281
+
282
+ State it, in the response, with the revision. Two forms are acceptable:
283
+
284
+ - **Pinned** — the ruling stands for the named revision. The orchestrator then
285
+ decides whether that revision is still the item's final state; if it is not,
286
+ the review is re-run rather than reinterpreted.
287
+ - **Aborted** — the reviewer could not obtain a coherent read at all (for
288
+ example, a suite whose collected count changed between two runs of the same
289
+ command). That is `REVISE` with the reason, not `PASS` with a caveat: a
290
+ mandated back-to-back identical run that could not be produced is a gate that
291
+ did not pass.