qfai 1.10.0 → 1.10.2

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 (103) hide show
  1. package/README.md +95 -25
  2. package/assets/init/.qfai/assistant/README.md +27 -0
  3. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +17 -1
  4. package/assets/init/.qfai/assistant/agents/delivery-planner.md +8 -0
  5. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +12 -1
  6. package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
  7. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +2 -1
  8. package/assets/init/.qfai/assistant/agents/product-surface-reviewer.md +1 -1
  9. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +99 -14
  10. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +4 -1
  11. package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +3 -0
  12. package/assets/init/.qfai/assistant/catalog/test-layers-ci-lanes.md +60 -0
  13. package/assets/init/.qfai/assistant/catalog/test-layers.md +169 -87
  14. package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +4 -3
  15. package/assets/init/.qfai/assistant/constitution/agent-selection.md +7 -1
  16. package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
  17. package/assets/init/.qfai/assistant/constitution/constitution.md +8 -2
  18. package/assets/init/.qfai/assistant/constitution/drift-protocol.md +177 -14
  19. package/assets/init/.qfai/assistant/constitution/review-convergence.md +121 -0
  20. package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +205 -89
  21. package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +59 -5
  22. package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +145 -21
  23. package/assets/init/.qfai/assistant/manifest/agent-routing.yml +69 -3
  24. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +131 -74
  25. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/credential-reuse.md +146 -0
  26. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/red-provenance.md +498 -0
  27. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/review-fix-rounds.md +128 -0
  28. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/scaffolding.md +71 -0
  29. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/shared-test-artifacts.md +124 -0
  30. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/stale-manifest.md +34 -0
  31. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +38 -1
  32. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +4 -3
  33. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +10 -8
  34. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +23 -2
  35. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +16 -1
  36. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +47 -11
  37. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +6 -4
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +2 -2
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +1 -1
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/04_Sources.md +40 -6
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +7 -7
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +3 -3
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +4 -3
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +3 -0
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/00_index.md +14 -5
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +17 -1
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +13 -8
  49. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +83 -84
  50. package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +339 -39
  51. package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +1 -1
  52. package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +348 -15
  53. package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +203 -32
  54. package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +159 -12
  55. package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +70 -5
  56. package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -14
  57. package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +92 -3
  58. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +48 -6
  59. package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +13 -1
  60. package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +71 -9
  61. package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +31 -7
  62. package/assets/init/.qfai/assistant/skills/qfai-implement/references/upstream-artifact-ordering.md +33 -0
  63. package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +19 -12
  64. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +76 -8
  65. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/design-md-spec.md +20 -0
  66. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +7 -4
  67. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +83 -22
  68. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/reviewer-prompt.md +29 -4
  69. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +134 -20
  70. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +31 -3
  71. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +22 -1
  72. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +41 -5
  73. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +16 -4
  74. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +77 -7
  75. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +60 -11
  76. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/ui-design-contract-normalization.md +9 -3
  77. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +14 -1
  78. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/ui-contract.sample.yaml +13 -3
  79. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +5 -1
  80. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/report/preflight_summary.md +3 -2
  81. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/04_Business-Flow.md +4 -1
  82. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +12 -5
  83. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +8 -9
  84. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +9 -0
  85. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +68 -23
  86. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +4 -4
  87. package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +1 -1
  88. package/assets/init/.qfai/assistant/skills/qfai-verify/references/validate-json-schema.md +79 -0
  89. package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +3 -2
  90. package/assets/init/root/.github/workflows/qfai-tests.yml +318 -0
  91. package/assets/init/root/.github/workflows/qfai-validate.yml +327 -24
  92. package/assets/init/root/qfai.config.yaml +11 -2
  93. package/dist/cli/index.cjs +25083 -11488
  94. package/dist/cli/index.cjs.map +1 -1
  95. package/dist/cli/index.mjs +25216 -11589
  96. package/dist/cli/index.mjs.map +1 -1
  97. package/dist/index.cjs +16731 -8386
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +407 -17
  100. package/dist/index.d.ts +407 -17
  101. package/dist/index.mjs +16701 -8370
  102. package/dist/index.mjs.map +1 -1
  103. package/package.json +6 -1
@@ -43,7 +43,7 @@ agents:
43
43
  - Work Orders for each subagent (scope, inputs, outputs, gates)
44
44
  - Stage Gates plan + current status
45
45
  - Completion report (DoD checklist + evidence links)
46
- - Evidence summary for `.qfai/evidence/` (gitignored; do not commit)
46
+ - Evidence summary for `.qfai/evidence/` (commit only paths re-included by the managed block)
47
47
 
48
48
  ## Stop conditions
49
49
 
@@ -56,7 +56,7 @@ agents:
56
56
  ## Sign-off
57
57
 
58
58
  - [ ] Deliverables are complete
59
- - [ ] Evidence is present (gitignored)
59
+ - [ ] Evidence is present under the managed tracking policy
60
60
  - [ ] Stage gates are PASS
61
61
  - [ ] Reviewer sign-off recorded
62
62
 
@@ -125,6 +125,14 @@ agents:
125
125
  - .qfai/specs/spec-\*/01_Spec.md
126
126
  - `.qfai/specs/spec-*/tdd/test-list.md` — the execution ledger this role selects
127
127
  the next item from and whose Red-Green-Refactor ordering it enforces
128
+ - **The document the row's obligation column points at.** Item scope is "is this
129
+ selector a sufficient slice of the obligation", and the obligation is not
130
+ always a `TC-*`: an `E2E` row owes `US-Refs` and an `API` row owes
131
+ `CON-API-Refs`. Without these the role has nothing to compare such a row
132
+ against and can only guess a PASS or stall the gate.
133
+ - `.qfai/specs/spec-*/06_Test-Cases.md` for a `TC-Refs` row
134
+ - `.qfai/specs/spec-*/02_User-stories.md` for a `US-Refs` row
135
+ - `.qfai/contracts/api/**` for a `CON-API-Refs` row
128
136
  - .qfai/discussion/discussion-\*/04_Sources.md
129
137
  - .qfai/discussion/discussion-\*/06_REQ.md
130
138
  - .qfai/discussion/discussion-\*/11_OQ-Register.md
@@ -422,7 +430,8 @@ agents:
422
430
  - .github/instructions/principles.instructions.md
423
431
  - Root `DESIGN.md` (brand SSOT: front-matter tokens plus `# Brand Philosophy` body)
424
432
  - Reference pool framed as deviate-from inputs, screen contracts (`uiux/40_screen_contracts.md`), optional tokens, optional fallback HTML/CSS mock, and Mermaid flows
425
- - Evaluator axes are fixed in `core/prototyping/evaluatorReview.ts#ORDINAL_AXES` (information architecture / navigation flow / usability / functionality) and no longer authored as sidecar files
433
+ - Evaluator axes (information architecture / navigation flow / usability / functionality) are fixed by
434
+ the review validation the QFAI CLI applies (restated in `.qfai/assistant/skills/qfai-prototyping/references/reviewer-prompt.md`), not sidecar files
426
435
  - Runtime screenshots or rendered evidence when available
427
436
 
428
437
  ## Deliverables
@@ -741,7 +750,10 @@ agents:
741
750
  - Coverage plan and layer ownership
742
751
  - Test-case quality and traceability findings
743
752
  - **Coverage Depth Matrix** (per spec, using the template in the depth checklist reference).
744
- Destination: `.qfai/evidence/atdd-<spec-id>.md` from the ATDD stage onward. During SDD there is
753
+ Destination: `.qfai/evidence/coverage-depth-<spec-id>.md` from the ATDD stage onward — its own
754
+ file, because it has its own committed governance lifecycle separate from the committed
755
+ per-item TDD evidence, and the justification behind each `❌` is the input `qa-gatekeeper`
756
+ reads. During SDD there is
745
757
  no evidence artifact that holds it, so report depth gaps as findings instead of producing the
746
758
  matrix format.
747
759
  - Volume estimate and risk notes
@@ -995,6 +1007,22 @@ agents:
995
1007
  - .qfai/assistant/catalog/test-layers.md
996
1008
  - .qfai/specs/spec-\*/09_delta.md
997
1009
  - Validation evidence and gate results
1010
+ - `.qfai/specs/<spec-id>/tdd/test-list.md` — the ledger, for the row under review
1011
+ - The per-item evidence file that row's `Layer` owns: `.qfai/evidence/implement-<spec-id>.md`,
1012
+ or `.qfai/evidence/atdd-<spec-id>.md` for an `E2E` / `API` / `Integration` row
1013
+
1014
+ **Validate evidence is a completion-gate input, not an item-cycle one.** When
1015
+ this role is routed inside an item cycle — `/qfai-atdd` stage gate P1c hands a
1016
+ single row to `/qfai-implement` and that run's reviewers gate its checkpoint —
1017
+ `.qfai/report/validate.log`, the coverage reports and runtime evidence are P5/P6
1018
+ artifacts of the calling stage and do not exist yet. Requiring them there
1019
+ stopped the first branch-1 row at `refactor`, which Phase Red does not
1020
+ re-select, so the calling stage never reached P2. Judge the row's own
1021
+ phase-authored evidence; the completion gate is where the rest is owed. **The
1022
+ two inputs above are what makes that possible** — without the ledger and the
1023
+ evidence home its `Layer` selects, this role cannot identify the artifact it is
1024
+ being asked to judge, and falls into its own Stop condition ("Required evidence
1025
+ ... missing") on a correct branch-1 or branch-2 row.
998
1026
 
999
1027
  ## Deliverables
1000
1028
 
@@ -1022,7 +1050,7 @@ agents:
1022
1050
 
1023
1051
  - [ ] Review verdict is explicit
1024
1052
  - [ ] Findings cite concrete artifacts or evidence
1025
- - [ ] Every finding declares `Severity:` and `Traces to:`; no blocking finding has `Traces to: none`
1053
+ - [ ] Every finding declares `Severity:` and `Traces to:`; no blocking finding traces to `none` or `record:*`
1026
1054
  - [ ] Required gates and residual risks are recorded
1027
1055
 
1028
1056
  ## When to use
@@ -1206,6 +1234,17 @@ agents:
1206
1234
  - .github/instructions/principles.instructions.md
1207
1235
  - Diff of changed files
1208
1236
  - `.qfai/contracts/api/**` and `.qfai/contracts/db/**`
1237
+ - `.qfai/specs/<spec-id>/tdd/test-list.md` — the ledger, for the row under review
1238
+ - The per-item evidence file that row's `Layer` owns: `.qfai/evidence/implement-<spec-id>.md`,
1239
+ or `.qfai/evidence/atdd-<spec-id>.md` for an `E2E` / `API` / `Integration` row
1240
+
1241
+ **The last two are what the `Audited evidence hash` is computed over.** This
1242
+ role records that hash itself, over the row's phase-authored fields — and those
1243
+ live in a committed per-item evidence file so a fresh clone can reproduce the
1244
+ audit. Without the ledger and the evidence home the row's
1245
+ `Layer` selects, this role cannot identify its own audit subject: the hash goes
1246
+ missing and gate items 10-11 stop, or the orchestrator computes it instead,
1247
+ which is the one thing the contract says must not happen.
1209
1248
 
1210
1249
  ## Deliverables
1211
1250
 
@@ -1230,7 +1269,7 @@ agents:
1230
1269
 
1231
1270
  - [ ] Review verdict is explicit
1232
1271
  - [ ] Findings cite concrete artifacts or evidence
1233
- - [ ] Every finding declares `Severity:` and `Traces to:`; no blocking finding has `Traces to: none`
1272
+ - [ ] Every finding declares `Severity:` and `Traces to:`; no blocking finding traces to `none` or `record:*`
1234
1273
  - [ ] Required gates and residual risks are recorded
1235
1274
 
1236
1275
  ## When to use
@@ -1270,7 +1309,7 @@ agents:
1270
1309
  - Audit frontend changes for correctness and user-facing risk.
1271
1310
  - Audit layout sanity, interaction usability, and accessibility guardrails.
1272
1311
  - Audit visual design, token alignment, and service-level UX coherence.
1273
- - Reconcile sidecar artifacts (selected anchor, strategy, screen contracts), design tokens, mermaid flows, and rendered output consistency.
1312
+ - Reconcile sidecar artifacts (screen contracts), design tokens, mermaid flows, and rendered output consistency.
1274
1313
  HTML mock is optional fallback evidence only. Design tokens are supporting input.
1275
1314
  - For UI implementation, compare rendered output against `.qfai/contracts/design/prototype-handoff.yaml`, canonical prototype screenshots, HTML snapshots, and `.qfai/prototypes/winner/index.html`.
1276
1315
  - Reject prototype parity when implementation loses CTA hierarchy, spacing rhythm, information density,
@@ -1359,7 +1398,9 @@ agents:
1359
1398
 
1360
1399
  ## Ownership boundaries
1361
1400
 
1362
- - `delivery-planner` owns **item selection and item scope** — whether a ledger row's selector is a sufficient slice of its `TC-*` obligation. Do not adjudicate item scope here; a PASS on observation
1401
+ - `delivery-planner` owns **item selection and item scope** — whether a ledger
1402
+ row's selector is a sufficient slice of the obligation its `Layer` names
1403
+ (`TC-Refs`, `US-Refs` or `CON-API-Refs`). Do not adjudicate item scope here; a PASS on observation
1363
1404
  evidence is explicitly scoped to that observation and never widens or ratifies item scope. See `.qfai/assistant/skills/qfai-implement/SKILL.md#precedence-between-delivery-planner-and-qa-gatekeeper`.
1364
1405
  - Refuse to evaluate RED/GREEN evidence while an unresolved `delivery-planner` scope REVISE is open on the same item.
1365
1406
 
@@ -1370,7 +1411,8 @@ agents:
1370
1411
  and the Depth Matrix counts case categories. A test that cannot fail otherwise
1371
1412
  clears every gate.
1372
1413
 
1373
- Require an `Oracle proof` on each item and **reject** it when:
1414
+ Require an `Oracle proof` on each item **at a GREEN or completion gate**, and
1415
+ **reject** it when:
1374
1416
 
1375
1417
  - the mutation is outside the code the item owns — breaking a shared helper
1376
1418
  proves the helper is used, not that this test discriminates;
@@ -1379,6 +1421,14 @@ agents:
1379
1421
  - the failing output names a selector other than the row's;
1380
1422
  - the recorded command differs from the `GREEN command`.
1381
1423
 
1424
+ **At a RED observation the proof is a plan, and a plan is enough.** Branch 1's
1425
+ RED is taken before any production behaviour exists, so there is nothing to
1426
+ mutate: the item names the predicate it will break and the command it will run.
1427
+ Requiring a demonstrated mutation there made a correct observed RED unable to
1428
+ pass P1b and so unable to reach Phase Green — the phase that builds the code the
1429
+ mutation needs. Judge the plan for whether it names this row's predicate and
1430
+ selector; judge the demonstration once the behaviour exists.
1431
+
1382
1432
  `equivalent-mutant` is acceptable **only** when the named contract clause is
1383
1433
  genuinely weaker than the obligation. It is an upstream gap: route it as an
1384
1434
  advisory / Change Request, do not send the implementer to strengthen an
@@ -1416,12 +1466,46 @@ agents:
1416
1466
  - "the suite is green" in place of the row's own GREEN.
1417
1467
 
1418
1468
  The one legitimate absence is the _RED not observable_ path: the obligation is
1419
- already satisfied by a sibling row, so the correct test passes first run. Then
1420
- require `Satisfied-by`, `Falsifiability command` and `Falsifiability result`
1421
- instead — never both forms, never neither. See
1469
+ already satisfied by something already in the tree, so the correct test passes
1470
+ first run. Then require `Satisfied-by`, `Falsifiability command` and
1471
+ `Falsifiability result` instead — never both forms, never neither.
1472
+
1473
+ **On an `E2E` / `API` / `Integration` row, `Satisfied-by` need not be a sibling `TDD-NNNN`.** A
1474
+ production **path and symbol** is equally valid there and is the normal answer
1475
+ for a row whose surface no ledger row owns; rejecting it sends every such row to
1476
+ `exception`, the terminal state the path exists to avoid. Judge it on whether it
1477
+ answers "what would I mutate to falsify this row".
1478
+
1479
+ **A commit id alone does not answer it — REVISE.** A commit that touched
1480
+ several routes and a helper names no single predicate, so the ownership check
1481
+ below has no boundary to apply and would accept a mutation anywhere inside it.
1482
+ The producer contract requires the symbol for this reason
1483
+ (`../skills/qfai-atdd/references/red-provenance.md#the-three-branches-must`); a
1484
+ commit recorded **alongside** the path and symbol is provenance and is fine.
1485
+
1486
+ **And the mutation may touch it.** The Oracle Strength Check rejects a mutation
1487
+ outside the code the item owns, which on an `E2E` / `API` / `Integration` row is every
1488
+ production predicate there is — the same sentence above says no ledger row owns
1489
+ that surface. Applied literally, no branch-2 row could ever produce
1490
+ falsifiability evidence that passes. On a handed-over row, **the predicate
1491
+ `Satisfied-by` names is the owned code** for this check; anything else is still
1492
+ out of bounds.
1493
+
1494
+ **On any other row the sibling row is still required** — production code
1495
+ no ledger row owns is the anomaly case there, not a substitute. See
1422
1496
  `.qfai/assistant/skills/qfai-implement/references/red-not-observable.md` and
1423
1497
  `.qfai/assistant/skills/qfai-implement/references/red-admissibility.md`.
1424
1498
 
1499
+ **A `Layer = E2E` / `Layer = API` row from `/qfai-atdd` is judged the same
1500
+ way.** Its journey is often written after the surface the same cycle built, so
1501
+ the falsifiability form is the expected evidence rather than a concession —
1502
+ accept it, with the mutated predicate being one the journey actually asserts
1503
+ on. What is **not** acceptable is the third outcome appearing by default: a row
1504
+ routed to `exception` whose `DR-*` says only that the surface came first has
1505
+ not shown that either branch was unavailable, and that is a REVISE. See
1506
+ `.qfai/assistant/skills/qfai-atdd/SKILL.md#red-provenance-for-an-atdd-owned-row-must`
1507
+ and `.qfai/assistant/skills/qfai-implement/references/execution-ledger.md#atdd-owned-rows`.
1508
+
1425
1509
  Verdict scope: a PASS covers the observation for that round and nothing else. It
1426
1510
  does not ratify item scope and does not clear the completion gate.
1427
1511
 
@@ -1429,7 +1513,10 @@ agents:
1429
1513
 
1430
1514
  In addition to traceability-based coverage (US/TC/CON-API existence), verify the **depth** of test cases:
1431
1515
 
1432
- - Confirm a Coverage Depth Matrix exists (produced by `test-design-analyst`). Missing matrix: REVISE from the ATDD review cycle onward; on an SDD review cycle record it as a finding. See the scope note.
1516
+ - Confirm a Coverage Depth Matrix exists at `.qfai/evidence/coverage-depth-<spec-id>.md` (produced by `test-design-analyst`).
1517
+ Missing matrix: REVISE from the ATDD review cycle onward; on an SDD review cycle record it as a finding. See the scope note.
1518
+ A matrix that exists only inside `.qfai/evidence/atdd-<spec-id>.md` is a **missing** matrix: that committed file is the
1519
+ ledger's per-item evidence payload, not the dedicated matrix artifact whose justifications this gate reads.
1433
1520
  - Check that each US/TC has test cases for at minimum: normal path AND error/failure path.
1434
1521
  - Flag any US/TC that has only normal-path test cases as a coverage gap.
1435
1522
  - Reference: `.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md`
@@ -1443,8 +1530,9 @@ agents:
1443
1530
  The Coverage Depth Matrix is an **ATDD-stage artifact**: it is defined in
1444
1531
  `.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md`, listed as an ATDD
1445
1532
  Mandatory Output,
1446
- and written into `.qfai/evidence/atdd-<spec-id>.md`. `qfai-sdd` neither defines its layout nor
1447
- ships a section for it, so:
1533
+ and written to `.qfai/evidence/coverage-depth-<spec-id>.md` — a committed governance path alongside
1534
+ `implement-<spec-id>.md` and `atdd-<spec-id>.md`. Only run-scoped evidence remains ignored.
1535
+ `qfai-sdd` neither defines the matrix layout nor ships a section for it, so:
1448
1536
 
1449
1537
  - Apply this check from the **ATDD review cycle onward**, where
1450
1538
  `.qfai/assistant/skills/qfai-atdd/SKILL.md` lists
@@ -1462,14 +1550,47 @@ agents:
1462
1550
  - .qfai/assistant/catalog/test-layers.md
1463
1551
  - .qfai/specs/spec-\*/09_delta.md
1464
1552
  - `.qfai/specs/spec-*/tdd/test-list.md` — the ledger row under review
1465
- - `.qfai/evidence/implement-<spec-id>.md` — the per-item RED/GREEN evidence this
1466
- role adjudicates. Both are listed because the Stop condition below ("target
1467
- artifacts are missing") is not checkable against an artifact this role was
1468
- never told to open.
1469
- - `.qfai/report/validate.log`
1553
+ - **The per-item RED/GREEN evidence for the row under review — in the file its
1554
+ `Layer` owns, and only that one.** `.qfai/evidence/atdd-<spec-id>.md`, under
1555
+ `## Ledger rows advanced`, for a `Layer = E2E` / `Layer = API` / `Layer = Integration` row;
1556
+ `.qfai/evidence/implement-<spec-id>.md` for every other row. Both are listed
1557
+ because the Stop condition below ("target artifacts are missing") is not
1558
+ checkable against an artifact this role was never told to open — but
1559
+ requiring **both** makes that condition fire on a spec that legitimately has
1560
+ one: a Unit-only spec never ran `/qfai-atdd`, and a spec whose rows are all
1561
+ `E2E` / `API` / `Integration` has no implement file. Either way the gate would stop before
1562
+ reading the evidence that does exist.
1563
+ **The three below are required at a completion gate, not at a RED/GREEN
1564
+ observation.** `/qfai-atdd` routes this role as blocking at stage gate P1b, and
1565
+ validate output, coverage reports and runtime evidence are first produced at its
1566
+ P5 and P6 — so requiring them there stopped a fresh run that had a perfectly
1567
+ good RED pair, on artifacts its own ordering says cannot exist yet. At an
1568
+ observation gate the row's own evidence above is the whole input.
1569
+
1570
+ - The scoped validate JSON for the spec under review — `validate.spec-<id>.json`
1571
+ **beside the configured `output.validateJsonPath`**, not under a fixed
1572
+ `.qfai/report/` — or the `run-*/` directory of the run that produced it, under
1573
+ the configured `paths.outDir`. Read both from `qfai.config.yaml` the way the
1574
+ SDD and discussion contracts do. A project that moved either output writes its
1575
+ evidence where it said to, and looking for it at the default path reported a
1576
+ missing artifact and stopped completion on a validate run that had succeeded
1577
+ and left everything it owed. **Not `validate.log`**: it and the run-log pointer are shared by every
1578
+ run, scoped or not, and nothing serializes them, so a sibling stage validating
1579
+ at the same time overwrites what this one wrote — a failing run followed by a
1580
+ sibling's success reads as this spec's PASS
1470
1581
  - `.qfai/report/specs-coverage/spec-*.md`
1471
1582
  - Runtime evidence and prototyping evidence artifacts
1472
1583
 
1584
+ **Branch 3 gets its own verdict.** The observation gate admits an observed RED
1585
+ or a falsifiability trio and calls anything else "never neither" — but a genuine
1586
+ branch-3 row _has_ neither, by the finding that put it there. Judged by the two
1587
+ forms it can only be REVISE, and skipping the gate leaves the stage's completion
1588
+ condition unmet, so the row could not close either way. Judge these on their own
1589
+ terms: a `DR-*` that records **what could not be observed and why each branch was
1590
+ unavailable**, PASS or REVISE on that. A missing `DR-*`, or one that names no
1591
+ unavailability, is still REVISE — this is a third form of evidence, not an
1592
+ exemption from having any.
1593
+
1473
1594
  ## Deliverables
1474
1595
 
1475
1596
  - Gate decision (PASS / REVISE) with rationale
@@ -1478,7 +1599,10 @@ agents:
1478
1599
 
1479
1600
  ## Stop conditions
1480
1601
 
1481
- - Required evidence, governing specs, or target artifacts are missing.
1602
+ - Required evidence, governing specs, or target artifacts are missing — judged
1603
+ against what the invoking phase requires, per the note above the last three
1604
+ inputs. At a RED/GREEN observation that is the row's own evidence; at a
1605
+ completion gate it is all of them.
1482
1606
  - The request requires implementation or file editing instead of independent review.
1483
1607
  - The issue falls outside this review domain and must be rerouted to another specialist first.
1484
1608
 
@@ -75,11 +75,34 @@ routing:
75
75
  # the row is allowed to proceed to `build`.
76
76
  - id: red
77
77
  iteration: per-ledger-item
78
- mandatory_agents: [qa-gatekeeper]
79
- conditional_agents: []
78
+ # `qa-gatekeeper` is **conditional**, not mandatory. `/qfai-atdd`
79
+ # invokes this phase for step 3a alone when a new route or export
80
+ # needs its seam before a RED can be taken — the row has no RED yet,
81
+ # which is the whole reason for the trip. Listed as mandatory, the
82
+ # gate had no assertion failure to judge and could only return
83
+ # REVISE, so `SKILL.md`'s "do not route `qa-gatekeeper` for a
84
+ # seam-only invocation" contradicted this manifest and the round trip
85
+ # stopped. It stays blocking: whenever a RED *is* submitted, its
86
+ # verdict decides.
87
+ mandatory_agents: []
88
+ # The production owners are conditional here, not absent. Two steps
89
+ # in this phase touch production source before any RED exists, and
90
+ # the orchestrator may not implement (`SKILL.md` Orchestrator
91
+ # Protocol): step 3a's minimal seam, which a new-surface row needs
92
+ # before its failure is an assertion rather than a 404, and step 3c's
93
+ # falsifiability mutation for a handed-over row whose evidence is not
94
+ # written yet. Without them the phase had `qa-gatekeeper` alone and
95
+ # neither step had anyone to perform it.
96
+ conditional_agents: [qa-gatekeeper, frontend-engineer, backend-engineer]
80
97
  parallel_groups: []
81
98
  blocking_agents: [qa-gatekeeper]
82
- rerun_policy: failed-agents-only
99
+ # `changed-scope-dependents`: the gatekeeper's REVISE here is usually
100
+ # *about* the seam or the mutation — it touched code the row does not
101
+ # own, or the selector did not fail. Re-running only the agent that
102
+ # returned non-PASS re-judges an unchanged artifact and returns the
103
+ # same REVISE, so the row never leaves `red`. Whoever wrote the
104
+ # production edit has to be rerun with it.
105
+ rerun_policy: changed-scope-dependents
83
106
  - id: build
84
107
  iteration: per-ledger-item
85
108
  mandatory_agents: [qa-gatekeeper]
@@ -121,6 +144,49 @@ routing:
121
144
  parallel_groups: []
122
145
  blocking_agents: [test-design-analyst]
123
146
  rerun_policy: failed-agents-only
147
+ # Stage gate P1b. `references/red-provenance.md` branch 1 requires
148
+ # `qa-gatekeeper` to confirm the RED *before any production code exists*,
149
+ # which is the same rule `qfai-implement` applies to its own rows — and
150
+ # there was no phase here to submit that to, so the instruction named a
151
+ # routing phase this skill did not have. It must sit before
152
+ # `implementation`: after the surfaces are built there is nothing left to
153
+ # watch fail.
154
+ - id: red
155
+ # `delivery-planner` is blocking here, ahead of `qa-gatekeeper`:
156
+ # `qfai-implement/SKILL.md` makes it the only authority on whether a
157
+ # selector covers a sufficient slice of its obligation, and requires a
158
+ # scope REVISE to be settled BEFORE the RED is submitted. Approving the
159
+ # RED first leaves the planner only "keep the PASS and open a new row",
160
+ # which cannot repair a handoff taken at the wrong granularity.
161
+ #
162
+ # `qa-gatekeeper` is **conditional**, not mandatory: it judges the rows
163
+ # that have evidence at this gate — the branch 1 ones. A branch 2 row's
164
+ # payload is its falsifiability trio, which by design does not exist
165
+ # until P4b, and the role stops when a row's evidence is missing. Listed
166
+ # as mandatory it therefore stopped a run whose rows are all branch 2
167
+ # before it could reach the P4b handoff that produces the trio: the gate
168
+ # blocked on the absence of something it is the reason for. It stays
169
+ # blocking — when it is routed, its verdict decides.
170
+ #
171
+ # `iteration: per-ledger-item`, matching this manifest's
172
+ # `qfai-implement` red phase. The default is `per-invocation`, which
173
+ # routes each agent once for the whole ledger — so
174
+ # `acceptance-test-engineer` would leave several deliberate REDs open at
175
+ # once and `qa-gatekeeper` would never see a row in its own RED state,
176
+ # neither of which is the one-row-at-a-time loop P1b/P1c require.
177
+ iteration: per-ledger-item
178
+ mandatory_agents: [delivery-planner, acceptance-test-engineer]
179
+ conditional_agents: [qa-gatekeeper]
180
+ parallel_groups: []
181
+ blocking_agents: [delivery-planner, qa-gatekeeper]
182
+ # `changed-scope-dependents`, not `failed-agents-only`: a
183
+ # `delivery-planner` REVISE here means the selector covers too little
184
+ # of its obligation, and the repair is `acceptance-test-engineer`
185
+ # splitting the test — then a fresh `qa-gatekeeper` verdict on the new
186
+ # RED. Re-running only the agent that failed would have the planner
187
+ # re-read an unchanged selector and return the same REVISE, or leave
188
+ # the previous gatekeeper PASS standing over a test that changed.
189
+ rerun_policy: changed-scope-dependents
124
190
  - id: implementation
125
191
  mandatory_agents: [acceptance-test-engineer]
126
192
  conditional_agents: []