qfai 1.9.2 → 1.10.0

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 (123) hide show
  1. package/README.md +48 -2
  2. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +1 -0
  3. package/assets/init/.qfai/assistant/agents/backend-engineer.md +1 -0
  4. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +13 -2
  5. package/assets/init/.qfai/assistant/agents/delivery-planner.md +9 -0
  6. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +1 -0
  7. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +6 -0
  8. package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
  9. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +96 -3
  10. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +20 -3
  11. package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +2 -2
  12. package/assets/init/.qfai/assistant/catalog/spec_required_files.json +2 -1
  13. package/assets/init/.qfai/assistant/catalog/test-layers.md +355 -14
  14. package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +165 -0
  15. package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
  16. package/assets/init/.qfai/assistant/constitution/drift-protocol.md +304 -10
  17. package/assets/init/.qfai/assistant/constitution/quality.md +35 -5
  18. package/assets/init/.qfai/assistant/constitution/requirements-decomposition.md +37 -0
  19. package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +244 -8
  20. package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +122 -5
  21. package/assets/init/.qfai/assistant/constitution/workflow.md +53 -7
  22. package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +316 -945
  23. package/assets/init/.qfai/assistant/manifest/agent-routing.yml +50 -4
  24. package/assets/init/.qfai/assistant/manifest/review-profiles.yml +9 -0
  25. package/assets/init/.qfai/assistant/process/migrations/v1.4.27-atdd-alignment.md +1 -1
  26. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +61 -21
  27. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +23 -4
  28. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +15 -7
  29. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +8 -4
  30. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +2 -2
  31. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +17 -7
  32. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +10 -4
  33. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +1 -1
  34. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +4 -4
  35. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +1 -1
  36. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
  37. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +17 -7
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +1 -1
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +11 -3
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +5 -2
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +7 -4
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +14 -7
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
  49. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +16 -7
  50. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +9 -6
  51. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +3 -2
  52. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -2
  53. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +250 -128
  54. package/assets/init/.qfai/assistant/skills/qfai-implement/references/change-request-reset.md +93 -0
  55. package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +106 -0
  56. package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +73 -0
  57. package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +77 -0
  58. package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +303 -0
  59. package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +19 -0
  60. package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +49 -0
  61. package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -0
  62. package/assets/init/.qfai/assistant/skills/qfai-implement/references/oracle-strength.md +81 -0
  63. package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +235 -0
  64. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-admissibility.md +91 -0
  65. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +70 -0
  66. package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +87 -0
  67. package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +31 -0
  68. package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +102 -0
  69. package/assets/init/.qfai/assistant/skills/qfai-implement/references/selector-granularity.md +24 -0
  70. package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +149 -0
  71. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +35 -18
  72. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +1 -1
  73. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +106 -7
  74. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +40 -11
  75. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +48 -1
  76. package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample +6 -0
  77. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +82 -22
  78. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +148 -0
  79. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +10 -4
  80. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +1 -1
  81. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +4 -2
  82. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +18 -0
  83. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +44 -3
  84. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +60 -7
  85. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +157 -5
  86. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +125 -0
  87. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/db-contract.sample.sql +6 -0
  88. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +92 -0
  89. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/01_Objective.md +27 -0
  90. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/02_Initiative.md +30 -0
  91. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +16 -6
  92. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/06_Glossary.md +19 -0
  93. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/07_Constraints.md +25 -0
  94. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/08_Decisions.md +22 -2
  95. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +37 -10
  96. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +20 -0
  97. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/03_Acceptance-Criteria.md +19 -0
  98. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/04_Business-Rules.md +32 -3
  99. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +56 -0
  100. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/07_Decisions.md +29 -2
  101. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/10_Plan.md +41 -0
  102. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/16_Traceability-ledger.md +58 -0
  103. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +56 -0
  104. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +57 -102
  105. package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +24 -0
  106. package/assets/init/.qfai/assistant/skills/qfai-verify/references/context-load.md +22 -0
  107. package/assets/init/.qfai/assistant/skills/qfai-verify/references/verify-output-contract.md +48 -0
  108. package/assets/init/.qfai/assistant/skills/qfai-verify/templates/verify-evidence.md +48 -0
  109. package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +25 -7
  110. package/assets/init/.qfai/waivers.yml +11 -5
  111. package/assets/init/root/DESIGN.md +6 -0
  112. package/assets/init/root/qfai.config.yaml +15 -12
  113. package/dist/cli/index.cjs +11023 -7139
  114. package/dist/cli/index.cjs.map +1 -1
  115. package/dist/cli/index.mjs +10963 -7080
  116. package/dist/cli/index.mjs.map +1 -1
  117. package/dist/index.cjs +8782 -5257
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/index.d.cts +280 -8
  120. package/dist/index.d.ts +280 -8
  121. package/dist/index.mjs +11776 -8264
  122. package/dist/index.mjs.map +1 -1
  123. package/package.json +18 -19
@@ -0,0 +1,87 @@
1
+ # Relevant Test Suite
2
+
3
+ What "run the relevant test suite" resolves to in Phase: Refactor step 2, and
4
+ where the wide run is actually paid for.
5
+
6
+ ## Resolution order
7
+
8
+ "Relevant" means the smallest selector that covers the module you touched
9
+ **plus everything that depends on it**, direct or indirect.
10
+
11
+ 1. **The touched module's own tests** — the test modules named by this item's
12
+ ledger row.
13
+ 2. **The tests of its reverse dependency closure.** Walk the **production**
14
+ import graph backwards from the touched module `X`: the modules that import
15
+ `X`, the modules that import those, and so on until the walk closes. Include
16
+ the test modules of every module in that closure.
17
+
18
+ Searching test files for a direct import of `X` is not enough. The common
19
+ shape is: `X` <- `Y` (production) <- `Y`'s test. `Y`'s test imports only `Y`,
20
+ so a test-file scan finds nothing, the fallback is never reached, and a
21
+ broken `Y` still passes the narrow gate.
22
+
23
+ 3. **Fallback: the package containing the touched module** — whenever the
24
+ reverse walk cannot be completed. It cannot be completed when the graph
25
+ contains dynamic imports, DI or container wiring, dependency-injected
26
+ factories, reflection, generated code, or when no import-graph tool is
27
+ available. Incomplete resolution always widens; it never narrows.
28
+ 4. **Never "every test in the repository"** at this step — the wide run has its
29
+ own cadence, below.
30
+
31
+ Record which of 1-3 was used in the item's evidence. "Narrow suite, closure
32
+ resolved" and "narrow suite, package fallback" are different claims, and only
33
+ the first one asserts the dependents were actually checked.
34
+
35
+ ## Cadence
36
+
37
+ **Narrow suite per item; full suite at each checkpoint boundary.**
38
+
39
+ Running the whole spec suite once per item costs the sum over all prior items
40
+ and is quadratic in ledger size. That cost is paid at boundaries instead.
41
+
42
+ ### Checkpoint boundaries
43
+
44
+ The full suite runs at, and only at:
45
+
46
+ - the **last incomplete row this run completes** — while finishing a row, if no
47
+ other row is left at `todo` / `red` / `green` / `refactor` / `review-fix`,
48
+ that row is a boundary. It is deliberately **not** the physical last row of
49
+ the file: a re-executed ledger routinely has its remaining `todo` rows above
50
+ already-`done` or `exception` ones — rows appended later, or a backfilled
51
+ gap — and the physical last row is then skipped, so the spec would finish
52
+ without a full run at all. A run that completes no row has nothing to verify
53
+ and no boundary;
54
+ - any row whose implementation **touched modules belonging to more than one
55
+ package**, or touched a module outside the package that owns this item's own
56
+ test modules — a cross-package edit re-widens the run immediately. Resolve
57
+ the owning package of every touched module directly from its path; this is
58
+ evaluated **independently of the resolution step used above**, so a fully
59
+ closed reverse walk (step 2, where step 3's fallback package never exists)
60
+ does not skip it;
61
+ - every **N-th** completed row, with `N = 10` by default. Record the chosen `N`
62
+ in the item's evidence when a project overrides it.
63
+
64
+ The counted interval is what keeps the cadence sub-quadratic. An AC or BR group
65
+ is **not** a boundary: in a spec where TC and AC are close to one-to-one — as in
66
+ this repository's `spec-0006`, whose `TC-0006-0001..0009` each map to a distinct
67
+ AC and each occupy one ledger row — every row would be the last of its group and
68
+ the per-item full run would be right back. The boundary must be coarser than the
69
+ obligation granularity, so it is defined by count, not by grouping.
70
+
71
+ Rows that are not on a boundary are gated on the narrow suite alone: items 6, 7
72
+ and 8 of the 11-point gate are evaluated against it, and item 11 requires the
73
+ full suite only for a row that sits on a boundary.
74
+
75
+ ### Checkpoint runs before `done`, never after
76
+
77
+ The lifecycle allows `refactor -> exception` but forbids re-opening a `done`
78
+ row, so verification has to happen while the row is still `refactor`:
79
+
80
+ - run the checkpoint at the end of Refactor, after the reviewers return PASS;
81
+ - PASS -> `refactor -> done`;
82
+ - FAIL -> `refactor -> exception` with a DR-ID, and the regression is filed as
83
+ a new `todo` row carrying the failing selector.
84
+
85
+ Rows already `done` from earlier boundaries are never re-opened. Spec completion
86
+ stays blocked until the new row reaches `done`, because "Checkpoint verification
87
+ passed" is a spec completion condition.
@@ -0,0 +1,31 @@
1
+ # Review Artifact Layout
2
+
3
+ Items 7-9 of the 11-point reviewer gate in `SKILL.md` are evidence-bearing: the reviewer verdicts
4
+ must be written to a review pack, not left in conversation. There is exactly **one**
5
+ `.qfai/review/**` layout, the one validated by
6
+ `packages/qfai/src/core/validators/reviewArtifacts.ts` and archived by `npx qfai doctor`:
7
+
8
+ ```text
9
+ .qfai/review/review-<YYYYMMDDhhmmssSSS>/ # 17-digit timestamp; no other directory shape is recognized
10
+ ├── review_request.md # required
11
+ ├── R01_<reviewer-id>.md # required, at least one; R02_, R03_, ... per reviewer
12
+ └── summary.json # required
13
+ ```
14
+
15
+ - One pack per review round for one `TDD-ID`. Do not nest `<scope>/<layer>/attempt-NN/`
16
+ directories under `.qfai/review/` — that layout is not validated and packs written there are
17
+ invisible to `npx qfai validate`.
18
+ - The scope of the pack is recorded **inside** the artifacts, not in the directory name. In
19
+ `summary.json` set `target.kind: "spec"` and `target.path` to the spec dir, and name the
20
+ `TDD-ID` in `review_request.md`.
21
+ - Minimum `summary.json` shape (`version: "2.0"`):
22
+ `version`, `created_at`, `target.{kind,path}`, `routing_profile`, `overall_status` (`PASS|FAIL`),
23
+ and `reviewers[]` where each entry is `{ reviewer, status: PASS|FAIL|NA, feedback_count }`.
24
+ A `REVISE` verdict during iteration is written as `status: "FAIL"` here — see
25
+ `shared-skill-delegation-baseline.md#verdict-vocabulary`.
26
+ - Each additional review round creates a **new** `review-<timestamp>/` pack. Do not append
27
+ ad-hoc per-round filenames inside an existing pack.
28
+ - Review artifacts are checked only by the full-scan profiles. Neither `--profile tdd` nor
29
+ `--profile sdd` reports `QFAI-REVIEW-*`, so a malformed or missing `summary.json` passes both.
30
+ Run `npx qfai validate --profile verify --fail-on error` (or the default full scan,
31
+ `npx qfai validate --fail-on error`, or `/qfai-verify`, which runs the same profile) to see them.
@@ -0,0 +1,102 @@
1
+ # Round Evidence
2
+
3
+ Per-round fields of the `qfai-implement` evidence contract. The skill's
4
+ `### Per-item evidence contract` section carries the summary.
5
+
6
+ ## Round block
7
+
8
+ One block per RED/GREEN cycle. Round 1 is the original cycle; each blocking
9
+ reviewer `REVISE` that requires new production behaviour adds a round.
10
+
11
+ - `Round N: RED command` — the exact command executed to observe failure
12
+ - `Round N: RED result` — the failure output (result completeness is
13
+ best-effort; truncated output is acceptable)
14
+ - `Round N: GREEN command` — the exact command executed to observe success
15
+ - `Round N: GREEN result` — the success output
16
+ - `Round N: reviewer verdict` — the verdict that closed the round (`PASS`, or
17
+ `REVISE` plus the finding, and which rework path it took). Absent on round 1
18
+ when no review has run yet.
19
+
20
+ ## What opens a round
21
+
22
+ Round 1 is the original RED/GREEN cycle. Each blocking reviewer `REVISE` that
23
+ requires new production behaviour adds a round. A `REVISE` that needs none
24
+ (naming, duplication, comments) opens no round and is verified by a refreshed
25
+ `Refactor verify` pair instead. Rounds are numbered and repeatable, not appended
26
+ as free prose.
27
+
28
+ Every field in a round block carries the `Round N:` prefix — `Round N: RED
29
+ command` / `Round N: RED result` / `Round N: GREEN command` / `Round N: GREEN
30
+ result` / `Round N: reviewer verdict`.
31
+
32
+ ## Single-round items
33
+
34
+ A single-round item satisfies the contract with `Round 1: ...` and no
35
+ reviewer-verdict line, which is the same content the previous one-pair
36
+ contract required. Nothing existing becomes non-conformant.
37
+
38
+ ## Where the rounds happen
39
+
40
+ An item at `review-fix` may re-enter the RED/GREEN cycle as many times as the
41
+ rework needs. Each pass is its own round block.
42
+
43
+ **The row's `Status` stays `review-fix` throughout.** The RED/GREEN passes are
44
+ work, not ledger states here: `review-fix -> red` and `review-fix -> green` are
45
+ not allowed transitions, and writing either would be the backward transition
46
+ the lifecycle forbids. `review-fix -> refactor` is the only status change the
47
+ rework produces; the rounds themselves are recorded in `Evidence`.
48
+
49
+ ## A `REVISE` that needs no new production behaviour
50
+
51
+ `implementation-reviewer` frequently returns `REVISE` for naming, duplication
52
+ or a comment — rework that changes no observable behaviour. There is no new
53
+ failing test to write, so opening a round would mean inventing a RED phase for
54
+ a change that has none. That rework takes the second path:
55
+
56
+ 1. The status contract is unchanged: the row still moves
57
+ `refactor -> review-fix` and back.
58
+ 2. **No round is opened.** Round blocks record RED/GREEN cycles; a
59
+ behaviour-preserving change has none.
60
+ 3. Make the change, re-run the item's tests, and refresh
61
+ `Refactor verify command` / `Refactor verify result`. That refreshed pair is
62
+ the evidence the change kept GREEN, and it must be fresh — the pre-rework
63
+ pair is stale evidence.
64
+ 4. Record the trigger and the path taken on the current round's
65
+ `Round N: reviewer verdict` line, then return to `refactor` and re-submit.
66
+
67
+ Which path applies is decided by the finding, not by the reviewer: a `REVISE`
68
+ that requires new production behaviour opens round N+1 even when it came from
69
+ `implementation-reviewer`.
70
+
71
+ ## Who the rework goes back to
72
+
73
+ Returning to `refactor` re-submits the item to **every routed blocking reviewer
74
+ whose verdict the rework could invalidate** — always the reviewer that opened
75
+ the round, plus any reviewer that already returned `PASS` on artifacts the
76
+ rework changed. A `PASS` recorded against the pre-rework test or production
77
+ code is stale evidence: it does not count towards "After all routed blocking
78
+ reviewers return PASS" and must be re-earned before the item may reach `done`.
79
+
80
+ ## Resuming a `review-fix` item
81
+
82
+ A `review-fix` row can outlive the session that created it — the operator
83
+ interrupts, or the run ends between the `REVISE` and the rework. On the next
84
+ start, `review-fix` rows are selected **before** any `todo` row (Required
85
+ Process, Phase: Red, step 1), so an interrupted rework is always resumed
86
+ rather than stranded behind newer items.
87
+
88
+ Resuming a `review-fix` row:
89
+
90
+ 1. Read the round blocks already in the item's evidence and take the highest
91
+ `Round N`; the reviewer verdict on that round names the finding to fix.
92
+ 2. Pick the path the finding calls for: open round `N + 1` and run the
93
+ RED/GREEN cycle when the fix needs new production behaviour, or take the
94
+ behaviour-preserving path above when it does not.
95
+ 3. Return the row to `refactor` and re-submit per **Who the rework goes back
96
+ to** above.
97
+
98
+ A `review-fix` row must already have a `Test file` — it reached `refactor`
99
+ before the `REVISE`. `validateTddList` checks the file exists for
100
+ `review-fix` exactly as it does for `green`, `refactor` and `done`, so a
101
+ rework row that lost its test file is reported (`TDDLIST_TEST_FILE_MISSING`)
102
+ instead of being accepted as a valid ledger state.
@@ -0,0 +1,24 @@
1
+ # Selector Granularity
2
+
3
+ `Selector` is **not** restricted to a single test function. A row may legally own several, written as
4
+ a comma-separated list or a glob — but only when they observe the **same** boundary from different
5
+ angles: `test_rejects_expired_token_via_header, test_rejects_expired_token_via_cookie`, or
6
+ `test_rejects_expired_token_*`. Two different rejection reasons (`expired_token` and
7
+ `wrong_audience`) are two boundaries and therefore two rows. What is restricted is what a row may
8
+ _conflate_:
9
+
10
+ - **One independently observable boundary per row.** Multiple selector entries are for covering that
11
+ one boundary from more than one angle, never for packing several boundaries behind one `TDD-ID`.
12
+ RED is still observed **per selector entry**, not once per row — each entry needs its own "watch it
13
+ fail for the expected reason" observation, and each entry's failure reason is recorded separately
14
+ in Evidence.
15
+ - **A matrix-shaped `TC-*` must be decomposed before RED begins.** A `TC-*` that enumerates many
16
+ rejection reasons, a status-code matrix, or several independent state transitions is split across
17
+ multiple TDD rows — one falsifying oracle per row — rather than accumulated behind one selector.
18
+ The splitting rule: **one row per independently observable boundary**. Rows that decompose the
19
+ same `TC-*` all carry that `TC-*` in `TC-Refs`; `TC-Refs` is many-to-many with `TDD-ID`.
20
+ - A selector that accumulates unrelated boundaries **invalidates the RED observation** — see the Red
21
+ phase below.
22
+ - **Precedence, when the two rules seem to disagree:** the row-splitting rule wins. If you cannot
23
+ name the single boundary that every selector entry on a row observes, the row is carrying more
24
+ than one and must be split.
@@ -0,0 +1,149 @@
1
+ # Volume Policy
2
+
3
+ ## Why this exists
4
+
5
+ The per-item ceremony in `SKILL.md` is written for a ledger of tens of rows. At
6
+ the volume `/qfai-sdd` and `/qfai-atdd` routinely produce it is arithmetically
7
+ unfinishable, and an unfinishable process is abandoned wholesale — taking the
8
+ RED/GREEN evidence and the drift discipline with it. Scaling the ceremony is
9
+ what keeps those intact; dropping a gate is not on the table.
10
+
11
+ The per-item ceremony below is written for a ledger of tens of rows. At the
12
+ volume `/qfai-sdd` and `/qfai-atdd` routinely produce it is arithmetically
13
+ unfinishable, and an unfinishable process is abandoned wholesale — taking the
14
+ RED/GREEN evidence and drift discipline with it. Scale the ceremony instead.
15
+
16
+ ## Risk tier (derive per row)
17
+
18
+ Derive the tier from the ledger row's `Layer`, what the item touches, and what
19
+ it would cost to get wrong:
20
+
21
+ | Tier | Row shape | Ceremony |
22
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
23
+ | **T1 — standard** | Pure decision logic; unit/component layer; touches no infrastructure, no public API surface, no UI; not critical below | `qa-gatekeeper` confirms RED/GREEN once per coherent group instead of once per row. Reviews are batched the same way (below). |
24
+ | **T2 — elevated** | Touches infrastructure, a public API surface, a contract (`CON-*`), or persisted schema — **or** is critical (below) | Full per-item ceremony: per-row `qa-gatekeeper` RED and GREEN turns, per-row `completion-reviewer` and `implementation-reviewer`. |
25
+ | **T3 — surface** | Changes UI behavior or rendered output | T2 plus `product-surface-reviewer`. |
26
+
27
+ Record the tier in the row's `Evidence` cell alongside the RED/GREEN commands.
28
+ A row with no recorded tier is treated as **T2**.
29
+
30
+ ### Criticality outranks connectedness
31
+
32
+ Tiering is not only about what the code is wired to. A row is **T2 regardless of
33
+ layer**, even as pure unit-level logic touching nothing else, when it implements:
34
+
35
+ - an authorization or authentication decision (permission checks, role/scope
36
+ evaluation, token or session validity);
37
+ - cryptographic verification (signature, MAC, hash comparison, nonce or replay
38
+ checks, key selection);
39
+ - money or accounting arithmetic (pricing, billing, tax, interest, currency
40
+ conversion, ledger balancing);
41
+ - data-integrity or safety-critical logic (irreversible mutation and deletion
42
+ rules, quota and rate limits, PII redaction or retention, consent
43
+ enforcement, idempotency keys).
44
+
45
+ Cheap to connect is not the same as cheap to get wrong. When it is arguable
46
+ whether a row is critical, it is critical.
47
+
48
+ ### Routing is unchanged
49
+
50
+ The tier scales **how often** a gate runs, never **whether** it runs.
51
+ `agent-routing.yml` keeps `qa-gatekeeper`, `completion-reviewer` and
52
+ `implementation-reviewer` all **mandatory** for `qfai-implement`; T1 only
53
+ changes the submitted unit from one row to one coherent group. Every row is
54
+ still covered by a live turn from each of those agents, and a group that has
55
+ not been confirmed leaves all of its members short of the 11-point gate.
56
+
57
+ Note the asymmetry, because "all routed blocking reviewers pass" alone is not
58
+ the item gate: `blocking_agents` lists only `qa-gatekeeper` and
59
+ `completion-reviewer`. `implementation-reviewer` is mandatory but not in that
60
+ list, and a `REVISE` from it still blocks `done` — item 8 of the 11-point gate
61
+ requires its PASS independently of the routing list. Read the 11-point gate as
62
+ the authority for an item transition; `blocking_agents` governs phase
63
+ progression, not the ledger write.
64
+
65
+ ## Batched review
66
+
67
+ For T1 rows, run **one** `completion-reviewer` pass and **one**
68
+ `implementation-reviewer` pass per _coherent group_ — a set of items that share
69
+ a BR or an AC — instead of one pass per item. The group is the review unit:
70
+
71
+ - record the group's member `TDD-ID`s as a single block in the evidence file;
72
+ - a `REVISE` on the group blocks every member until it is resolved;
73
+ - a group must not mix tiers; a T2 or T3 row is always reviewed alone.
74
+
75
+ ### Group formation (states and transitions)
76
+
77
+ Batching adds **no** status value. It adds exactly **one** lifecycle edge, the
78
+ `refactor -> red` QA rejection recovery in `SKILL.md`, because confirming
79
+ RED/GREEN after the row has left `red` is only meaningful if a rejected row can
80
+ redo it. A T1 row whose refactor verify is GREEN sits in `refactor` — that is
81
+ the review-ready state — and waits there for its group. Members still move
82
+ `refactor -> done`, only together.
83
+
84
+ - **Open** the group when the first T1 row of a BR/AC reaches `refactor`.
85
+ - **Fill** it by continuing to process that BR/AC's remaining rows one item at
86
+ a time. The one-item-at-a-time constraint is about the Red/Green cycle: at
87
+ most one row is in `red` or `green` at any moment. A row parked in `refactor`
88
+ is an in-flight member of the **open** group, not an abandoned item, so
89
+ parking is not a violation of that constraint.
90
+ - **Close** the group — this is the review-start condition — at whichever comes
91
+ first: every member has reached `refactor`; the next `todo` row belongs to a
92
+ different BR/AC; the ledger has no `todo` rows left. A group never spans a
93
+ spec, so finishing a ledger also closes the open group.
94
+ - **Review** on close: one `qa-gatekeeper` turn over the members' recorded
95
+ RED/GREEN evidence, one `completion-reviewer` pass, one
96
+ `implementation-reviewer` pass. On `REVISE` no member goes `done`; where the
97
+ faulted member goes depends on what was faulted:
98
+ - `completion-reviewer` / `implementation-reviewer` `REVISE`, or a
99
+ `qa-gatekeeper` `REVISE` about how the evidence was **written** — fix in
100
+ place; the member stays in `refactor` and the refactor verify re-runs.
101
+ - `qa-gatekeeper` `REVISE` rejecting the **cycle** (the RED never failed, or
102
+ failed for the wrong reason) — that member takes the `refactor -> red` QA
103
+ rejection recovery, cites the verdict in `Evidence`, and re-runs its
104
+ micro-cycle. The group stays open and is reviewed again on close. Leaving it
105
+ in `refactor` instead would strand it: forward-only means it could never
106
+ redo the RED the gatekeeper rejected.
107
+ - **Checkpoint, then the ledger write.** Reviews passing is not the last gate:
108
+ `SKILL.md` Refactor step 5 and item 11 of the 11-point gate both require
109
+ checkpoint verification to pass **before** a row becomes `done`. Run it once
110
+ for the group after the three reviews return PASS, and only then transition
111
+ every member `refactor -> done` in the same ledger write. A failing checkpoint
112
+ leaves the whole group in `refactor` — no member goes `done` on a regression
113
+ the checkpoint would have caught.
114
+ - A group left open when the run ends is a completion prohibition: rows still in
115
+ `refactor` already block spec-level completion.
116
+
117
+ ## Multi-spec queue
118
+
119
+ Auto-discovery may accept **several** specs and process them **one spec at a
120
+ time**, in the order the user confirms. This is a queue, not parallelism: the
121
+ one-spec-at-a-time and one-item-at-a-time constraints are unchanged. It removes
122
+ the "invoke the skill eight times by hand" tax without touching the parallelism
123
+ question.
124
+
125
+ ### Advancing the queue
126
+
127
+ The queue is only a queue if the skill walks it. Record the confirmed order
128
+ once, then after each ledger:
129
+
130
+ 1. Close the spec normally — report its result, and satisfy the spec completion
131
+ conditions or report the blockers. `exception` rows do not stop the queue;
132
+ they are reported with their DR-IDs and carried into the final summary.
133
+ 2. Look at the remaining queue. **Empty -> exit.** Otherwise announce the next
134
+ `spec-id`, load its `test-list.md`, and restart at Phase: Red.
135
+ 3. "Report and exit" in CRITICAL CONSTRAINTS applies per ledger, not per run: a
136
+ ledger whose rows are all `done` yields "nothing to do" **for that spec** and
137
+ the queue advances past it rather than ending the run.
138
+ 4. Exit only after the last queued spec, with a summary naming every processed
139
+ spec and its outcome.
140
+
141
+ A queue entry is never skipped silently: a spec that cannot be started (missing
142
+ ledger, unresolved Change Request) is reported as blocked and the queue moves
143
+ on to the next entry.
144
+
145
+ ## Cost visibility
146
+
147
+ Before starting, state the implied cost: rows × gate cycles at the derived
148
+ tiers. If the ledger exceeds ~50 rows, surface that number to the user before
149
+ processing begins, and offer T1 batching explicitly.
@@ -38,7 +38,7 @@ One final prototype satisfying the spec under a locked brand identity, with all
38
38
  - `references/design-md-spec.md` — DESIGN.md front-matter schema and
39
39
  validation rules
40
40
  - `templates/DESIGN.md.sample` — reference content shipped at the
41
- consuming-project root by `qfai init`
41
+ consuming-project root by `npx qfai init`
42
42
 
43
43
  ## Required Contracts
44
44
 
@@ -60,13 +60,13 @@ current `DESIGN.md` hash does not match the lock.
60
60
  strict `surface_type: ui-bearing` frontmatter + matching
61
61
  `.qfai/contracts/ui/<spec-id>*.yaml`, with legacy title-marker and
62
62
  `qfai.config.yaml` `prototyping` pinning folded in. Run
63
- `qfai doctor --profile prototyping` to surface the resolved value.
63
+ `npx qfai doctor --profile prototyping` to surface the resolved value.
64
64
  Zero UI-bearing specs at cycle 0 is a deterministic no-op exit `0`.
65
65
  Confirm each resolved spec has a supported `surface`.
66
66
  - Confirm root `DESIGN.md` and `.qfai/contracts/design/DESIGN.md.lock.yaml`
67
67
  both exist; confirm `.qfai/contracts/ui/*.yaml` exists.
68
- - Run `qfai prototyping preflight --target-url <url>` (alias for
69
- `qfai doctor --profile prototyping`) — verifies DESIGN.md parses and
68
+ - Run `npx qfai prototyping preflight --target-url <url>` (alias for
69
+ `npx qfai doctor --profile prototyping`) — verifies DESIGN.md parses and
70
70
  matches the lock sha256.
71
71
 
72
72
  ### Step 2-B — Verify Environment Preconditions
@@ -74,13 +74,14 @@ current `DESIGN.md` hash does not match the lock.
74
74
  - Confirm a capture route exists for each declared screen.
75
75
  - Canonical launcher: `npx --no-install playwright` or
76
76
  `node_modules/.bin/playwright` when PATH reachability is uncertain.
77
- - Legacy fallback (deprecation window only, emits
78
- `D-DEPRECATED-PROBE` and will be removed in a future minor release):
79
- `npx --no-install playwright-cli` or `node_modules/.bin/playwright-cli`.
77
+ - `playwright-cli` was the legacy fallback. Its deprecation window closed:
78
+ `browserTool: "playwright-cli"` is now rejected by config load and
79
+ `D-DEPRECATED-PROBE` reports `error`. Install `playwright`
80
+ (`npm i -D playwright`) rather than reaching for it.
80
81
 
81
82
  ### Step 2-B.1 — Opt-in iterate flags
82
83
 
83
- Three flags extend `qfai prototyping iterate`; all default OFF so the
84
+ Three flags extend `npx qfai prototyping iterate`; all default OFF so the
84
85
  prior invocation pattern is byte-equivalent when no flag is passed:
85
86
 
86
87
  - `--capture` — enable PNG / HTML capture per screen each cycle via
@@ -90,7 +91,13 @@ prior invocation pattern is byte-equivalent when no flag is passed:
90
91
  - `--auto-serve` — start an in-process `node:http` server rooted at
91
92
  the prototype tree for the cycle. SIGINT teardown <= 2 s;
92
93
  EADDRINUSE on a foreign owner exits 2 (no foreign-process kill).
93
- Use when no external dev server is running.
94
+ Use when no external dev server is running. Routing is SPA-style:
95
+ a document request (GET/HEAD with `text/html` in `Accept`) that
96
+ matches no file on disk is served `index.html`, so client-side and
97
+ parameterized contract routes (`/overview`,
98
+ `/pairs/:instrument`) resolve instead of 404-ing. Sub-resource
99
+ requests (`.css`, `.png`, `fetch()`) still 404 when genuinely
100
+ missing, and the path-traversal 403 guard runs first.
94
101
  - `--check-convergence` — read-only peek of `prototyping.json`.
95
102
  Exits `0` when converged (`stopReason === "axes-exceptional"` with
96
103
  `acceptedIterationIndex` set), exits `2` otherwise. No writes,
@@ -100,9 +107,9 @@ prior invocation pattern is byte-equivalent when no flag is passed:
100
107
 
101
108
  | Step | Actor | Action | Output |
102
109
  | ----- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
103
- | C0 | product-experience-architect | `qfai prototyping iterate --cycle 0 --target-url <url>`. CLI computes `sha256(DESIGN.md)`; lock match enforced. Generator reads contracts + `references/generator-prompt.md` + DESIGN.md tokens and writes `.qfai/prototypes/iter-00/index.html`. Capture + review → `iter-00/review.json`. Append entry; commit `prototyping: iter-00`. | iter-00, prototyping.json#designMdSha256 |
104
- | C1..9 | (a) devops, (b) reviewer, (c) orchestrator, (d) generator | (a) playwright-cli writes `iter-NN/<screen>.{png,html}`; (b) reviewer writes `iter-NN/review.json` per `references/reviewer-prompt.md` (4 UX axes ordinal, 200..500 word critique, `layoutAntiPatternsDetected[]`, `designMdViolations[]`, `pivotDirective`); (c) update `prototyping.json#iterations[]` + `progress.md`, commit `prototyping: iter-NN`; (d) `qfai prototyping iterate --cycle <n+1>` decides exit. After C9 do NOT call `--cycle 10` — the CLI rejects out-of-range cycles. See the "Cycle 9 budget exhaustion" subsection below for recovery. | iter-NN, exit ∈ {0, 64, 65, 66, 2} |
105
- | H | orchestrator | Mirror latest to `.qfai/prototypes/final/index.html`. Per `references/handoff.md`: write `design-system.yaml` (deterministic DESIGN.md token mirror, no HTML extraction) + `prototype-handoff.yaml`. Run `qfai validate --profile prototyping --fail-on error` (produces `validate.json` with `counts.error === 0`), then `/qfai-verify` (produces `verify.json` with `status === "PASS"`), then `qfai prototyping certify` — certify requires both gate files to be present and passing before it will seal the certificate. | DONE |
110
+ | C0 | product-experience-architect | `npx qfai prototyping iterate --cycle 0 --target-url <url>`. CLI computes `sha256(DESIGN.md)`; lock match enforced. Generator reads contracts + `references/generator-prompt.md` + DESIGN.md tokens and writes `.qfai/prototypes/iter-00/index.html`. Capture + review → `iter-00/review.json`. Append entry; commit `prototyping: iter-00`. | iter-00, prototyping.json#designMdSha256 |
111
+ | C1..9 | (a) devops, (b) reviewer, (c) orchestrator, (d) generator | (a) playwright writes `iter-NN/<screen>.{png,html}`; (b) reviewer writes `iter-NN/review.json` per `references/reviewer-prompt.md` (4 UX axes ordinal, 200..500 word critique, `layoutAntiPatternsDetected[]`, `designMdViolations[]`, `pivotDirective`); (c) update `prototyping.json#iterations[]` + `progress.md`, commit `prototyping: iter-NN`; (d) `npx qfai prototyping iterate --cycle <n+1>` decides exit. After C9 do NOT call `--cycle 10` — the CLI rejects out-of-range cycles. See the "Cycle 9 budget exhaustion" subsection below for recovery. | iter-NN, exit ∈ {0, 64, 65, 66, 2} |
112
+ | H | orchestrator | Mirror latest to `.qfai/prototypes/final/index.html`. Per `references/handoff.md`: write `design-system.yaml` (deterministic DESIGN.md token mirror, no HTML extraction) + `prototype-handoff.yaml`. Run `npx qfai validate --profile prototyping --fail-on error` (produces `validate.json` with `counts.error === 0`), then `/qfai-verify` (produces `verify.json` with `status === "PASS"`), then `npx qfai prototyping certify` — certify requires both gate files to be present and passing before it will seal the certificate. | DONE |
106
113
 
107
114
  **Exit codes**: `0` continue (read `pivotDirective`); `64` convergence (4
108
115
  axes `exceptional` AND `layoutAntiPatternsDetected` empty AND
@@ -117,7 +124,7 @@ covers `frozenSurfaceUnion` / `frozenLicenseCatalog` drift on cycle ≥ 1).
117
124
 
118
125
  ### License-verify hard-stop (exit 66)
119
126
 
120
- `qfai prototyping iterate` exits `66` when an `imageSources[]` entry on
127
+ `npx qfai prototyping iterate` exits `66` when an `imageSources[]` entry on
121
128
  `prototyping.json` violates the cycle-0 frozen license catalog. The
122
129
  verifier rejects five distinct error codes:
123
130
 
@@ -142,18 +149,28 @@ Recovery path (no in-loop retry — the verifier is fail-closed):
142
149
 
143
150
  If convergence is not reached at iter-09, certify rejects the run; H
144
151
  handoff artifacts and `validate` / `/qfai-verify` can still execute for
145
- inspection, but `qfai prototyping certify --check` will exit non-zero
152
+ inspection, but `npx qfai prototyping certify --check` will exit non-zero
146
153
  and prevent DONE.
147
154
 
148
- Use `qfai prototyping iterate --cycle 9 --check-convergence` for a
155
+ Use `npx qfai prototyping iterate --cycle 9 --check-convergence` for a
149
156
  read-only peek of `prototyping.json` before refreezing: exit `0`
150
157
  confirms convergence (no recovery needed), exit `2` confirms the run
151
158
  did not converge. Recovery: review `DESIGN.md`, the pivot strategy
152
159
  in `references/reviewer-prompt.md`, and the latest `review.json`
153
- findings, then re-run `qfai prototyping iterate --cycle 0
160
+ findings, then re-run `npx qfai prototyping iterate --cycle 0
154
161
  --target-url <url>` to refreeze. Do not seal a certificate against
155
162
  an unconverged iter-09.
156
163
 
164
+ ### Continuing or resetting a converged loop
165
+
166
+ Only `stopReason: "axes-exceptional"` + `acceptedIterationIndex` seals a loop; `iterate --cycle N`
167
+ then refuses with exit `2` past the accepted index, writing nothing. `license-verify-fail` /
168
+ `input-error` do NOT seal — fix the cause and re-run the same cycle.
169
+ `max-iterations` does not seal either, but iter-09 still stops every `--cycle N >= 1` at exit `65`.
170
+ Recovery for both is the cycle-0 reset; re-running the accepted cycle is reported by the convergence
171
+ gate (exit `64`) and writes nothing, so it is a state read, not a rerun. The reset command, the
172
+ `--force` requirement and the `certify` alternative are in `references/iteration-loop.md#sealed-loop`.
173
+
157
174
  ## Evaluator Inputs (Mandatory)
158
175
 
159
176
  - Screenshot evidence path: `.qfai/evidence/prototyping/iter-NN/<screen>.png`
@@ -171,7 +188,7 @@ an unconverged iter-09.
171
188
  - Token-only colors / fonts / radii / shadows — non-DESIGN.md hex /
172
189
  rgb / rgba / hsl / font / radius / shadow values land in
173
190
  `designMdViolations[]` and block exit 64.
174
- - DONE only when `qfai prototyping certify --check` returns 0.
191
+ - DONE only when `npx qfai prototyping certify --check` returns 0.
175
192
  - No `mode / round / polish / branch / concept-fit` artifacts.
176
193
 
177
194
  ## Delegation Scope Table
@@ -192,7 +209,7 @@ an unconverged iter-09.
192
209
  ## Completion
193
210
 
194
211
  DONE = `completion-certificate.json` exists AND
195
- `qfai prototyping certify --check` returns 0 AND `/qfai-verify` returns
212
+ `npx qfai prototyping certify --check` returns 0 AND `/qfai-verify` returns
196
213
  PASS.
197
214
 
198
215
  Follow `.qfai/assistant/constitution/shared-skill-operating-baseline.md#gate-failure-autorepair-protocol` for validate, doctor, and quality-gate failures.
@@ -3,7 +3,7 @@
3
3
  Prototyping evidence files MUST include a `taskFidelity` section so the
4
4
  `QFAI-CRIT-009` gate passes. Below is the required keyword set and
5
5
  the canonical markdown shape consumed by the validator and the
6
- `qfai prototyping iterate --capture` template emitter.
6
+ `npx qfai prototyping iterate --capture` template emitter.
7
7
 
8
8
  ## Required keywords
9
9