qfai 2.4.0 → 2.5.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 (163) hide show
  1. package/README.md +24 -16
  2. package/assets/defaults/workflows/apply-settled.yml +2 -0
  3. package/assets/defaults/workflows/decide-design.yml +1 -6
  4. package/assets/defaults/workflows/decompose-epic.yml +1 -1
  5. package/assets/init/.claude/settings.json +1 -1
  6. package/assets/init/.qfai/assistant/agent/architecture-reviewer.md +1 -0
  7. package/assets/init/.qfai/assistant/agent/fullstack-engineer.md +6 -9
  8. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +9 -1
  9. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +70 -4
  10. package/assets/init/.qfai/assistant/agent/requirements-reviewer.md +1 -0
  11. package/assets/init/.qfai/assistant/rule/constitution.md +3 -2
  12. package/assets/init/.qfai/assistant/rule/drift-protocol.md +5 -5
  13. package/assets/init/.qfai/assistant/rule/references/deliberation-record-template.md +23 -0
  14. package/assets/init/.qfai/assistant/rule/references/deliberation-record.md +36 -0
  15. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +3 -3
  16. package/assets/init/.qfai/assistant/rule/references/launcher-preflight.md +27 -0
  17. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +9 -0
  18. package/assets/init/.qfai/assistant/rule/references/reviewer-remit.md +23 -15
  19. package/assets/init/.qfai/assistant/rule/references/visual-reference-survey.md +146 -0
  20. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +2 -0
  21. package/assets/init/.qfai/assistant/rule/research-first-protocol.md +49 -11
  22. package/assets/init/.qfai/assistant/rule/review-convergence.md +15 -16
  23. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +3 -0
  24. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +13 -25
  25. package/assets/init/.qfai/assistant/rule/test-layers.md +8 -0
  26. package/assets/init/.qfai/assistant/rule/thinking.md +10 -5
  27. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +4 -4
  28. package/assets/init/.qfai/assistant/rule/ui-procurement.md +50 -10
  29. package/assets/init/.qfai/assistant/rule/workflow.md +4 -3
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -1
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +22 -56
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/design-dna-intake.md +11 -14
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-coverage-checklist.md +1 -1
  34. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +6 -4
  35. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/discussion-delegation.md +46 -0
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/glossary-check.md +23 -0
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-check.md +25 -0
  38. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +12 -1
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +2 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +47 -8
  41. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +2 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +1 -1
  43. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +6 -2
  44. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +6 -9
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +24 -15
  46. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +2 -2
  47. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +2 -1
  48. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +7 -3
  49. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +4 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/business-ui-patterns.md +180 -0
  51. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +14 -3
  52. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +14 -3
  53. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +39 -24
  54. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-brand-catalog.md +2 -2
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/marketing-ui-patterns.md +194 -0
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +27 -3
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -22
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +3 -3
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -4
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +4 -2
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +6 -6
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +87 -4
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +6 -7
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/api-contract.sample.yaml +3 -0
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/db-contract.sample.sql +3 -0
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +40 -1
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/report/preflight_summary.md +10 -16
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/01_policy/constraint.md +10 -0
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/01_policy/initiative.md +5 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -0
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +8 -2
  73. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +4 -0
  74. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +4 -2
  75. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +2 -1
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +4 -1
  77. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +11 -8
  78. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +1 -1
  79. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +25 -60
  80. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +18 -6
  81. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +45 -95
  82. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +11 -13
  83. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -2
  84. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +52 -8
  85. package/assets/init/.qfai/assistant/step/implement-settled-edit/STEP.md +78 -0
  86. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +3 -3
  87. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +20 -2
  88. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -0
  89. package/assets/init/.qfai/assistant/step/prototyping-handoff/STEP.md +3 -2
  90. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +6 -1
  91. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +58 -11
  92. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +41 -27
  93. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +2 -1
  94. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +43 -26
  95. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +8 -3
  96. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +12 -6
  97. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -1
  98. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +36 -6
  99. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +2 -0
  100. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +3 -1
  101. package/assets/init/.qfai/assistant/step/verify-context/STEP.md +3 -3
  102. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +11 -3
  103. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +22 -0
  104. package/assets/init/root/.agents/rules/delegation-steering.md +4 -2
  105. package/assets/init/root/.agents/rules/distributed-surface.md +1 -1
  106. package/assets/init/root/.agents/rules/grilling.md +28 -76
  107. package/assets/init/root/.agents/rules/interface-clarity.md +98 -6
  108. package/assets/init/root/.gitattributes +7 -5
  109. package/assets/init/root/.github/workflows/qfai-docs.yml +1 -1
  110. package/assets/init/root/qfai.config.yaml +1 -1
  111. package/assets/mdschema/story/01_policy/constraint.mdschema.yml +46 -2
  112. package/assets/mdschema/story/01_policy/initiative.mdschema.yml +18 -0
  113. package/assets/mdschema/story/03_contract/tech.mdschema.yml +5 -2
  114. package/assets/uix-rev/strategy-review.md +1 -1
  115. package/dist/cli/index.cjs +3787 -7097
  116. package/dist/cli/index.cjs.map +1 -1
  117. package/dist/cli/index.mjs +3647 -6970
  118. package/dist/cli/index.mjs.map +1 -1
  119. package/dist/graph/cli.cjs +966 -222
  120. package/dist/graph/cli.cjs.map +1 -1
  121. package/dist/graph/cli.mjs +942 -198
  122. package/dist/graph/cli.mjs.map +1 -1
  123. package/dist/graph/hook.cjs +999 -88
  124. package/dist/graph/hook.cjs.map +1 -1
  125. package/dist/graph/hook.mjs +996 -85
  126. package/dist/graph/hook.mjs.map +1 -1
  127. package/dist/hook/turn-end.cjs +15 -45
  128. package/dist/hook/turn-end.cjs.map +1 -1
  129. package/dist/hook/turn-end.mjs +15 -45
  130. package/dist/hook/turn-end.mjs.map +1 -1
  131. package/dist/index.cjs +15398 -18327
  132. package/dist/index.cjs.map +1 -1
  133. package/dist/index.d.cts +32 -41
  134. package/dist/index.d.ts +32 -41
  135. package/dist/index.mjs +19276 -22214
  136. package/dist/index.mjs.map +1 -1
  137. package/package.json +2 -2
  138. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-artifact-rules.md +0 -53
  139. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +0 -133
  140. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/example-mapping-guide.md +0 -18
  141. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/oq-and-deferred-rules.md +0 -84
  142. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +0 -95
  143. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/platform_baselines.md +0 -118
  144. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/review_audit_playbook.md +0 -115
  145. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/trend_scan_playbook.md +0 -81
  146. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +0 -184
  147. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/01_Context.md +0 -143
  148. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/03_Story-Workshop.md +0 -104
  149. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/04_Sources.md +0 -276
  150. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/05_Scope.md +0 -36
  151. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/06_REQ.md +0 -26
  152. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/07_NFR.md +0 -24
  153. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/08_Glossary.md +0 -23
  154. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/09_Constraints.md +0 -60
  155. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/11_OQ-Register.md +0 -38
  156. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/prototyping.yaml +0 -8
  157. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -35
  158. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/40_screen_contracts.md +0 -62
  159. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/50_review_input_bundle.md +0 -38
  160. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +0 -70
  161. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +0 -199
  162. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +0 -82
  163. package/assets/uix-rev/contracts-review.md +0 -27
package/README.md CHANGED
@@ -181,16 +181,15 @@ QFAI includes a small set of custom skills (stored under `.qfai/assistant/skill/
181
181
  - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure)
182
182
  and adjust `qfai.config.yaml` accordingly (especially `testFileGlobs`).
183
183
  Run this once right after `npx qfai init`, and re-run it when the repository structure changes.
184
- - **qfai-discussion**: Run a unified structured discussion that produces and maintains the latest discussion pack
185
- as 15 required markdown files under `.qfai/discussion/discussion-<ts>/`.
186
- Discussion packs with a visual prototyping surface (`web`, `mobile`, `desktop`, `mixed`)
187
- may include `prototyping.yaml` as an optional recommendation artifact;
188
- cli-only packs omit it, and non-ui discussion packs typically omit it.
184
+ - **qfai-discussion**: Research and interview the user to settle the scope of an idea. It writes the
185
+ questions, answers and agent decisions to the run's deliberation record under
186
+ `paths.deliberationDir` (`.qfai/deliberation/` by default), a tracked memo nothing cites, and the
187
+ questions it leaves open to `open-questions.md`.
189
188
  - **qfai-sdd**: Triage requirements against the existing story tree. Write
190
189
  policy, business flows, stories with AC and EX, then enforcing contracts with
191
190
  BR. Record decisions that meet the recording test (hard to reverse,
192
191
  surprising without context, a real trade-off) and unresolved questions in
193
- the two root tables. The discussion pack is input; the story tree is the execution SSOT.
192
+ the two root tables. The deliberation record is input; the story tree is the execution SSOT.
194
193
  - **qfai-prototyping**: Build and review every UI-bearing contract and its
195
194
  screens with the user, one iteration at a time, until the user confirms the
196
195
  prototype. No command certifies it. The loop's files stay under
@@ -370,6 +369,14 @@ flowchart LR
370
369
  transcripts are looked for. Exit codes: 0 (a report, or no session found), 2 (a usage error, or
371
370
  `--session` names no session of the project), 1 (a transcript, `.agents/rules/reminders.json`
372
371
  or the `--out` file could not be read or written, or `reminders.json` is not a JSON object).
372
+ - `npx qfai catalog components`
373
+ - Writes `components.yaml` under `.qfai/catalog/`, the list of components the `.tsx` and `.jsx` files
374
+ `uiux.surfacePaths` selects export: each with its file, its props, and the `@source`, `@reason`,
375
+ `@states`, `@pattern` and `@a11y` tags of its doc comment. The file is sorted and byte-stable, so
376
+ commit it. `--check` writes nothing and exits 1 when the committed file is missing or out of date.
377
+ It reads JSX with the project's own `typescript`. Once the file exists, `qfai validate` warns about
378
+ a component with no source, two components for one pattern, a raw `<button>`, `<input>` or
379
+ `<select>` a listed component replaces, and a stale catalogue (`QFAI-COMP-001` to `QFAI-COMP-004`).
373
380
  - `npx qfai workflow plan`
374
381
  - The route planning behind the free-text entry. `--in <path>`, or `--in -` for standard input,
375
382
  reads a request's extraction; `--route <route>` names a route instead. It prints one JSON
@@ -378,19 +385,20 @@ flowchart LR
378
385
  Exit codes: 0 (a plan or candidates), 2 (input refused), 1 (the `--in` file cannot be read, or a
379
386
  shipped plan does not load).
380
387
  - `npx qfai sdd preflight`
381
- - Runs the Stage 0 gate of `/qfai-sdd`: selects the active discussion pack, counts the imported `REQ-*`,
382
- resolves the blockers, and writes the summary run-scoped at
383
- `<paths.outDir>/preflight/run-<timestamp>/preflight_summary.md`
388
+ - Runs the Stage 0 gate of `/qfai-sdd`: selects the source, resolves the blockers, and writes the summary
389
+ run-scoped at `<paths.outDir>/preflight/run-<timestamp>/preflight_summary.md`
384
390
  (`.qfai/report/preflight/run-<timestamp>/preflight_summary.md` by default; the run reports the path it wrote),
385
391
  then refreshes `<paths.outDir>/preflight_summary.md` as the latest-run pointer. Exits 1 when the result is
386
392
  `blocked` (use `--fail-on never` to report without failing); `--format json` emits the machine-readable
387
393
  result on stdout.
388
- - Only a missing or misnamed pack blocks. What a present pack lacks or contradicts is listed under the
389
- summary's `## Pack Gaps` (`packGaps` in the JSON result), and the result stays `ready`: the pack is
390
- reference material, so the gap is recorded in the SDD artifacts rather than stopping the stage.
391
- - The pack is the one `npx qfai discussion use <id>` pinned (`.qfai/state.json#discussion.currentId`); the
392
- newest pack is used only when no pointer is set. A pointer that matches no pack on disk stops the run with
393
- the candidate list instead of silently gating a different pack.
394
+ - The source is the deliberation record `--record <path>` names: the run's own record, the one the work
395
+ order names, or the one the user names. A bare record name is read against `paths.deliberationDir` first,
396
+ then the project root; a name with a path separator is read against the project root. Without
397
+ `--record`, the source is the imported specification `--import <path>` names.
398
+ - With neither, the result is `blocked`, and the blocker lists the records under `paths.deliberationDir`
399
+ without choosing one. A named file that cannot be read also blocks. The next command is
400
+ `qfai sdd preflight --record <path>` when records exist, and `/qfai-discussion` when there are none. A record that leaves a question open
401
+ or contradicts itself is still `ready`: SDD states each gap in its report.
394
402
  - `--assume <text>` (repeatable) records carry-over open questions / assumptions in the summary. Without it
395
403
  the carry-over list already present in the `<paths.outDir>/preflight_summary.md` pointer is preserved, not
396
404
  overwritten.
@@ -422,7 +430,7 @@ Example: override paths and traceability globs.
422
430
  paths:
423
431
  contractsDir: .qfai/spec/03_contract
424
432
  specsDir: .qfai/spec
425
- discussionDir: .qfai/discussion
433
+ deliberationDir: .qfai/deliberation
426
434
  outDir: .qfai/report
427
435
  skillsDir: .qfai/assistant/skill
428
436
  srcDir: src
@@ -11,9 +11,11 @@ stages:
11
11
  - id: implement
12
12
  kind: implement
13
13
  steps:
14
+ - { step: implement-settled-edit, passThrough: true }
14
15
  - { step: implement-scaffold, passThrough: true }
15
16
  - { step: implement-tdd, passThrough: true }
16
17
  after: [spec]
18
+ serves: [release]
17
19
  - id: note
18
20
  kind: verify
19
21
  steps:
@@ -3,12 +3,7 @@ family: decide
3
3
  stages:
4
4
  - id: discussion
5
5
  kind: discussion
6
- steps:
7
- - discussion-research
8
- - discussion-interview
9
- - { step: discussion-pack, passThrough: true }
10
- - { step: discussion-uiux, passThrough: true }
11
- - discussion-oq
6
+ steps: [discussion-research, discussion-interview]
12
7
  - id: close
13
8
  kind: triage
14
9
  steps: [triage-close]
@@ -3,7 +3,7 @@ family: decide
3
3
  stages:
4
4
  - id: discussion
5
5
  kind: discussion
6
- steps: [discussion-research, discussion-interview, discussion-pack, discussion-oq]
6
+ steps: [discussion-research, discussion-interview]
7
7
  - id: split
8
8
  kind: triage
9
9
  steps: [triage-decompose]
@@ -62,7 +62,7 @@
62
62
  "command": "node",
63
63
  "args": [
64
64
  "-e",
65
- "try{const f=require('fs'),p=require('path');let c;try{c=JSON.parse(f.readFileSync(0,'utf8')).cwd}catch{}let e=typeof c==='string'&&c!==''?p.resolve(c):p.dirname(p.dirname(p.dirname(process.argv[1]))),ok=0;for(;;){if(f.existsSync(p.join(e,'node_modules','.bin','qfai'))){ok=1;break}if(f.existsSync(p.join(e,'.pnp.cjs'))){try{const j=JSON.parse(f.readFileSync(p.join(e,'package.json'),'utf8'));if((j.dependencies||{}).qfai||(j.devDependencies||{}).qfai){ok=1;break}}catch{}}if(f.existsSync(p.join(e,'.git')))break;const u=p.dirname(e);if(u===e)break;e=u}if(ok===0){const m=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(m!==undefined)console.log(JSON.stringify(m))}}catch{}",
65
+ "try{const f=require('fs'),p=require('path');let c,q;try{const i=JSON.parse(f.readFileSync(0,'utf8'));c=i.cwd;q=i.prompt}catch{}let e=typeof c==='string'&&c!==''?p.resolve(c):p.dirname(p.dirname(p.dirname(process.argv[1]))),ok=typeof q==='string'&&/^[ \\t]*(<(task-notification|wake|ci-monitor-event)[\\s>]|\\[SYSTEM NOTIFICATION)/m.test(q)?2:0;for(;ok===0;){if(f.existsSync(p.join(e,'node_modules','.bin','qfai'))){ok=1;break}if(f.existsSync(p.join(e,'.pnp.cjs'))){try{const j=JSON.parse(f.readFileSync(p.join(e,'package.json'),'utf8'));if((j.dependencies||{}).qfai||(j.devDependencies||{}).qfai){ok=1;break}}catch{}}if(f.existsSync(p.join(e,'.git')))break;const u=p.dirname(e);if(u===e)break;e=u}if(ok===0){const m=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(m!==undefined)console.log(JSON.stringify(m))}}catch{}",
66
66
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
67
67
  "qfai-not-installed"
68
68
  ]
@@ -80,6 +80,7 @@ specialization_tags:
80
80
  - [ ] Review verdict is explicit
81
81
  - [ ] Findings cite concrete artifacts or evidence
82
82
  - [ ] Required gates and residual risks are recorded
83
+ - [ ] Every Domain Responsibility on this card was checked, or named as not applicable to the target, whatever the request's focus
83
84
 
84
85
  ## When to use
85
86
 
@@ -76,15 +76,12 @@ specialization_tags:
76
76
  `npx qfai validate` reports, as an error, a plain text in UI source that no reason
77
77
  comment directly precedes. Plain text is a literal text node outside a heading,
78
78
  label, button, link, legend, table header, caption, option, summary, title,
79
- script, style and `role="alert"` or `role="status"`. For a text you cannot
80
- justify, in this order:
81
-
82
- 1. Delete it.
83
- 2. Replace it with another component: an icon with an accessible name, a
84
- disabled state, a badge.
85
- 3. Move its job to an element already there: a label, a heading, the button
86
- wording, the empty state.
87
- 4. Only then write the reason, directly before the text or its element.
79
+ script, style and `role="alert"` or `role="status"`. Decide each text as
80
+ `.qfai/assistant/skill/qfai-implement/references/ui-affecting.md`
81
+ `## Plain text in UI source` says: a text the user needs, such as a result, a
82
+ cost, a consequence or an empty state's next step, stays with its reason,
83
+ directly before the text or its element; any other text is first deleted,
84
+ replaced or moved, and kept with a reason only when none of those works.
88
85
 
89
86
  ```html
90
87
  <!-- qfai-text: why=the fee is charged only on this step; without=users pay a fee they never saw -->
@@ -37,6 +37,10 @@ specialization_tags:
37
37
  a necessary fix and reporting requirement, and states any assumption it built
38
38
  on (`.qfai/assistant/rule/test-layers.md#test-suite-sizing`,
39
39
  `.agents/rules/minimal-implementation.md` § 4).
40
+ - When the change adds or edits a rule master under `.agents/rules/`, read every
41
+ rule the changed master points to and every rule that points to that master,
42
+ and report as a finding each clause that gives a different answer to the same
43
+ situation.
40
44
  - Check each new module against the `## Architecture` table of `<paths.contractsDir>/tech.md`: it belongs to one layer and imports only from the layers its row lists. A crossing is a finding.
41
45
  - In TypeScript, flag unjustified assertions, unchecked `unknown`, needless generic complexity and promises that callers neither await nor return.
42
46
  - Read the whole of every file the change touches for silent failure and type design, not only the lines the change adds or alters.
@@ -57,7 +61,7 @@ specialization_tags:
57
61
  unsafe deserialization and path traversal. Judge validation at a trust boundary against `.agents/rules/minimal-implementation.md` § 2.
58
62
  - Follow every input the change adds or alters to where it is used, across files the change did not touch.
59
63
  A path the change opens there, such as an insecure direct object reference, a server-side request forgery or an auth bypass reached through several files, blocks.
60
- This is the one reach beyond the touched files, and it covers only the inputs the change handles.
64
+ Besides the rules a changed rule master links to, this is the one reach beyond the touched files, and it covers only the inputs the change handles.
61
65
  A security finding the review demonstrates traces to `defect:security`.
62
66
  - Check the EX test's oracle, selector and RED/GREEN/Refactor evidence.
63
67
  - When the change adds, moves or copies an AC or EX annotation, read the annotated test's body and confirm that it asserts the example's observable outcome,
@@ -69,6 +73,8 @@ specialization_tags:
69
73
  (`.qfai/assistant/rule/test-layers.md#a-passing-test-is-not-the-solution`).
70
74
  - Require more work only under `rule/shared-skill-delegation-baseline.md#what-a-reviewer-may-demand-more-of`. Send new scope to the SDD owner as advisory.
71
75
  - Apply `rule/ui-procurement.md` to UI changes and report a usable standard or component that was passed over.
76
+ A control hand-built where the catalogue the `Component catalogue` row of `<paths.contractsDir>/tech.md#stack` names has one
77
+ is such a finding: name the catalogue item.
72
78
 
73
79
  ## Coverage gate
74
80
 
@@ -148,6 +154,7 @@ command.
148
154
  - `qfai.config.yaml` and the affected BF/US/AC/EX story files under `<paths.specsDir>/02_business-flow/**`.
149
155
  - `<paths.specsDir>/03_contract/tech.md`, plus the active API, DB or UI contracts this change affects.
150
156
  - The changed code and tests, their diff, repository review instructions, and actual quality-gate results.
157
+ - For a change to a rule master under `.agents/rules/`, the rules it points to and the files that point to it.
151
158
  - The stage report for the reviewed EX: its test, selector and observed results. A missing required observation prevents PASS.
152
159
  A `ci-deferred` Red or Green is not a missing observation: read the test against the code before the fix instead,
153
160
  as `.qfai/assistant/skill/qfai-implement/references/red-admissibility.md#ci-only-test-gate` states.
@@ -178,6 +185,7 @@ command.
178
185
  - [ ] Findings cite concrete artifacts or evidence
179
186
  - [ ] Every finding declares `Severity:` and `Traces to:`; no blocking finding traces to `none` or `record:*`
180
187
  - [ ] Required gates and residual risks are recorded
188
+ - [ ] Every Domain Responsibility on this card was checked, or named as not applicable to the target, whatever the request's focus
181
189
 
182
190
  ## When to use
183
191
 
@@ -37,7 +37,7 @@ specialization_tags:
37
37
  - Audit frontend changes for correctness and user-facing risk.
38
38
  - Audit layout sanity, interaction usability, and accessibility guardrails.
39
39
  - Audit visual design, token alignment, and service-level UX coherence.
40
- - Reconcile sidecar artifacts (screen contracts), design tokens, mermaid flows, and rendered output consistency.
40
+ - Reconcile the UI contract, design tokens, mermaid flows and rendered output.
41
41
  HTML mock is optional fallback evidence only. Design tokens are supporting input.
42
42
  - For UI implementation, compare rendered output against the prototype handoff, canonical prototype
43
43
  screenshots, HTML snapshots, and the final prototype the handoff's `finalArtifact` names
@@ -50,6 +50,8 @@ specialization_tags:
50
50
  surface framing intent, transition clarity, state coverage, or component character captured by the winning
51
51
  prototype.
52
52
  - Review UI changes at the surface layer: avoid needless states, controls, flows, animations, and configuration that are not justified by the product goal.
53
+ A part the business-screen floor in `.agents/rules/interface-clarity.md` requires of that screen, and the UI
54
+ contract does not exclude, is never needless; how it is built can still be excess.
53
55
  - Check naming, structure, and responsibility split of UI components for clarity, cohesion, and minimal surprise.
54
56
  - Validate docs/UX consistency so usage text, labels, error states, and user flows match the intended product behavior.
55
57
  - File excess as `defect:code-quality` against constitution Article VII; tag it
@@ -62,19 +64,79 @@ specialization_tags:
62
64
  Use this route only where the installed Article VII governs the artifact.
63
65
  Otherwise report unsupported Article VII excess as advisory and follow the installed constitution.
64
66
  - Require more work only on what `.qfai/assistant/rule/shared-skill-delegation-baseline.md#what-a-reviewer-may-demand-more-of` admits, and report any other gap as advisory.
67
+ - Check that each application screen is complete, not only that it holds no excess. Walk every part
68
+ `.agents/rules/interface-clarity.md#what-a-business-screen-always-has` lists against the rendered
69
+ surface: the running app, the prototype, or the UI contract when reviewing a specification.
70
+ Walk it for each screen the change adds or alters. Check the once-per-application parts only when
71
+ the change adds or alters the shell, the home or a repeated pattern.
72
+
73
+ A listed part with no reason recorded in the UI contract is a blocking finding that traces to
74
+ `.agents/rules/interface-clarity.md#what-a-business-screen-always-has` when it is missing from a
75
+ screen the change adds, missing from a list, state, action that changes data, shell, home or
76
+ repeated-pattern part the change adds or alters (a new list with no pagination, a new save with no feedback), or removed by the change. The rule
77
+ already makes the part an obligation, so the gap is a defect shown from the changed artifacts
78
+ (`.qfai/assistant/rule/drift-protocol.md#defect-or-new-scope-decide-this-first`), not a demand for
79
+ more work. Name the screen and the missing part. A part the contract leaves out with a reason is
80
+ not a finding. A part that was already missing from an altered screen is `advisory`, and so is a
81
+ part missing elsewhere. Never file the presence of a listed part as excess; how it is built stays
82
+ under the excess route above.
83
+
84
+ - Check each application screen against its type in `.qfai/assistant/skill/qfai-sdd/references/business-ui-patterns.md`.
85
+ A part of that type the UI contract names and the screen lacks is a blocking finding. A part the contract
86
+ neither names nor leaves out with a reason is an `advisory` finding for the contract stage, naming the
87
+ part and the type.
88
+ - Check a screen whose UI contract declares `surface: marketing` against its section entries in
89
+ `.qfai/assistant/skill/qfai-sdd/references/marketing-ui-patterns.md`, not against the business-screen
90
+ list or the business types. Findings follow the same split: a named part missing is blocking, and an
91
+ unnamed one is `advisory` for the contract stage. A state or notice the marketing floor lists that is
92
+ missing from a section, page or sign-up or payment point the change adds or alters, or that the change removes, is a blocking finding
93
+ that traces to `.agents/rules/interface-clarity.md#what-a-marketing-screen-always-has`; one that was
94
+ already missing is `advisory`. Invented proof, an unlabelled example mock-up and an
95
+ image with no recorded source and licence that the change introduces are blocking findings that trace
96
+ to `.agents/rules/interface-clarity.md#what-a-marketing-screen-always-has`; one already on an altered
97
+ page is `advisory`. A claim already on the page, or supplied by the user, that nothing confirms follows
98
+ `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md#claims-nobody-has-confirmed`: it is
99
+ put to the user, not deleted. Another anti-pattern the entry lists is `advisory` unless it breaches that
100
+ rule section. A mock-up labelled as an example under the reference's image rules is not the fake product
101
+ dashboard of `design-anti-patterns.md`, and the reference's entries are kinds of section, not the stock
102
+ section order that list names.
65
103
  - Apply `.qfai/assistant/rule/ui-procurement.md`: report a region that was drawn where a catalogue had it, and name the item that would have served.
104
+ - Where the `Component catalogue` row of `<paths.contractsDir>/tech.md#stack` names a catalogue, report a
105
+ screen that hand-builds a control that catalogue has, and name the catalogue item. A named catalogue that
106
+ the project never installed is one finding against the setup, not one per screen.
66
107
  - Apply `.agents/rules/interface-clarity.md`: report copy that explains the interface as a finding against the control under it, and name the control to fix.
67
- - Judge each `qfai-text` reason comment in the UI source. `npx qfai validate` checks only that a reason
108
+ - Judge each `qfai-text` and `qfai-text-file` reason comment in the UI source; a file reason must hold for every text it covers. `npx qfai validate` checks only that a reason
68
109
  is present and well formed; whether it is strong is this review's finding. Reject a generic reason
69
110
  ("helps the user", "for clarity") and a reason that restates the text. A text that could be deleted,
70
111
  replaced by another component or moved into a label, heading, button wording or empty state is
71
- excess even with a reason.
112
+ excess even with a reason, unless it tells the user a result, a cost, a condition, a consequence, a
113
+ destination, a recovery step or an empty state's next step: such a text stays with its reason. On a
114
+ marketing screen, a part of its section's marketing pattern entry that its UI contract names, such as a
115
+ hero's supporting sentence, a feature's short description or an FAQ answer, is not excess; its wording
116
+ is still judged against
117
+ `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md#copy-that-adds-no-meaning`, so a
118
+ supporting sentence that only restates the headline is still reported.
72
119
  - Judge whether the copy a UI contract describes (`supplements`, group headings) is needed at all.
73
120
  Name the screen, the task or state, the duplicated meaning or unmet need, and the text to remove or the control or structure to repair.
74
121
  Apply `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md#copy-that-adds-no-meaning`.
75
122
  Never cut a condition, cost, destination, result, recovery step, consequence, label, accessible name, role or state,
123
+ or the next step an empty state offers (the action, or a short sentence naming it, that leads out of it, such as widening the search),
76
124
  and never move one into a tooltip or placeholder.
77
125
  Word counts are observations, never a verdict.
126
+ - Check every implemented screen against
127
+ `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md#information-architecture-and-flow`
128
+ and `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md#states-and-accessibility`
129
+ on every review, whether or not an acceptance criterion names the part: a missing loading, empty,
130
+ error or success state, a form that fails silently, a data-heavy screen with no table, the steps of
131
+ one task split across sections, and a control or link that leads nowhere. Name the screen, the
132
+ pattern matched and the state or structure to add. Where the entry is about behaviour, trace the
133
+ finding to `.agents/rules/interface-clarity.md#what-a-business-screen-always-has` or the spec, as
134
+ that list's _Where the list stops_ says; for a marketing screen, trace it to
135
+ `.agents/rules/interface-clarity.md#what-a-marketing-screen-always-has` or the screen's UI contract, with
136
+ the severity the marketing check above sets, and do not report a part whose UI contract records a
137
+ reason for leaving it out. Declare each finding's severity and trace as
138
+ `.qfai/assistant/rule/references/reviewer-findings.md` says. Inside the prototyping loop,
139
+ `.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md` sets which sections apply.
78
140
 
79
141
  ## Inputs you must read
80
142
 
@@ -107,13 +169,17 @@ specialization_tags:
107
169
  - Required evidence, governing specs, or target artifacts are missing.
108
170
  - The request requires implementation or file editing instead of independent review.
109
171
  - The issue falls outside this review domain and must be rerouted to another specialist first.
110
- - The review would approve UI complexity that is not grounded in the current user journey or acceptance criteria.
172
+ - The review would approve configuration, animation or a novel interaction that is not grounded in the current
173
+ user journey or acceptance criteria. The parts in `## What a business screen always has` of
174
+ `.agents/rules/interface-clarity.md`, such as an app shell, list search and pagination, and empty, error and
175
+ success states, are grounded by the pattern itself and need no acceptance criterion.
111
176
 
112
177
  ## Sign-off
113
178
 
114
179
  - [ ] Review verdict is explicit
115
180
  - [ ] Findings cite concrete artifacts or evidence
116
181
  - [ ] Required gates and residual risks are recorded
182
+ - [ ] Every Domain Responsibility on this card was checked, or named as not applicable to the target, whatever the request's focus
117
183
 
118
184
  ## When to use
119
185
 
@@ -82,6 +82,7 @@ specialization_tags:
82
82
  - [ ] Review verdict is explicit
83
83
  - [ ] Findings cite concrete artifacts or evidence
84
84
  - [ ] Required gates and residual risks are recorded
85
+ - [ ] Every Domain Responsibility on this card was checked, or named as not applicable to the target, whatever the request's focus
85
86
 
86
87
  ## When to use
87
88
 
@@ -59,7 +59,7 @@ Before producing deliverables, read **project memory**:
59
59
  `owned_artifacts`, `tool_profile`, `permission_profile`, and
60
60
  `specialization_tags`. Read applicable project policy and contracts under
61
61
  `.qfai/spec/` when they bear on the task.
62
- 3. discussion pack in `.qfai/discussion/` (if present)
62
+ 3. the story tree, `.qfai/spec/decisions.md` and `.qfai/spec/open-questions.md`
63
63
  4. the relevant business flows and stories under `.qfai/spec/02_business-flow/`
64
64
  5. repository config (package.json, CI, scripts)
65
65
 
@@ -245,7 +245,8 @@ Settle it between the agents. A critical decision needs an actual user answer
245
245
  or recorded applicable authorization under
246
246
  `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`; without it,
247
247
  ask when permitted or register it open. A contradiction with the spec is
248
- critical. Nothing is recorded beyond the stage's final report.
248
+ critical. A decision the agents take is an Agent decisions row of the run's
249
+ deliberation record, and no report lists it.
249
250
 
250
251
  **Only one outcome is the Drift Protocol's.**
251
252
 
@@ -12,7 +12,7 @@ of the register; a partial register settles nothing.
12
12
 
13
13
  ## Core rule
14
14
 
15
- A downstream skill does not edit an approved specification, policy, contract, or QFAI-owned rule on its own authority. It records the discrepancy and returns the affected artifact to its owner. A discussion pack is discovery material; the story tree and contracts are the current specification.
15
+ A downstream skill does not edit an approved specification, policy, contract, or QFAI-owned rule on its own authority. It records the discrepancy and returns the affected artifact to its owner. A deliberation record is history; the story tree and contracts are the current specification.
16
16
 
17
17
  Upstream artifacts include the policy and business-flow trees under paths.specsDir, decisions.md,
18
18
  open-questions.md, and every file under paths.contractsDir. Production code and tests that implement an approved
@@ -47,10 +47,10 @@ Both classes use the same decision and owner-rerun path.
47
47
  the evidence or reproduction, the proposed change, the impacted items, and the owner rerun.
48
48
  3. Decide the change. A change that contradicts a specification, a contract or a recorded decision, that cannot
49
49
  be taken back, or that rests on product intent nothing written states is a critical decision: put it to the
50
- user and wait for the answer. The owner takes any other change itself and lists it with its reason in its
51
- report. A decision becomes a decisions.md row only when it is hard to reverse, would surprise a reader
52
- without context, and was the result of a real trade-off; the row takes the short form of the `qfai-sdd`
53
- decisions template. Otherwise the stage report states it. An option the user rejects is a row whose
50
+ user and wait for the answer. The owner takes any other change itself and writes it, with its reason, as
51
+ an Agent decisions row of the run's deliberation record. A decision becomes a decisions.md row only when it
52
+ is hard to reverse, would surprise a reader without context, and was the result of a real trade-off; the row
53
+ takes the short form of the `qfai-sdd` decisions template. An option the user rejects is a row whose
54
54
  Content opens `Declined:`, whatever the recording test says, so it stays excluded on reruns.
55
55
 
56
56
  When the user cannot be asked, write no row to either table: report the proposed change as the decision still
@@ -0,0 +1,23 @@
1
+ # Deliberation record: <subject>
2
+
3
+ > This record is history: it keeps how this run reached its choices, twists and reversals included.
4
+ > It is not the current state. The story tree, `decisions.md` and `open-questions.md` are, and they win where this record disagrees.
5
+ > It is not read end to end: search its option cells for the option you are about to choose, and read only the rows that match.
6
+
7
+ ## Subject
8
+
9
+ <What this run was asked to settle, in one or two sentences.>
10
+
11
+ ## <stage>
12
+
13
+ <!-- Keep both tables. A table this stage has no row for stays empty: its header and delimiter row only. -->
14
+
15
+ ### Interview
16
+
17
+ | Background | Option 1 | Option 2 | Option 3 | Option 4 (other) | Chosen option number |
18
+ | ---------- | -------- | -------- | -------- | ---------------- | -------------------- |
19
+
20
+ ### Agent decisions
21
+
22
+ | Background | Option 1 | Option 2 | Option 3 | Option 4 (other) | Chosen option number |
23
+ | ---------- | -------- | -------- | -------- | ---------------- | -------------------- |
@@ -0,0 +1,36 @@
1
+ # Deliberation Record
2
+
3
+ Read when a run writes its deliberation record, or reads one.
4
+
5
+ A run keeps a memo of the questions it put to the user and the decisions its agents took. It starts from the record template the operating baseline names.
6
+
7
+ ## Writing a record
8
+
9
+ - **Where.** One Markdown file directly under `paths.deliberationDir` (default `.qfai/deliberation`), named `<YYYYMMDDhhmmss>-<slug>.md`: the time in UTC and a slug naming the subject. It is tracked in git.
10
+ - **When.** A run writes one only when it asks the user a question or takes an Agent decisions row. Each stage of the run writes under a subheading of its own in the same file.
11
+ - **Interview.** One row per question put to the user. The options offered go into Options 1 to 3 in the order offered, and `Chosen option number` holds the number of the one picked.
12
+ Quote a free answer word for word in `Option 4 (other)` and choose `4`. A question with no candidate values leaves Options 1 to 3 empty, holds the answer in Option 4 and chooses `4`. A source the options rest on goes into Background as a URL.
13
+ - **Both tables.** Each stage subheading keeps its Interview and Agent decisions headings. A table the stage has no row for stays as its header and delimiter row, so a run that asked nothing keeps an empty Interview table.
14
+ - **Agent decisions.** One row per choice that no specification, contract, rule or convention settles and whose answer changes an artifact's meaning, behaviour, structure or policy, and one per decision settled between agents. Consider at least three options for each row. A choice a convention settles, a formatting choice and a choice with one possible answer are not rows.
15
+ - **A memo.** A record has no ID, cites no ID, and nothing cites it. Once committed, it may be edited only to repair its table layout (a table's columns and a row's cell count), never its content: a correction is a new record. A later row that overturns an earlier row of the same record says so in its Background, and the earlier row stays.
16
+ - **Language.** The language the project states it keeps its documents in, otherwise the language the user works in.
17
+
18
+ ## What the reports keep
19
+
20
+ - An agent decision is an Agent decisions row of the record, never a line of the stage report or the final report.
21
+ - The stage report keeps the evidence: gate results, CI receipts, review skips and quoted delegation instructions.
22
+ - An assumption a no-question mode takes is a row too, and the final report also lists it.
23
+
24
+ ## Committing a record
25
+
26
+ - `verify-commit` commits the record with the change.
27
+ - A stage skill invoked by name, outside a `qfai-run` plan and with no `verify-commit` step, makes its record final at its last step. That step commits locally only the record and the `open-questions.md` rows the run wrote, and pushes nothing.
28
+
29
+ `npx qfai validate` checks only the layout (`QFAI-DELIB-001`): both sections exist, and every table in them has the six template columns in order and six cells per row.
30
+
31
+ ## Reading a record
32
+
33
+ - The current specification, the settled decisions and the open questions come from the story tree, `decisions.md` and `open-questions.md`, never from a record. Where a record disagrees with them, they win and the record stays unchanged.
34
+ - `/qfai-sdd` reads the record of its own run, or the one its work order names.
35
+ - Outside an implement, verify or prototyping stage, before you take a decision yourself, search the option cells of the records, with the `Declined:` rows of `decisions.md`, for the option you are about to choose. Read only the rows that match. An option the user turned down before goes back to the user, or is registered as an open question under a no-question mode.
36
+ - An implement, verify or prototyping stage reads no record.
@@ -13,8 +13,8 @@ A grilling session puts a recommended answer beside each question (`.agents/rule
13
13
  | Agent to agent, critical, without an actual user answer or recorded applicable authority | The artifact is wrong, and no reviewer can clear it |
14
14
 
15
15
  **The second row is how a delegated session is meant to end**
16
- (`.agents/rules/grilling.md`), not a finding. The reviewer checks the final
17
- report and, for a critical decision, the actual
16
+ (`.agents/rules/grilling.md`), not a finding. The reviewer reviews the change
17
+ itself and, for a critical decision, checks the actual
18
18
  applicable user authority defined in
19
19
  `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`.
20
20
  An explicit delegation covering reversible requested judgment is authority,
@@ -32,4 +32,4 @@ The reviewer must return `REVISE` and name the decision: it is reopened and put
32
32
  The first row needs a reason, because the intuitive one is wrong. A sub-agent starting with a reset context cannot defer to something it does not remember, so deference is not the risk. **Correlation** is: a fresh instance of the same agent, on the same model, over the same evidence, re-derives the preference that produced the recommendation and finds it good on the merits. Resetting the
33
33
  context removes the memory, not the disposition — which is why role name alone never establishes independence either. Where the user chose, that disposition is one input among several and the decision is not the griller's to re-derive.
34
34
 
35
- **The stage's final report is the record.** It lists every decision the agents adopted and the agent that recommended it, so a reviewer with a reset context reads the third row off the report rather than off recollection.
35
+ **A reviewer reads a recommendation from the session, never from a record.** Where a reviewer needs to know which griller recommended a decision, it takes that from what the griller returned in that session. It reads no deliberation record.
@@ -0,0 +1,27 @@
1
+ # Canonical qfai Launcher
2
+
3
+ Read before the first `npx qfai` call, a gate or a run's `workflow plan` alike, unless `qfai-run` already passed it on a local binary.
4
+
5
+ ## Launcher Preflight
6
+
7
+ - **Launcher preflight — run once, before the first `npx qfai` call**, a gate or a run's `workflow plan` alike. Confirm the project resolves qfai from its own dependencies. Either proof is sufficient:
8
+ - **A local binary at `node_modules/.bin/qfai`.** The normal case for npm, pnpm and Yarn configured with `nodeLinker: node-modules`.
9
+ - **A Plug'n'Play install.** Yarn Berry's default `nodeLinker: pnp` writes no `node_modules/.bin`, so the file check alone would report a correctly installed project as UNRUN forever. Accept it when the project has a `.pnp.cjs` / `.pnp.loader.mjs` at its root and lists `qfai` in `package.json` `dependencies` / `devDependencies`; `yarn exec qfai --help` exiting 0 is the direct
10
+ confirmation.
11
+
12
+ If neither proof holds, every `npx qfai` call, gates included, is UNRUN: report it as a blocker and stop. `package.json` says which fix applies:
13
+ - **`qfai` is listed in `dependencies` or `devDependencies`, but this checkout has no install.** A fresh clone or a new worktree has no `node_modules`, and `npx qfai` then resolves the copy of a parent directory, which may be an older version of another checkout. Run the project's install command in this checkout, then run the preflight again.
14
+ - **`node_modules` without `.bin/qfai`.** An interrupted install: run it again, then the preflight.
15
+ - **`qfai` is not listed.** Install the dependency: `npm i -D qfai`, or the pnpm / yarn equivalent. `qfai` does not add itself to `package.json` on init, so a project bootstrapped with `npx qfai init` alone has no local dependency yet.
16
+
17
+ - In a checkout whose preflight passed, install again only when its `node_modules` is gone or a merge changed the lockfile or `package.json`.
18
+ - Once the preflight passes, invoke every `npx qfai` call, gates included, through the launcher that proof established:
19
+ - local binary -> `npx qfai …`, which resolves to it. `node_modules/.bin/qfai …` is the same thing spelled out; prefer it when PATH reachability is uncertain.
20
+ - Plug'n'Play -> `yarn exec qfai …` (equivalently `yarn qfai …`), which sets up the PnP environment for the child process. Do **not** fall back to `npx qfai` there: outside the PnP runtime it cannot see the workspace dependency and would fetch a remote copy instead.
21
+
22
+ Read every `npx qfai …` example in the shipped docs as "the launcher the preflight established", not as a literal command for a PnP project.
23
+
24
+ - Never launch a gate as a bare `qfai` command: qfai is a project dependency, not a global one, so that is `command not found` on a normal local install — and a gate that cannot run is a gate that silently passes.
25
+ - The preflight is the guard, not a flag. `npx` runs "a command from a local **or remote** npm package": with nothing resolvable locally it downloads and runs one (non-interactive shells do this without prompting), and `npx --no-install` still executes a copy already sitting in the npx cache. Neither spelling can tell you the qfai that ran was this project's; only the preflight can.
26
+ - If the launcher cannot be resolved at any point, that call, a gate included, is UNRUN, not PASS. Report it as a blocker instead of completing the stage.
27
+ - The project's gate commands belong in the Standard commands section of `<paths.contractsDir>/tech.md` (`.qfai/assistant/rule/shared-skill-operating-baseline.md#standard-commands`). The CI workflow generated by `npx qfai init` is the one deliberate exception: it runs before any project install can be assumed and must still be able to bootstrap.
@@ -36,6 +36,15 @@ Two demands stay admissible on any artifact:
36
36
  - that a safety-floor item be met: security, accessibility, data-loss handling, or validation at a
37
37
  trust boundary (`.agents/rules/minimal-implementation.md` § 2).
38
38
 
39
+ A part missing from the business-screen floor
40
+ (`.agents/rules/interface-clarity.md#what-a-business-screen-always-has`) is not a demand for more
41
+ work: that rule already makes the part an obligation, so the gap is a defect that traces to it, and
42
+ `.qfai/assistant/agent/product-surface-reviewer.md` says when the finding blocks and when it is
43
+ `advisory`. The same holds for a part missing from the marketing-screen floor
44
+ (`.agents/rules/interface-clarity.md#what-a-marketing-screen-always-has`) on a screen whose UI
45
+ contract declares `surface: marketing`: a floor state or notice missing from a section, page or sign-up or payment point the change adds or alters, or removed by the change, is `blocking` with that trace, and one already missing is
46
+ `advisory`.
47
+
39
48
  This bounds what a reviewer may require, never what a reviewer may report. A demand the table does
40
49
  not admit, such as one for another business rule, is recorded as `advisory` and cannot force
41
50
  `REVISE`.
@@ -6,21 +6,29 @@ Read when a reviewer is briefed.
6
6
 
7
7
  A finding outside the reviewing stage's remit is recorded and deferred, never blocking:
8
8
 
9
- | Stage | In scope | Out of scope (record and defer) |
10
- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
11
- | `/qfai-discussion` | Requirement clarity, scope boundary, decision traceability | Spec structure, runtime behavior |
12
- | `/qfai-sdd` | Spec / contract consistency, testability, traceability edges, each document in its template's shape | Runtime enforcement correctness, code quality |
13
- | `/qfai-implement` | Code quality, spec alignment of the item, RED/GREEN evidence, silent failure and type design across the whole of every file the change touches, and security across the same files and along every input the change adds or alters to where it is used | Upstream spec content, contract design, and a finding on code in a touched file that the change did not add or alter |
14
- | `/qfai-prototyping` | The prototype against its UI contracts and the root `DESIGN.md`, loop evidence, the handoff | Spec and contract content, downstream implementation code |
15
- | `/qfai-migration-v1-to-v2` | Migration plan and report fidelity, ID mapping, every deletion listed in the reports, each written document in its template's shape | New story content and downstream implementation quality |
16
- | `/qfai-configure` | Config / manifest validity and the surfaces the run generated | Spec content, implementation structure |
17
- | `/qfai-verify` | Gate execution, evidence completeness, report / artifact fidelity | Authoring quality of the artifacts it verifies |
18
- | `/web-research` | Source authority and freshness, citation accuracy, claim support | Spec content, implementation structure |
19
- | `/qfai-grilling` | Decisions asked rather than assumed, facts naming where they were read, the session's end condition | The merit of what the user decided, and the artifacts the invoking stage writes from it |
20
- | `/qfai-grill` | The same, reported to the user rather than to a stage | The merit of what the user decided; there is no artifact to review |
21
- | `/qfai-maintain` | That the diff changes no behaviour, and the checks run over it | Whether the new wording is the better one |
22
- | `/qfai-triage` | That no tracked file changed, the recorded outcome, each follow-up, and the sources an answer cites | The work a follow-up request describes |
23
- | `/qfai-run` | The artifacts the session writes, in the specification or code review the plan names after a stage | Whether the route the decision rules chose was the right one |
9
+ | Stage | In scope | Out of scope (record and defer) |
10
+ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `/qfai-sdd` | Spec / contract consistency, testability, traceability edges, each document in its template's shape | Runtime enforcement correctness, code quality |
12
+ | `/qfai-implement` | Code quality, spec alignment of the item, RED/GREEN evidence, silent failure and type design across the whole of every file the change touches, and security across the same files and along every input the change adds or alters to where it is used, and, for a changed rule master, every rule it points to and every rule that points to it | Upstream spec content, contract design other than a UI contract gap (below), and a finding on code in a touched file that the change did not add or alter |
13
+ | `/qfai-prototyping` | The prototype against its UI contracts and the root `DESIGN.md`, loop evidence, the handoff | Spec and contract content other than a UI contract gap (below), downstream implementation code |
14
+ | `/qfai-migration-v1-to-v2` | Migration plan and report fidelity, ID mapping, every deletion listed in the reports, each written document in its template's shape | New story content and downstream implementation quality |
15
+ | `/qfai-configure` | Config / manifest validity and the surfaces the run generated | Spec content, implementation structure |
16
+ | `/qfai-verify` | Gate execution, evidence completeness, report / artifact fidelity | Authoring quality of the artifacts it verifies |
17
+ | `/web-research` | Source authority and freshness, citation accuracy, claim support | Spec content, implementation structure |
18
+ | `/qfai-grilling` | Decisions asked rather than assumed, facts naming where they were read, the session's end condition | The merit of what the user decided, and the artifacts the invoking stage writes from it |
19
+ | `/qfai-grill` | The same, reported to the user rather than to a stage | The merit of what the user decided; there is no artifact to review |
20
+ | `/qfai-maintain` | That the diff changes no behaviour, and the checks run over it | Whether the new wording is the better one |
21
+ | `/qfai-triage` | That no tracked file changed, the recorded outcome, each follow-up, and the sources an answer cites | The work a follow-up request describes |
22
+ | `/qfai-run` | The artifacts the session writes, in the specification or code review the plan names after a stage | Whether the route the decision rules chose was the right one |
23
+
24
+ A UI contract gap is in scope for `/qfai-implement` and `/qfai-prototyping`
25
+ review. The screen is first seen working or drawn there, after the spec review.
26
+ A gap is a screen whose contract leaves out a part the `qfai-sdd` UI contract
27
+ guide requires of every screen. The finding is `blocking`, traces to the contract ID and is
28
+ routed to `/qfai-sdd`, which amends the contract; the implementer does not fill
29
+ it in the code. A finding that only argues the contract could say more is not a
30
+ gap: it is `advisory` and takes the path in
31
+ `.qfai/assistant/rule/drift-protocol.md#reviewer-originated-obligations`.
24
32
 
25
33
  Article VII excess in the reviewing stage's own artifacts is in scope;
26
34
  quality of downstream implementation code is deferred at upstream stages.