qfai 2.2.1 → 2.4.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 (211) hide show
  1. package/README.md +37 -20
  2. package/assets/init/.claude/settings.json +35 -1
  3. package/assets/init/.codex/hooks.json +24 -0
  4. package/assets/init/.github/instructions/code-review.instructions.md +1 -1
  5. package/assets/init/.qfai/assistant/agent/architecture-reviewer.md +4 -4
  6. package/assets/init/.qfai/assistant/agent/fullstack-engineer.md +129 -0
  7. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +76 -4
  8. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +9 -5
  9. package/assets/init/.qfai/assistant/agent/requirements-reviewer.md +13 -3
  10. package/assets/init/.qfai/assistant/rule/agent-selection.md +22 -42
  11. package/assets/init/.qfai/assistant/rule/communication.md +1 -1
  12. package/assets/init/.qfai/assistant/rule/constitution.md +77 -242
  13. package/assets/init/.qfai/assistant/rule/drift-protocol.md +31 -165
  14. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +4 -3
  15. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +4 -4
  16. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +2 -2
  17. package/assets/init/.qfai/assistant/rule/references/placeholder-scan.md +2 -3
  18. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +3 -3
  19. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +15 -6
  20. package/assets/init/.qfai/assistant/rule/research-first-protocol.md +7 -6
  21. package/assets/init/.qfai/assistant/rule/review-convergence.md +7 -7
  22. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +82 -66
  23. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +19 -21
  24. package/assets/init/.qfai/assistant/rule/test-layers.md +1 -1
  25. package/assets/init/.qfai/assistant/rule/thinking.md +2 -2
  26. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +5 -5
  27. package/assets/init/.qfai/assistant/rule/ui-procurement.md +1 -1
  28. package/assets/init/.qfai/assistant/rule/workflow.md +16 -16
  29. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +27 -60
  30. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +3 -17
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/03_Story-Workshop.md +1 -2
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -3
  33. package/assets/init/.qfai/assistant/skill/qfai-grill/SKILL.md +9 -10
  34. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +45 -58
  35. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/confirmation-sheet.md +71 -0
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +35 -18
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +3 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +2 -18
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +53 -21
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +35 -2
  41. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +2 -5
  42. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +2 -15
  43. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +10 -14
  44. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +0 -7
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +6 -15
  46. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +76 -5
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +2 -1
  48. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +60 -5
  49. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +15 -6
  50. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +42 -11
  51. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +8 -10
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +12 -7
  53. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +4 -4
  54. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +1 -1
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +10 -25
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +27 -29
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +13 -3
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +36 -3
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +8 -9
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +6 -6
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +7 -7
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +5 -5
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +7 -7
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +3 -3
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +115 -199
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +25 -25
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +23 -113
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +2 -2
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +8 -7
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions/page-NNNN.md +2 -2
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +59 -31
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/open-questions.md +15 -11
  74. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +1 -14
  75. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +2 -13
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +1 -1
  77. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +19 -21
  78. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +9 -11
  79. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +2 -3
  80. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +3 -4
  81. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -2
  82. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +8 -7
  83. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +7 -9
  84. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +0 -2
  85. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +43 -2
  86. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +0 -2
  87. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +0 -2
  88. package/assets/init/.qfai/assistant/step/implement-acceptance/STEP.md +1 -5
  89. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +0 -5
  90. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +0 -4
  91. package/assets/init/.qfai/assistant/step/implement-bisect/STEP.md +0 -5
  92. package/assets/init/.qfai/assistant/step/implement-credentials/STEP.md +0 -4
  93. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -18
  94. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +0 -6
  95. package/assets/init/.qfai/assistant/step/implement-minimize/STEP.md +0 -5
  96. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +0 -6
  97. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +1 -3
  98. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +0 -4
  99. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +0 -4
  100. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +2 -6
  101. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +0 -6
  102. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +0 -4
  103. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +5 -7
  104. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +0 -4
  105. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +0 -5
  106. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +0 -5
  107. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +10 -18
  108. package/assets/init/.qfai/assistant/step/implement-test-fix/STEP.md +0 -5
  109. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +0 -3
  110. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -21
  111. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -6
  112. package/assets/init/.qfai/assistant/step/prototyping-handoff/STEP.md +0 -2
  113. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +106 -31
  114. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +0 -2
  115. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +18 -19
  116. package/assets/init/.qfai/assistant/step/sdd-cycle/STEP.md +8 -11
  117. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +25 -6
  118. package/assets/init/.qfai/assistant/step/sdd-gate/STEP.md +0 -1
  119. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +6 -8
  120. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +71 -82
  121. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +0 -2
  122. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +0 -2
  123. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +0 -2
  124. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +0 -2
  125. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +0 -2
  126. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +0 -2
  127. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +0 -2
  128. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +29 -17
  129. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +0 -2
  130. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +0 -2
  131. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +0 -2
  132. package/assets/init/.qfai/assistant/step/verify-advisory/STEP.md +0 -2
  133. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +0 -2
  134. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +2 -6
  135. package/assets/init/.qfai/assistant/step/verify-context/STEP.md +7 -26
  136. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +0 -2
  137. package/assets/init/.qfai/assistant/step/verify-manual/STEP.md +0 -2
  138. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +0 -2
  139. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +0 -2
  140. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +0 -2
  141. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +0 -2
  142. package/assets/init/root/.agents/rules/ai-readable-markdown.md +8 -1
  143. package/assets/init/root/.agents/rules/delegation-steering.md +69 -0
  144. package/assets/init/root/.agents/rules/grilling.md +81 -52
  145. package/assets/init/root/.agents/rules/minimal-implementation.md +5 -5
  146. package/assets/init/root/.agents/rules/reply-forms.md +191 -0
  147. package/assets/init/root/.agents/rules/session-feedback.md +104 -27
  148. package/assets/init/root/.agents/rules/user-questions.md +6 -1
  149. package/assets/init/root/.gitattributes +5 -6
  150. package/assets/init/root/AGENTS.md +4 -2
  151. package/assets/mdschema/story/03_contract/tech.mdschema.yml +1 -1
  152. package/assets/mdschema/story/decisions/page-NNNN.mdschema.yml +3 -3
  153. package/assets/mdschema/story/decisions.mdschema.yml +4 -4
  154. package/assets/mdschema/story/open-questions.mdschema.yml +3 -3
  155. package/assets/schemas/workflow/extraction.schema.json +0 -2
  156. package/dist/cli/index.cjs +3826 -3929
  157. package/dist/cli/index.cjs.map +1 -1
  158. package/dist/cli/index.mjs +3793 -3904
  159. package/dist/cli/index.mjs.map +1 -1
  160. package/dist/graph/cli.cjs +14 -2
  161. package/dist/graph/cli.cjs.map +1 -1
  162. package/dist/graph/cli.d.cts +1 -1
  163. package/dist/graph/cli.d.ts +1 -1
  164. package/dist/graph/cli.mjs +14 -2
  165. package/dist/graph/cli.mjs.map +1 -1
  166. package/dist/graph/hook.cjs.map +1 -1
  167. package/dist/graph/hook.mjs.map +1 -1
  168. package/dist/hook/turn-end.cjs +1022 -0
  169. package/dist/hook/turn-end.cjs.map +1 -0
  170. package/dist/hook/turn-end.d.cts +2 -0
  171. package/dist/hook/turn-end.d.ts +2 -0
  172. package/dist/hook/turn-end.mjs +998 -0
  173. package/dist/hook/turn-end.mjs.map +1 -0
  174. package/dist/index.cjs +3635 -4578
  175. package/dist/index.cjs.map +1 -1
  176. package/dist/index.d.cts +20 -21
  177. package/dist/index.d.ts +20 -21
  178. package/dist/index.mjs +3696 -4641
  179. package/dist/index.mjs.map +1 -1
  180. package/dist/process-qqX2Owgq.d.cts +18 -0
  181. package/dist/process-qqX2Owgq.d.ts +18 -0
  182. package/package.json +2 -2
  183. package/assets/defaults/agent-routing/_contract.yml +0 -77
  184. package/assets/defaults/agent-routing/common.yml +0 -14
  185. package/assets/defaults/agent-routing/qfai-discussion.yml +0 -57
  186. package/assets/defaults/agent-routing/qfai-implement.yml +0 -236
  187. package/assets/defaults/agent-routing/qfai-maintain.yml +0 -12
  188. package/assets/defaults/agent-routing/qfai-prototyping.yml +0 -48
  189. package/assets/defaults/agent-routing/qfai-sdd.yml +0 -56
  190. package/assets/defaults/agent-routing/qfai-triage.yml +0 -108
  191. package/assets/defaults/agent-routing/qfai-verify.yml +0 -92
  192. package/assets/defaults/agent-routing/skills.yml +0 -59
  193. package/assets/defaults/review-profiles.yml +0 -25
  194. package/assets/init/.qfai/assistant/agent/acceptance-test-engineer.md +0 -81
  195. package/assets/init/.qfai/assistant/agent/backend-engineer.md +0 -90
  196. package/assets/init/.qfai/assistant/agent/completion-reviewer.md +0 -88
  197. package/assets/init/.qfai/assistant/agent/delivery-planner.md +0 -85
  198. package/assets/init/.qfai/assistant/agent/devops-ci-engineer.md +0 -78
  199. package/assets/init/.qfai/assistant/agent/discovery-analyst.md +0 -81
  200. package/assets/init/.qfai/assistant/agent/doc-steward.md +0 -78
  201. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +0 -94
  202. package/assets/init/.qfai/assistant/agent/orchestrator.md +0 -92
  203. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +0 -101
  204. package/assets/init/.qfai/assistant/agent/qa-gatekeeper.md +0 -153
  205. package/assets/init/.qfai/assistant/agent/qa-strategist.md +0 -82
  206. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +0 -96
  207. package/assets/init/.qfai/assistant/agent/solution-architect.md +0 -89
  208. package/assets/init/.qfai/assistant/agent/test-design-analyst.md +0 -132
  209. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +0 -52
  210. package/dist/process-C21nTvkT.d.cts +0 -12
  211. package/dist/process-C21nTvkT.d.ts +0 -12
@@ -1,9 +1,23 @@
1
1
  # Iteration Loop
2
2
 
3
+ ## Contents
4
+
5
+ - Phases
6
+ - Per-iteration files
7
+ - When the loop ends
8
+ - First-iteration variants
9
+ - Best-of-history is gone
10
+ - Restyle iterations
11
+ - Surface profile
12
+ - Contracts read
13
+ - Produced after the loop
14
+ - Brand identity
15
+
3
16
  ## Phases
4
17
 
5
18
  ```text
6
19
  [Build] iteration NN: generate iter-NN/index.html under DESIGN.md tokens
20
+ (an open direction's first iteration: two or three variants)
7
21
  [Review] iteration NN: the reviewer operates Playwright and returns the reviews
8
22
  [Ask] iteration NN: the user confirms the prototype, or answers with a change
9
23
  [Handoff] confirmed: final/index.html + final/handoff.json (restyle: handoff.json only)
@@ -17,16 +31,17 @@
17
31
  .qfai/prototype/iter-NN/UI-NNNN/<screen>.review.json
18
32
  ```
19
33
 
20
- The orchestrator writes the reviewer's payload for each `(UI contract, screen)` pair beside the
34
+ The session agent writes the reviewer's payload for each `(UI contract, screen)` pair beside the
21
35
  per-iteration `review.json` summary, from the first iteration on (the payload schema and the aggregation rule are
22
36
  in the reviewer references the loop step names). That holds for a single-contract run as much
23
37
  as for a multi-contract one. A scoped run writes payloads only for the pairs it
24
- reviews: its in-scope and render-check screens.
38
+ reviews: its in-scope and render-check screens. An iteration with variants
39
+ writes them per variant, as First-iteration variants below says.
25
40
 
26
41
  The reviewer operates Playwright live. A screenshot or HTML snapshot is an
27
42
  additional input, taken only when someone needs it.
28
43
 
29
- `progress.md` is one file for the whole run. The orchestrator appends a
44
+ `progress.md` is one file for the whole run. The session agent appends a
30
45
  one-line summary at the end of each iteration.
31
46
 
32
47
  ## When the loop ends
@@ -34,13 +49,51 @@ one-line summary at the end of each iteration.
34
49
  The loop ends when the user confirms the prototype. Until then each answer the
35
50
  user gives runs another iteration. No score, finding count or command decides
36
51
  that the loop is done, and a blocking finding still open at the confirmation is
37
- named in the final report rather than holding the loop open.
52
+ named in the final report rather than holding the loop open. A restyle whose
53
+ audit found nothing to fix, and whose refinements the user declined, stops
54
+ before iteration 00 with no edit.
55
+
56
+ ## First-iteration variants
57
+
58
+ A `prototype` run has an open direction when neither
59
+ `.qfai/prototype/grilling.md` `## Session` nor the root `DESIGN.md` settles
60
+ which layout carries the in-scope screens' task. An `## Escalated` row settles
61
+ nothing, and a feel left open alone does not open it: variants differ in
62
+ structure. The run's first iteration then builds two or three variants, `A`,
63
+ `B` and optionally `C`, of the in-scope screens. They differ in grouping,
64
+ layout or navigation, not only in style, all under the root `DESIGN.md`
65
+ tokens, on one `iter-NN/index.html`, switchable in place through
66
+ `?variant=<id>`. The session agent records the IDs as `variants` in
67
+ `progress.md` before the iteration is built, and sets `variants` to `none`
68
+ before the next one.
69
+
70
+ A `restyle` loop, a run with a `runScope`, a run whose `## Session` or
71
+ `DESIGN.md` settles the layout, and a run under a no-question mode, where
72
+ nobody can pick, record `variants` `none` and build one prototype.
73
+
74
+ Each variant is reviewed on its own, by a reviewer started fresh for it at
75
+ `<url>/iter-NN/?variant=<id>`, and its files take the place of the
76
+ iteration's:
77
+
78
+ ```text
79
+ .qfai/prototype/iter-NN/variant-<id>/review.json
80
+ .qfai/prototype/iter-NN/variant-<id>/<ui-contract-id>/<screen>.review.json
81
+ ```
82
+
83
+ The variants exist to make the choice answerable; they do not make it. The
84
+ user picks one, combines parts or rejects all, and the next iteration builds
85
+ one prototype from that answer. A compare reply whose `keep from` line names
86
+ another variant is a combination, not a pick. Its prior review is the picked variant's
87
+ summary, or none after a combination or a rejection. Every later read of the
88
+ variant iteration's review, as the review before the prior one or as
89
+ `previousScore`, reads the same. Every later iteration builds one prototype.
38
90
 
39
91
  ## Best-of-history is gone
40
92
 
41
93
  The latest iteration is always the one put to the user. Temporary regressions
42
94
  are allowed; a leap backwards is a normal path to a breakthrough on the IA and
43
- flow axes.
95
+ flow axes. The variants of a first iteration are one iteration, not a history
96
+ to reach back to.
44
97
 
45
98
  ## Restyle iterations
46
99
 
@@ -48,6 +101,8 @@ A loop whose `progress.md` records `iterationKind` `restyle` restyles the
48
101
  live app in place. Each `iter-NN/index.html` lists the live routes in scope,
49
102
  the reviewer drives those routes in the running app, and the handoff is a
50
103
  short form that names the routes and the stylesheet and motion entry points.
104
+ Before iteration 00, the loop step saves each route's text as a baseline and
105
+ audits the routes to set `restyleLevel`.
51
106
 
52
107
  ## Surface profile
53
108
 
@@ -1,11 +1,11 @@
1
1
  # Review Payload Schema (`<screen>.review.json`)
2
2
 
3
3
  SSOT for the per-UI-contract / per-screen review payload. The
4
- product-surface-reviewer sub-agent returns it, the orchestrator writes it,
4
+ product-surface-reviewer sub-agent returns it, the session agent writes it,
5
5
  and the user reads what it finds before confirming the prototype.
6
6
 
7
7
  The schema is **closed**: any key not listed below is rejected. The
8
- orchestrator checks each payload against it before writing it, and asks the
8
+ session agent checks each payload against it before writing it, and asks the
9
9
  reviewer again for one that does not conform before the prototype is put to
10
10
  the user. A near-miss (extra key, misspelled field) fails the
11
11
  whole file.
@@ -24,14 +24,23 @@ whole file.
24
24
  .qfai/prototype/iter-NN/<ui-contract-id>/<screen>.review.json
25
25
  ```
26
26
 
27
- One file per (UI contract × screen × iteration). `<ui-contract-id>` is the full
27
+ In an iteration with variants, each variant's payloads are under its own
28
+ directory, and the schema is unchanged:
29
+
30
+ ```text
31
+ .qfai/prototype/iter-NN/variant-<id>/<ui-contract-id>/<screen>.review.json
32
+ ```
33
+
34
+ One file per (UI contract × screen × iteration), and per variant where
35
+ there are variants. `<ui-contract-id>` is the full
28
36
  `UI-NNNN` ID, and `<screen>` is declared in that contract's `screens[]`.
29
37
  `<screen>.review.json` is the **only**
30
38
  per-(UI contract × screen) artifact written for a review — no `.html`, no
31
39
  `.png`, no `.interaction.json`.
32
40
 
33
41
  The Reviewer's other result is the per-iteration summary
34
- `iter-NN/review.json` (one per iteration, a different shape, set by
42
+ `iter-NN/review.json` (one per iteration, or one per variant under
43
+ `iter-NN/variant-<id>/`, a different shape, set by
35
44
  the reviewer prompt). It is not a per-screen artifact and
36
45
  is never read against this schema.
37
46
 
@@ -120,12 +129,12 @@ exponential backoff (`base * 2^attemptIndex` ms, `base = 250`).
120
129
 
121
130
  Who records which status:
122
131
 
123
- - The orchestrator dispatches the reviewer for each pair and runs the
132
+ - The session agent dispatches the reviewer for each pair and runs the
124
133
  attempts. A session that completed is `ok`, including one that
125
134
  succeeded after earlier failed attempts: the reviewer returns
126
135
  `sessionStatus: "ok"` with the retries consumed in `retryCount`.
127
136
  - When the reviewer cannot be started, or every attempt fails, no
128
- reviewer payload exists. The orchestrator writes the pair's payload
137
+ reviewer payload exists. The session agent writes the pair's payload
129
138
  itself, with `sessionStatus` `launchFailed` or `retryExhausted`,
130
139
  `retryCount` the retries consumed, every impression and array empty,
131
140
  `wallTimeSec` the time spent, and `softWarnings.timeBudget` derived
@@ -41,7 +41,9 @@ transition-pass percentages as a substitute for the qualitative review.
41
41
  scope: open each listed route in the running app and review it there.
42
42
  The list page is not a screen, and the screens are the project's own.
43
43
  Read the edited stylesheet and motion files as well when filling
44
- `designMdViolations[]`.
44
+ `designMdViolations[]`. Compare each route with its baseline,
45
+ `.qfai/prototype/baseline/<ui-contract-id>/<screen>.txt`, as
46
+ [What blocks](#what-blocks) says.
45
47
  When `progress.md` records a `runScope`, review its in-scope screens in
46
48
  full. On each render-check screen, check only that the in-scope component
47
49
  renders there: one that does not render, or that breaks the screen around
@@ -51,12 +53,21 @@ transition-pass percentages as a substitute for the qualitative review.
51
53
  When the scope names components only, the render-check screens are the
52
54
  whole review, and the summary's four scores rate the component as those
53
55
  screens render it.
56
+ - When the URL you are given carries `?variant=<id>`, the iteration has
57
+ variants and you review that variant alone. Review it as if it were the
58
+ only one, keep `?variant=<id>` on every route, and never open another
59
+ variant: its own payloads, summary and `pivotDirective` are written under
60
+ `iter-NN/variant-<id>/`. Do not rank it against others or call it
61
+ preferred; the user chooses between the variants. The variant switcher is not part of any
62
+ screen: do not review, count or report it.
54
63
  - A screenshot or HTML snapshot, only when one was taken. Name any mandatory
55
64
  input you did not receive in a finding.
56
65
  - The layout anti-pattern registry the package ships.
57
66
  - Prior reviews: `iter-(NN-1)/review.json`, `iter-(NN-2)/review.json`
58
67
  (when present), from this run only: the run's first iteration, the first
59
- after `progress.md` records its `runScope`, has none.
68
+ after `progress.md` records its `runScope`, has none. Where one of them is
69
+ an iteration with variants, read the picked variant's summary in its
70
+ place, or none after a combination or a rejection.
60
71
  - Progress log: `.qfai/prototype/progress.md`
61
72
  - Root `DESIGN.md` (read-only context: `# Brand Philosophy`,
62
73
  `audience.emotion`, `audience.do_not_look_like`).
@@ -73,20 +84,23 @@ transition-pass percentages as a substitute for the qualitative review.
73
84
 
74
85
  ## Outputs — two files, two schemas
75
86
 
76
- You return two different results, and the orchestrator writes each to
87
+ You return two different results, and the session agent writes each to
77
88
  its file. They are not interchangeable. Both paths are given in full
78
89
  below and are relative to the project root.
79
90
 
80
91
  1. **Per-contract / per-screen payload** —
81
92
  `.qfai/prototype/iter-NN/<ui-contract-id>/<screen>.review.json`,
82
- one per screen. `<ui-contract-id>` is the full `UI-NNNN` ID. The
93
+ or `iter-NN/variant-<id>/<ui-contract-id>/<screen>.review.json` in an
94
+ iteration with variants, one per screen. `<ui-contract-id>` is the full
95
+ `UI-NNNN` ID. The
83
96
  per-UI-contract subdirectory is mandatory for every run that declares UI
84
97
  screens, including a run with one contract. Its schema is closed
85
98
  (11 required top-level fields, unknown keys rejected) and lives in
86
99
  the payload schema reference. Build it from that
87
100
  reference, not from the block below.
88
101
  2. **Per-iteration summary** —
89
- `.qfai/prototype/iter-NN/review.json`, one per iteration. Its shape is
102
+ `.qfai/prototype/iter-NN/review.json`, one per iteration, or one per
103
+ variant under `iter-NN/variant-<id>/`. Its shape is
90
104
  the block below.
91
105
 
92
106
  The two share `blockingFindings`, `layoutAntiPatternsDetected` and
@@ -240,12 +254,21 @@ Hint text survives only where a need was demonstrated, the control was
240
254
  improved first and the need remained, and it is one sentence at most. Longer
241
255
  means the question needs clarifying or splitting.
242
256
 
243
- Compare the rendered text with the screen's UI contract in both directions. The
244
- screen shows its `title`, the group headings of its `structure`, its labels and
245
- the `supplements` it declares. A text shown that none of them declares is excess,
246
- and a declared supplement that is not shown is an unmet need. The finding names
247
- the screen, the task or state, the meaning that is duplicated or the need that is
248
- unmet, and the text to remove or the control or structure to repair. Apply the
257
+ `npx qfai validate` checks only that every plain text in the prototype source has a
258
+ well-formed `qfai-text` reason comment. Whether the reason is strong is yours to
259
+ judge:
260
+
261
+ - Reject a generic reason ("helps the user", "for clarity") and a reason that
262
+ restates the text.
263
+ - A text that could be deleted, replaced by another component (an icon with an
264
+ accessible name, a disabled state, a badge) or moved into a label, heading,
265
+ button wording or empty state is excess even with a reason.
266
+ - Judge whether the copy the UI contract describes (`supplements`, group
267
+ headings) is needed at all.
268
+
269
+ These are review findings, not validate findings. The finding names the screen,
270
+ the task or state, the meaning that is duplicated or the need that is unmet, and
271
+ the text to remove or the control or structure to repair. Apply the
249
272
  patterns of the section on copy that adds no meaning, which the loop step names; the
250
273
  rest of the design anti-patterns list stays with the direction review.
251
274
 
@@ -314,6 +337,14 @@ content, a task that cannot be completed, a state the spec requires and
314
337
  the screen does not show, a control whose effect is unknowable until it
315
338
  is pressed.
316
339
 
340
+ In a `restyle` iteration, text the screen showed before the restyle and no
341
+ longer shows unchanged also blocks: a figure, a proper name, a field value or
342
+ any other text in the route's baseline that the screen now changes, drops or
343
+ replaces with prose. The finding names the screen, the baseline text and what
344
+ the screen shows instead. A restyle keeps the screens, fields and behaviour it
345
+ found, so this needs no other authority. A missing baseline is a missing
346
+ mandatory input.
347
+
317
348
  An observation that something could be better is not a finding. It goes
318
349
  in `proseCritique`, where it informs the next iteration. Whether the
319
350
  prototype is done is the user's decision, not a score's.
@@ -4,7 +4,6 @@ title: QFAI Run (Change request entry)
4
4
  description: "Use when the user asks for a change, a fix, an investigation of the codebase, a question about the project or an operation on finished work in plain words and names no stage skill. Plans every such request, the lightest included, with `npx qfai workflow plan` and runs the plan's steps in order to its end."
5
5
  argument-hint: "<the change, in your own words>"
6
6
  allowed-tools: [Read, Glob, Grep, Write, Edit, Bash, TodoWrite, Task, Agent]
7
- roles: [orchestrator]
8
7
  steps: []
9
8
  requires: [common-policy-check, common-review-cycle]
10
9
  mode: execution-focused
@@ -12,15 +11,13 @@ mode: execution-focused
12
11
 
13
12
  ## /qfai-run - Change request entry
14
13
 
15
- [DRIFT-PROTOCOL:REQUIRED]
16
-
17
14
  In a git worktree, read and follow the worktree's own `.qfai/assistant/skill/qfai-run/SKILL.md`, whatever copy the host loaded. Follow the CLI plan's steps in order. Read no reference up front; each line says when.
18
15
 
19
16
  - `references/extraction.md`: for an extraction step 1 does not give.
20
17
  - `references/plan.md`: for a plan field this file does not name, or a refused plan.
21
18
  - `references/operator-screens.md`: when a line below or a step names it, such as to ask or report.
22
19
  - `references/stage-points.md`: at a step the plan marks with a point.
23
- - Run preflight before planning, as `.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher-mandatory` says.
20
+ - Run preflight before planning, as `.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher` says.
24
21
  If the launcher is missing or preflight fails, read `references/operator-screens.md` for recovery.
25
22
  - Read `references/codex-cloud-install.md` before configuring an environment-owned Install script or Start skill, or preparing dependencies for a fresh checkout. Use the reviewed target's successful preparation and canonical proof before planning.
26
23
 
@@ -60,7 +57,7 @@ values plan nothing.
60
57
 
61
58
  1. **Extract.** A question one read answers is `{ intent: question-why, qualifiers: [session-answerable] }`
62
59
  (or `question-how`, `question-help`); an operation on finished work, or on a device or system the session reaches, that the session runs itself and
63
- that deletes nothing is `{ intent: order, artifacts: [] }`. Every other field is empty, with `confidence: high`; neither needs a reference.
60
+ that deletes nothing is `{ intent: order, artifacts: [] }`. Write every other required list field as `[]`, since `plan` refuses an omitted one, with `confidence: high`; neither needs a reference.
64
61
  Read any other request as `references/extraction.md` sets out. Then run the launcher preflight above; after it passes, hand the extraction to `npx qfai workflow plan --in <file>`, or `--in -`.
65
62
  The session-run operation that deletes nothing, read above as `{ intent: order, artifacts: [] }`, goes to `npx qfai workflow plan --order` instead, with no file; an order read through `references/extraction.md` keeps `--in`.
66
63
  2. **Candidates.** When `plan` returns `candidates`, put one single-select
@@ -74,9 +71,9 @@ values plan nothing.
74
71
  plan's one step is `triage-answer` or `triage-operate`. On a route that changes no file, one that
75
72
  closes, answers or asks, it reads and reports and writes nothing.
76
73
  5. **Run the stages.** Run each stage in plan order, and each of its steps in
77
- order, as `.qfai/assistant/rule/shared-skill-operating-baseline.md#running-steps-mandatory` says.
74
+ order, as `.qfai/assistant/rule/shared-skill-operating-baseline.md#running-steps` says.
78
75
  Note each step's status for the final report; when a step is short or passes without edits, read `references/operator-screens.md`.
79
- Write artifacts yourself or delegate independent parallel work or review. A worker starts no finder, griller or reviewer: run each step that starts one yourself, as the delegation baseline's Orchestrator Protocol says.
76
+ Do the work and write every artifact yourself. Start a sub-agent only for the two reasons the delegation baseline states: an independent judgement, or parallel units that pass the parallel-unit gate. A worker starts no finder, griller or reviewer: run each step that starts one yourself, as the delegation baseline's Session Agent Protocol says.
80
77
  At a step the plan marks with a point, follow `references/stage-points.md`:
81
78
  - **Release point.** Ask the user to approve the release before the step `releasePoint` names.
82
79
  - **Decision point.** Put each critical decision at a step `decisionPoints` names to the user.
@@ -88,8 +85,9 @@ values plan nothing.
88
85
  reviewed sides, or a route code review of a small literal-only change, as `common-review-cycle` defines, gets no reviewer. A conflict resolution the plan's own edit stage made in the story tree, a contract or a register still gets one.
89
86
  No agent reviews its own work; no step adds a review. Each returns PASS or REVISE.
90
87
  Fix or answer each finding once; a behaviour fix gets one re-review, as `common-review-cycle` says. Stop a step that exceeds the request.
91
- 7. **Approvals.** Each approval of a specification change, a critical decision or a release is one `decisions.md` row: what was approved, who approved it, when, and the chosen option's label, in the `qfai-sdd` decisions template's form. A decision you took appends no row.
92
- When the release change is produced outside this run (by a release workflow or bot), record its approval in the final report with the same four items and list the row as a pending follow-up;
88
+ 7. **Approvals.** An approval of a critical decision or a release is one `decisions.md` row only when it is hard to reverse, would surprise a reader without context, and was the result of a real trade-off:
89
+ what was approved, who approved it, when, and the chosen option's label, in the `qfai-sdd` decisions template's short form. Otherwise the final report states the approval with the same items. A decision you took appends no row.
90
+ When the release change is produced outside this run (by a release workflow or bot), record its approval in the final report in the same short form, and, when it is to be a row, list the row as a pending follow-up;
93
91
  the next change that touches `decisions.md` appends the row, and a `qfai-run` that writes `decisions.md` appends any pending approval row first.
94
92
  8. **A finding no stage serves.** Stop, and name the finding, its owner and the stage skill to invoke by name.
95
93
  9. **Commit.** `verify-commit` runs last, after any release point; never pushes. A push, pull request, merge or branch update the user asks for after the plan ends is planned next as `{ intent: order, artifacts: [] }` with `npx qfai workflow plan --order`, and its `triage-operate` delivers it.
@@ -115,7 +113,7 @@ Follow `.qfai/assistant/rule/shared-skill-operating-baseline.md#user-questions-a
115
113
  - P3: the story tree under `<paths.specsDir>` and the contracts under `<paths.contractsDir>`
116
114
  - P4: the user's request
117
115
 
118
- ## Sub-agent Delegation (MANDATORY)
116
+ ## Sub-agent Delegation
119
117
 
120
118
  Follow `.qfai/assistant/rule/shared-skill-delegation-baseline.md`.
121
119
 
@@ -210,7 +210,7 @@ Each flag is followed by what the request does when it is set, then, where one a
210
210
  - `fix`: proposes a concrete fix: a patch, a linked change, a specific edit. Not when the author only offers to implement.
211
211
  - `expect`: states what should happen, directly or by reference to documents, a specification, an earlier version or another implementation. Not when it only says "it does not work".
212
212
  - `decision`: shows the work cannot start until someone chooses: options listed, "should we", which side wins left open. On `feature`, `behaviour-change`, `design` or `deprecation`, set it unless acceptance is shown; on a `behaviour-change` that explicitly asks to change the prototype, only when a choice is left open. Not when the fix is obvious and the request names the right side.
213
- - `upstream`: cites a decision already made elsewhere: an approved change request, a parent item with a settled design, a documented lifting condition. Not when the parent is itself undecided.
213
+ - `upstream`: cites a decision already made elsewhere: an approved decision, a parent item with a settled design, a documented lifting condition. Not when the parent is itself undecided.
214
214
  - `bundle`: holds two or more independent findings, each fixable alone. Not when the parts are steps of one fix.
215
215
  - `vague`: gives too little to act on: no version, no steps, no expected result, empty template fields, "it stopped working". Not when the text is only short.
216
216
  - `last-good`: names a version, commit or change where it worked, a version pair or a bisect result. Not when it only says "recently".
@@ -244,10 +244,12 @@ only after reading what it depends on.
244
244
  - `mixed-bundle`, with `bundle`: The bundled findings differ in kind. Findings that share one intent take that intent instead.
245
245
  - `human-run`, with `order`: Only a person can run the operation: it is paid, bound to a host, or needs credentials the session does not hold.
246
246
  - `owned-temporary-cleanup`, with `order`: Existing user authority permits deleting specific repository-local, Git-ignored temporary directories the current task owns, without a tracked change or files still needed for a deliverable.
247
- - `meaning-preserving`, with `stale-record` or `order`: The change keeps every record's meaning. It only resolves the conflicts of a merge or a branch update, or renumbers an ID the branch added that the base also took, and adds no content neither side had. It lists the artifacts the conflict touches; a conflict in code, a generated file or a lockfile is not this qualifier.
247
+ - `meaning-preserving`, with `stale-record` or `order`: The change keeps every record's meaning. It only resolves the conflicts of a merge or a branch update, or gives a story-tree item the branch added a free ID when the base took the same ID, and adds no content neither side had.
248
+ A conflict confined to `decisions.md`, its pages and `open-questions.md` is resolved by merging the base, whose union merge keeps both sides' rows; no register row is edited or renumbered.
249
+ It lists the artifacts the conflict touches; a conflict in code, a generated file or a lockfile is not this qualifier.
248
250
  - `distribution-incident`, with `release`: A published key, certificate, feed or package is broken.
249
251
  - `release-delegated`, with `release`: The user's own instruction for this run, quoted word for word with its source, has the agent carry out the release, its preparation up to an open release pull request, or its version edit, for a version the user named. A request only for a release, a version with no one named to carry it out, a branch name or a project policy delegates nothing.
250
- - `settled-design`, with `upstream`: The cited record exists, is in force, and settles the design.
252
+ - `settled-design`, with `upstream`: The cited record exists, no later decision row supersedes it, and it settles the design.
251
253
  - `red-since-change`, with `ci`: CI fails since a named change, and a correct existing test catches it.
252
254
  - `check-misses`, with `unenforced`: A check exists and misses cases, or a check the declaration needs is absent.
253
255
  - `mechanism-inert`, with `unenforced`: A declared mechanism does nothing: a key never read, a check that never fires, an obligation nothing produces.
@@ -281,7 +283,6 @@ Each signal is followed by what the request does.
281
283
 
282
284
  - `approved-record-task`: Cites an approved record and carries a task section and a done-when block.
283
285
  - `grilling-required`: States that a decision session is needed before work.
284
- - `decide-by-change-request`: States that a change request decides it.
285
286
  - `disabled-test`: Names a test in the form `DISABLED test_…`.
286
287
  - `flaky-label`: Carries a flaky label.
287
288
  - `backport`: Asks for a backport or a cherry-pick to a release branch.
@@ -349,7 +350,11 @@ stage once per flow. Leave it out when no flow is named.
349
350
 
350
351
  ## Examples
351
352
 
352
- Each request is followed by its extraction. Fields not shown are empty.
353
+ Each request is followed by its extraction. Fields not shown are empty. The examples leave them out
354
+ for brevity; the file handed to `plan` writes every required field (`intent`, `entryFlags`,
355
+ `qualifiers`, `signals`, `risks`, `artifacts`, `confidence`), each empty list as `[]`, or `plan`
356
+ refuses it. `flows` and `alternatives` stay absent when unused: `plan` refuses an empty
357
+ `alternatives`, and any `alternatives` at `confidence: high`.
353
358
 
354
359
  - "An empty phone number returns 500; the spec says 400." → `{ intent: defect, entryFlags: [repro, expect], artifacts: [code, tests], confidence: high }`
355
360
  - "Is the work complete?", asked of the session that did it → `{ intent: question-why, qualifiers: [session-answerable], confidence: high }`
@@ -365,9 +370,9 @@ Each request is followed by its extraction. Fields not shown are empty.
365
370
  - "We only handle one kind of engagement now: remove its form field and list filter, and every mention of the other kind." → `{ intent: behaviour-change, qualifiers: [removal-requested], artifacts: [spec, contract, ui, code, tests, docs], confidence: high }`
366
371
  - "Rename workspace to project everywhere: the specification, the code, the screens and the tests." → `{ intent: behaviour-change, qualifiers: [rename-requested], artifacts: [spec, contract, ui, code, tests, docs], confidence: high }`
367
372
  - "Remove the configuration key nothing reads." → `{ intent: unenforced, qualifiers: [mechanism-inert, removal-requested], artifacts: [code, tests, config], risks: [breaking], confidence: high }`
368
- - An approved change request cited with a task section and a done-when block → `{ intent: order, entryFlags: [upstream], qualifiers: [settled-design], signals: [approved-record-task], artifacts: [spec, contract], confidence: high }`
373
+ - An approved decision cited with a task section and a done-when block → `{ intent: order, entryFlags: [upstream], qualifiers: [settled-design], signals: [approved-record-task], artifacts: [spec, contract], confidence: high }`
369
374
  - "The import fails and the `catch` logs nothing, so the cause cannot be read; log the error there." → `{ intent: defect, entryFlags: [cause, fix, expect], artifacts: [code, tests], confidence: high }`
370
- - "Merging main left conflicts in the decision register; renumber our colliding rows and keep both sides." → `{ intent: stale-record, qualifiers: [meaning-preserving], artifacts: [spec], confidence: high }`
375
+ - "Merging main left conflicts in our story files; give our colliding story the next free ID and keep both sides." → `{ intent: stale-record, qualifiers: [meaning-preserving], artifacts: [spec], confidence: high }`
371
376
  - "Take main's shared fix into the branches feature-a and feature-b, keeping what each side means.", read once for each named branch and run one after another → `{ intent: order, qualifiers: [meaning-preserving], artifacts: [spec, docs], confidence: high }`
372
377
  - "Release 2.4.0. You run the preparation and merge the release pull request; I only approve the publish." → `{ intent: release, qualifiers: [release-delegated], artifacts: [release], confidence: high }`
373
378
  - "Give the live dashboard a calmer palette and softer page transitions; keep every screen and field as it is." → `{ intent: feature, qualifiers: [visual-open, restyle], artifacts: [ui], confidence: high }`
@@ -271,7 +271,7 @@ using it, preserve target edits in a permitted commit of only its paths, and
271
271
  ensure the whole index and worktree are clean. Unknown dirty files postpone
272
272
  the switch; do not stash, reset or delete them to move on. A reviewer using
273
273
  live files or checkout-dependent execution must finish. A read-only reviewer
274
- using only `git show <fixed SHA>:<path>` may continue across a clean orchestrator switch;
274
+ using only `git show <fixed SHA>:<path>` may continue across a clean session-agent switch;
275
275
  the reviewer never switches the checkout. Pending gates delegated (CI-only or
276
276
  by instruction) use the existing DELEGATED commit allowance only under a user
277
277
  instruction or project policy covering that verification commit and its tracked
@@ -355,6 +355,6 @@ reset, a stash, a branch switch or a worktree removal.
355
355
  Read this section when parts ran in parallel. Report one row per part given to
356
356
  a sub-agent.
357
357
 
358
- | Step | Role (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
359
- | ---- | ---------------- | --------------- | ----------------- | ------------- | ------------- | ---------------------------- |
360
- | 1 | `<role>` | `<instance id>` | `<part in words>` | The step file | The result | PASS/REVISE |
358
+ | Step | Agent (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
359
+ | ---- | ----------------- | --------------- | ----------------- | ------------- | ------------- | ---------------------------- |
360
+ | 1 | `<agent>` | `<instance id>` | `<part in words>` | The step file | The result | PASS/REVISE |
@@ -5,7 +5,7 @@ What `qfai-run` does at a step the plan marks with a release point, a decision p
5
5
  ## Release point
6
6
 
7
7
  Before a step `releasePoint` names runs, ask the user to approve the release; where it is `end`, ask once the last stage's gates have passed.
8
- Record the approval as step 7 of `SKILL.md` says: a `decisions.md` row the run writes, or, when the release change is produced outside this run, the final report, with the row appended by the next change that touches `decisions.md`.
8
+ Record the approval as step 7 of `SKILL.md` says: a `decisions.md` row the run writes when the approval meets the recording test, the final report otherwise, or, when the release change is produced outside this run, the final report, with any row appended by the next change that touches `decisions.md`.
9
9
  Rerun the gates over any row written. `verify-commit` runs after that, so the commit holds any approval row written. Nothing after it
10
10
  runs without the approval, which authorizes no push, merge, tag or publication.
11
11
 
@@ -6,19 +6,6 @@ argument-hint: "[<BF-ID-or-name>] [--contract <contract-ID-or-path>] [--auto]"
6
6
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Agent, Bash]
7
7
  steps: [sdd-triage, sdd-flow, sdd-story, sdd-contract, common-design-md, sdd-cycle, sdd-gate]
8
8
  requires: [common-review-cycle]
9
- roles:
10
- [
11
- orchestrator,
12
- delivery-planner,
13
- requirements-analyst,
14
- solution-architect,
15
- product-experience-architect,
16
- test-design-analyst,
17
- qa-strategist,
18
- architecture-reviewer,
19
- requirements-reviewer,
20
- product-surface-reviewer,
21
- ]
22
9
  mode: approval-gated
23
10
  ---
24
11
 
@@ -26,10 +13,8 @@ mode: approval-gated
26
13
 
27
14
  ## /qfai-sdd
28
15
 
29
- [DRIFT-PROTOCOL:REQUIRED]
30
-
31
16
  Run the entry check of
32
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
17
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
33
18
  first.
34
19
 
35
20
  Turn a requirement into a checkable story tree: BF → US → AC → EX, with each BR
@@ -58,15 +43,15 @@ Run the steps in this order, as
58
43
  states: read `.qfai/assistant/step/<id>/STEP.md` for the current step only, run
59
44
  it, then move to the next.
60
45
 
61
- | Step | What it does | Skipped when |
62
- | ------------------ | -------------------------------------------------------------- | ---------------------------------------------------------- |
63
- | `sdd-triage` | Source, preflight, triage, approvals and ID allocation | Never |
64
- | `sdd-flow` | Policy, `tech.md` and business flows | Triage changed no policy fact and no flow |
65
- | `sdd-story` | Stories, Gherkin AC and EX | Never |
66
- | `sdd-contract` | Contracts and the BRs they enforce, or the `--contract` repair | Triage changed no BR and no contract |
67
- | `common-design-md` | Root `DESIGN.md` | The flow is not UI-bearing, or its surface is CLI-only |
68
- | `sdd-cycle` | The concrete-abstract cycle between BRs and EXs | `sdd-contract` wrote or changed no BR Statement or Example |
69
- | `sdd-gate` | Per-flow `validate --profile sdd` and the flow report | Never |
46
+ | Step | What it does | Skipped when |
47
+ | ------------------ | --------------------------------------------------------------- | ---------------------------------------------------------- |
48
+ | `sdd-triage` | Source, preflight, triage, critical decisions and ID allocation | Never |
49
+ | `sdd-flow` | Policy, `tech.md` and business flows | Triage changed no policy fact and no flow |
50
+ | `sdd-story` | Stories, Gherkin AC and EX | Never |
51
+ | `sdd-contract` | Contracts and the BRs they enforce, or the `--contract` repair | Triage changed no BR and no contract |
52
+ | `common-design-md` | Root `DESIGN.md` | The flow is not UI-bearing, or its surface is CLI-only |
53
+ | `sdd-cycle` | The concrete-abstract cycle between BRs and EXs | `sdd-contract` wrote or changed no BR Statement or Example |
54
+ | `sdd-gate` | Per-flow `validate --profile sdd` and the flow report | Never |
70
55
 
71
56
  `sdd-triage` records whether each affected flow is UI-bearing. A step that
72
57
  changes an input an earlier step consumed reruns that step's authors and
@@ -29,8 +29,8 @@ No cycle runs when:
29
29
 
30
30
  ## The finder
31
31
 
32
- The finder is a sub-agent, such as a `test-design-analyst`, that wrote none of
33
- the BRs it reads. The orchestrator starts it; a stage worker starts none. It
32
+ The finder is a sub-agent on `requirements-reviewer`, started from a fresh context, that wrote none of
33
+ the BRs it reads. The session agent starts it; a stage worker starts none. It
34
34
  reads:
35
35
 
36
36
  - each BR whose Statement or Examples cell this invocation wrote or changed;
@@ -68,24 +68,23 @@ no EX is appended for it, and no row is written.
68
68
 
69
69
  The age of the target decides the route.
70
70
 
71
- | Target | Route |
72
- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
73
- | An AC, EX or BR this invocation wrote | Changed directly, with no approval. An AC it wrote is split the same way, with no approval, and each EX re-cites the criterion it exercises |
74
- | An item that existed when the invocation started | Changed directly only under an in-force `Change request:` row (WIP, or DONE on this branch) whose approved change covers this change |
75
- | The same item, with no row that covers the change | The change is put to the user, and the item stays unchanged until the user approves it |
76
- | Creating, splitting, merging or retiring a BF or US | Put to the user, even when this invocation wrote the item |
77
-
78
- A row naming the file does not cover a change it did not describe. The drift
79
- protocol approves a proposed change and its affected set as written
80
- (`.qfai/assistant/rule/drift-protocol.md#when-drift-is-detected`). An approved
81
- change is written with one `Change request:` row naming the files it changes,
82
- as
83
- `.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md#a-change-to-the-story-tree`
71
+ | Target | Route |
72
+ | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
+ | An AC, EX or BR this invocation wrote | Changed directly, with no approval. An AC it wrote is split the same way, with no approval, and each EX re-cites the criterion it exercises |
74
+ | An item that existed when the invocation started | Changed directly when the user's request in this session names that change; otherwise put to the user as a critical decision, and the item stays unchanged until the user answers |
75
+ | Creating, splitting, merging or retiring a BF or US | Put to the user, even when this invocation wrote the item |
76
+
77
+ An answer covers only the change it described. The drift protocol decides a
78
+ proposed change and its affected set as written
79
+ (`.qfai/assistant/rule/drift-protocol.md#when-drift-is-detected`). The decision
80
+ is recorded only when it passes the recording test, as
81
+ `.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md#critical-decisions-and-no-question-mode`
84
82
  sets out.
85
83
 
86
- Under `--contract`, a finding that only a story change answers asks the user for
87
- a wider change request naming the story file. The story file stays byte for byte
88
- unchanged, and the contract is repaired only within the scope already approved.
84
+ Under `--contract`, a finding that only a story change answers is put to the
85
+ user as a critical decision naming the story file. Until the user answers, the
86
+ story file stays byte for byte unchanged, and the contract is repaired only
87
+ within the triaged scope.
89
88
 
90
89
  After the cycle's changes are applied, rewrite each BR they affect from its
91
90
  updated EXs.
@@ -97,17 +96,15 @@ updated EXs.
97
96
  - No third cycle runs, even when the second adopted one.
98
97
 
99
98
  A finding still undecided when the session ends becomes one `open-questions.md`
100
- row at TODO whose Content opens `Unadjudicated:`, followed by the finding and
101
- its target IDs. The per-flow gate reports that row as `QFAI-SPACK-102` until it
102
- is decided.
99
+ row whose Content opens `Unadjudicated:`, followed by the finding and
100
+ its target IDs. The per-flow gate reports that row as `QFAI-SPACK-102` while it
101
+ exists.
103
102
 
104
103
  Under `--auto` nothing is asked. A finding that would go to the user becomes
105
104
  that row in the cycle that raised it.
106
105
 
107
- The row changes `open-questions.md`, which the drift gate protects. The change
108
- request the user approves when the finding is decided names
109
- `open-questions.md`, and that row is what authorizes the change. Until then the
110
- per-flow gate holds the flow, so no later stage builds on it.
106
+ While the row exists the per-flow gate holds the flow, so no later stage builds
107
+ on it.
111
108
 
112
109
  No other record is written. A finding the session decided, and one it dropped,
113
110
  append no row.
@@ -118,13 +115,14 @@ Within a session, the finder does not raise a finding again when either holds:
118
115
 
119
116
  - It has the kind and target IDs of a finding the session already decided, and
120
117
  its case is equal to that case, includes it, or is included in it.
121
- - The proposed change of a change request the user declined already answers
122
- it. A declined change request is the user deciding that finding, and its
123
- REJECTED row in `decisions.md` bars the finding it answers.
118
+ - A change the user declined already answers it. A declined change is the user
119
+ deciding that finding, and its `Declined:` row in `decisions.md` bars the
120
+ finding it answers.
124
121
 
125
122
  Matching never goes by wording. A declined change for `BR-0006-0001` and
126
123
  `EX-0002-0003-02` whose case is "an order of 20 000 in euros" also bars "an order
127
124
  of 20 000 in any currency other than the default", however either is worded. It
128
125
  does not bar a finding on the same IDs for an order of exactly 10 000.
129
126
 
130
- A decision appended to reopen a REJECTED row lifts it.
127
+ A later decision row whose Approach opens `Reopens DEC-…` with the declined
128
+ row's ID lifts it.
@@ -32,6 +32,17 @@ Discussion UI/UX files are **non-normative** discovery / reference artifacts —
32
32
  ## Rules
33
33
 
34
34
  - Keep contract files minimal: only what flows, stories, and tests actually reference.
35
+ - Every entry in a UI contract's `screens[]` carries at least one
36
+ `primary_task`. An empty `primary_tasks` array blocks `/qfai-prototyping` at
37
+ the validate lane, under `QFAI-AUD-001`. The shipped `ui-contract.sample.yaml`
38
+ carries filled entries; replace them with the screen's own rather than
39
+ emptying the list.
40
+ - A screen may describe its copy in the optional `supplements` and `structure`.
41
+ Check each proposed text against the screen's tasks and the information the
42
+ user needs there. A text that only repeats a heading, an action or a
43
+ condition the user already has is left out. Validate does not check these
44
+ keys; it checks that every plain text in the UI source carries a `qfai-text`
45
+ reason comment.
35
46
  - UI contracts must be mockable for prototypes: define stable `elements` and
36
47
  `actions` with enough inspection-target text for Playwright evidence.
37
48
  - **The `prototype` mapping is optional, and what it declares is checked.** A
@@ -53,7 +64,6 @@ Discussion UI/UX files are **non-normative** discovery / reference artifacts —
53
64
  not only where the attribute is written out — a framework that builds the
54
65
  attribute from a variable still writes the marker somewhere.
55
66
  - **Every entry under `screens` is a screen, once.** Each UI-bearing contract declares one full `UI-NNNN` ID and a nonempty `screens[]` list. Each screen has an ID and route, unique within its contract. The prototyping cycle covers all declared UI-bearing contract IDs; filenames do not select a legacy spec tier. `QFAI-CONTRACT-042` names malformed screen entries.
56
- - **Every screen states the text it shows.** A screen declares `supplements` (`[]` when it shows none) and may declare `structure`. `QFAI-CONTRACT-043` names a key that is absent or malformed, `QFAI-CONTRACT-044` an id the screen does not declare, and `QFAI-CONTRACT-045` a text shown twice; and, with `--rendered`, `QFAI-CONTRACT-046` to `QFAI-CONTRACT-048` compare rendered text with the lists.
57
67
  - **A contract's ID comes from its directory.** `api/` holds `API` contracts,
58
68
  `db/` `DB` and `ui/` `UI`; the QFAI repository's own `cli/` holds `CLI`
59
69
  contracts. The ID is `<KIND>-NNNN`.
@@ -273,8 +283,8 @@ For each affected AC, EX, and BR, name the contract that realizes it. Resolve ev
273
283
 
274
284
  A `--contract` rerun reads all existing flows that reference the changed contract or its paired contracts. After each
275
285
  contract repair, recompute the affected set and recheck every obligation in it until a pass writes nothing and adds no
276
- flow. Read scope can expand; write scope stays within the approved change-request row. If a repair needs an unapproved
277
- contract or story edit, stop and append a new decision row covering that change. A confirm-only review is read-only and
286
+ flow. Read scope can expand; write scope stays within the triaged scope. If a repair needs a contract or story edit
287
+ outside it that is a critical decision, put it to the user and stop the dependent edit. A confirm-only review is read-only and
278
288
  cannot close a mismatch.
279
289
 
280
290
  ## Review checklist