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,25 +1,25 @@
1
1
  # Delegated session
2
2
 
3
3
  How the session agent runs a round between agents: who is asked, how the
4
- answers are held, and which role puts the round.
4
+ answers are held, which agent puts the round, and when the session ends.
5
5
 
6
- ## Several authors
6
+ ## The author
7
7
 
8
- A round between agents may have several authors, because one frontier can hold
9
- decisions belonging to different drafting roles.
8
+ The session agent authors every draft, so a round between agents has one
9
+ author: the session agent. The griller is a `requirements-reviewer`, or an
10
+ `architecture-reviewer` where the decision is a contract or architecture
11
+ decision, started from a fresh context and a black-box brief.
10
12
 
11
- - The round goes to **every author whose decisions it contains**, each seeing
12
- the whole round. A decision reads differently beside the ones next to it, and
13
- an author shown only its own share cannot say so.
13
+ - The round shows the author **the whole round**. A decision reads differently
14
+ beside the ones next to it.
14
15
  - **Every answer is collected before the frontier is recomputed.** Recomputing
15
16
  on the first reply settles the rest against a tree that moved under them.
16
- - **Two authors answering one question differently is itself a decision**, and
17
- it joins the frontier rather than being averaged. If the budget ends with it
18
- open, it takes the griller's recommendation like any other non-critical
19
- decision, with both positions recorded.
20
- - **An addition an author proposes is asked what part of the request needs
17
+ - **An author answer that differs from the griller's recommendation is kept**,
18
+ with both positions recorded. If the budget ends with it open, it takes the
19
+ griller's recommendation like any other non-critical decision.
20
+ - **An addition the author proposes is asked what part of the request needs
21
21
  it.** One nobody can point to is dropped, not adopted.
22
- - **A fact only the user holds goes to the user, not to an author.** No author
22
+ - **A fact only the user holds goes to the user, not to the author.** No author
23
23
  can answer an unpublished constraint or an intention nobody wrote down, and
24
24
  the convergence rules escalate decisions rather than facts — so without this
25
25
  the fact sits on the frontier until the budget ends, taking every decision
@@ -32,13 +32,13 @@ decisions belonging to different drafting roles.
32
32
  beside the open question, which is the ordinary no-question path. Stopping on
33
33
  every user-held fact would block a run over a defaultable date.
34
34
 
35
- ## Orchestrator protocol
35
+ ## Session agent protocol
36
36
 
37
- - The orchestrator computes the frontier and reads the answers. It does not
37
+ - The session agent computes the frontier and reads the answers. It does not
38
38
  decide a frontier question on anyone's behalf.
39
39
  - **Who puts the round depends on the mode, and exactly one role does.** With a
40
- user, the orchestrator puts it. Between agents, the griller puts it and the
41
- orchestrator does not — a session where both do is one where an author is
40
+ user, the session agent puts it. Between agents, the griller puts it and the
41
+ session agent does not — a session where both do is one where an author is
42
42
  asked twice and the two answers have no tie-break.
43
43
  - It must not record an answer **as the user's** that the user did not give, and
44
44
  must not self-approve the session's end condition. An author's answer in an
@@ -47,7 +47,7 @@ decisions belonging to different drafting roles.
47
47
  escalation cannot carry the positions to the user unless the answers are
48
48
  held.
49
49
  - **In a delegated session the griller's recommendation settles a decision that
50
- is not critical.** Where the authors and the griller land on one answer, or
50
+ is not critical.** Where the session agent and the griller land on one answer, or
51
51
  the budget ends first, the recommendation is taken and the stage records it as
52
52
  `agents`, with the reason and every disagreeing position. The stage's final
53
53
  report lists it; nothing waits for the user to read it.
@@ -57,3 +57,20 @@ decisions belonging to different drafting roles.
57
57
  under `.agents/rules/grilling.md#explicit-delegation-for-a-discussion` settles
58
58
  it. Record that authority separately from the agents' positions. Agreement
59
59
  alone does not settle it, and an unknown user-held fact still stays open.
60
+
61
+ ## When a delegated session ends
62
+
63
+ **A delegated session has no condition 2**, because no user is there to
64
+ confirm. A budget bounds its rounds: two, then every decision that is not
65
+ critical takes the griller's recommendation — the ones the agents agreed on and
66
+ the ones still open alike. An uncovered critical decision goes to the user
67
+ when asking is permitted, without spending a round
68
+ (`.qfai/assistant/rule/review-convergence.md`). It ends `adopted` once
69
+ the master's conditions hold: no open node or lookup, required inputs present,
70
+ and actual authority for critical decisions. Record agent choices as agents'.
71
+
72
+ **The budget ends the rounds, not the session.** While a critical decision
73
+ lacks an actual answer or applicable recorded authorization, it stays open: the
74
+ user answers it, or ends the session another way — or, under a no-question
75
+ mode, the register write ends it `no-question`. How many went is a count a
76
+ record carries, never an ending.
@@ -9,9 +9,9 @@ Use the shared schema from
9
9
  `.qfai/assistant/rule/shared-skill-delegation-baseline.md`, including the
10
10
  `Agent instance` column.
11
11
 
12
- | Step | Role (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
13
- | ---- | ---------------- | --------------- | ------------------------------- | ------------------------------- | ------------------------------- | ---------------------------- |
14
- | 1 | Reviewer | `<instance id>` | Read the facts a round waits on | Decision and what it depends on | The fact, and where it was read | PASS/REVISE |
12
+ | Step | Agent (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
13
+ | ---- | -------------------- | --------------- | ------------------------------- | ------------------------------- | ------------------------------- | ---------------------------- |
14
+ | 1 | `fullstack-engineer` | `<instance id>` | Read the facts a round waits on | Decision and what it depends on | The fact, and where it was read | PASS/REVISE |
15
15
 
16
16
  ## What the reviewer confirms
17
17
 
@@ -4,20 +4,6 @@ title: QFAI Implement (TDD micro-cycle)
4
4
  description: "Use when invoked by name or handed a QFAI work order to implement, diagnose or repair the examples of one business flow."
5
5
  argument-hint: "<BF-ID> [EX-ID...]"
6
6
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite, Task, Agent]
7
- roles:
8
- [
9
- orchestrator,
10
- delivery-planner,
11
- test-design-analyst,
12
- qa-strategist,
13
- acceptance-test-engineer,
14
- frontend-engineer,
15
- backend-engineer,
16
- devops-ci-engineer,
17
- implementation-reviewer,
18
- product-surface-reviewer,
19
- doc-steward,
20
- ]
21
7
  steps:
22
8
  - implement-scaffold
23
9
  - implement-credentials
@@ -47,10 +33,8 @@ mode: approval-gated
47
33
 
48
34
  ## /qfai-implement — Implement a business flow
49
35
 
50
- [DRIFT-PROTOCOL:REQUIRED]
51
-
52
36
  Run the entry check of
53
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
37
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
54
38
  first.
55
39
 
56
40
  ## Inputs
@@ -127,7 +111,7 @@ its work order names the flow; this file adds nothing.
127
111
 
128
112
  After the last step, run one review through `common-review-cycle`: the code
129
113
  review, by `implementation-reviewer`. The review also checks for code
130
- written only to pass a test: no value hard-coded to the test's inputs and no branch written only for the test, and a wrong test or infeasible task raised as a Change Request, not worked around
114
+ written only to pass a test: no value hard-coded to the test's inputs and no branch written only for the test, and a wrong test or infeasible task raised as a specification change, not worked around
131
115
  (`.qfai/assistant/rule/test-layers.md#a-passing-test-is-not-the-solution`).
132
116
 
133
117
  The review also checks that the
@@ -2,38 +2,70 @@
2
2
 
3
3
  ## Default
4
4
 
5
- Process one open EX at a time in ascending ID order within the selected BF flow. Parallel item work requires explicit user approval and a delivery-planner PASS on concrete independence. Parallel role review of one item does not require parallel item authorization.
5
+ Process one open EX at a time in ascending ID order within the selected BF
6
+ flow. The session agent does the work itself. Work orders for several flows run
7
+ one at a time, in ascending flow ID order; the stage's review runs once, after
8
+ the last.
6
9
 
7
- ## Work orders per flow
10
+ ## Units
8
11
 
9
- When the extraction declares several flows, the plan gives each implement stage
10
- one work order per flow, its `target` naming that flow, in ascending flow ID
11
- order. Run them one at a time in that order. Each runs every step of the stage
12
- for its own flow and completes on that flow's gates. The stage's review runs
13
- once, after its last work order. Two work orders run in
14
- parallel only with explicit user approval and a delivery-planner PASS on the
15
- independence gate below, compared across both flows.
12
+ Two kinds of unit may run in parallel, each on its own `fullstack-engineer`:
16
13
 
17
- ## Independence gate
14
+ | Unit | Where | What the worker does |
15
+ | ------ | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | Story | An implement stage only | Runs the stage's steps for one user story no EX of which a test annotates yet, in ascending EX ID order, writing only its owned paths |
17
+ | Lookup | Discussion research, a grilling session, the web-research search, fetch and verify stages | Answers one self-contained question from the repository or the web, writes nothing, and returns the answer with its sources |
18
18
 
19
- For each candidate item, name its production files, test files, contracts, fixtures, schema or database objects, and shared resources such as ports. Disjoint filenames alone are insufficient: compare read and write sets, imports, shared fixtures, persistence, generated assets, and external process state. If any dependency is uncertain, use serial execution.
19
+ Everything else runs in the session agent: the specification, the discussion
20
+ interview and pack, prototyping, triage, verify, maintenance, the framing of
21
+ research and the reading of its answers, and every change to a story that is
22
+ already implemented.
20
23
 
21
- Deny parallel dispatch when two items write the same shared fixture or mock file, or mutate the same fixture instance. A shared fixture module that both items only read as-is does not by itself deny parallel dispatch.
24
+ ## Parallel-unit gate
22
25
 
23
- Give each worker an exact file ownership list and a checkout assigned by the host.
24
- Use separate worktrees when the host supports editing them; otherwise use the
25
- existing shared-index mode in
26
- `.qfai/assistant/rule/workflow.md#concurrency-stage-independent-mandatory`.
26
+ The session agent fans out only when every condition holds for every pair of
27
+ units. It decides alone, records the result in the stage report, and asks the
28
+ user nothing.
29
+
30
+ | # | Condition |
31
+ | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
32
+ | G1 | Each unit is a story unit or a lookup unit, as above |
33
+ | G2 | There are two or more units, and the stage report records that each is large enough to be worth a brief |
34
+ | G3 | Written artifacts hold everything a unit needs: step files, story-tree IDs, contracts, `decisions.md`. A unit whose brief would retell the conversation runs in the session agent |
35
+ | G4 | Writes are disjoint, compared by read and write sets rather than by file name: production files, test files, fixtures, schema or database objects, generated assets, and shared resources such as ports |
36
+ | G5 | No unit needs another unit's output |
37
+ | G6 | Each unit returns a small result: a diff on its owned paths with its selectors' results, or a cited answer |
38
+
39
+ Two units that write the same shared fixture or mock file, or mutate the same
40
+ fixture instance, fail G4. A shared fixture module that both only read as-is
41
+ does not fail it on its own. Where any condition is uncertain, the units run
42
+ serially.
43
+
44
+ ## Briefing a unit
45
+
46
+ Give each worker a self-contained brief, never a fork of the session's
47
+ conversation: the step files to run, the story-tree IDs, the exact owned-path
48
+ list (empty for a lookup), the checks to run and the shape of its answer.
49
+ Give each a checkout assigned by the host. Use separate worktrees when the host
50
+ supports editing them; otherwise use the existing shared-index mode in
51
+ `.qfai/assistant/rule/workflow.md#concurrency-every-stage`.
27
52
  Creating a worktree does not grant edit permission. For a refused edit, follow
28
53
  `.qfai/assistant/rule/shared-skill-delegation-baseline.md#worker-edit-boundary`.
29
- Workers do not change another worker's files or the story tree. The orchestrator
30
- integrates their results and resolves every overlap before judging either item
31
- complete.
54
+ Workers do not change another worker's files or the story tree.
32
55
 
33
56
  ## Integration gate
34
57
 
35
- After integration, rerun every item selector on the merged tree, the relevant suites, and qfai validate --profile tdd --fail-on error --flow BF-NNNN. Retake evidence whose source revision changed and request the required reviews on that revision. A worker's isolated PASS is not an integrated PASS.
58
+ The session agent integrates the results and resolves every overlap before
59
+ judging any story complete. It reruns every story unit's selectors and
60
+ `npx qfai validate --profile tdd --fail-on error --flow BF-NNNN` on the merged
61
+ tree; the suites run once, in the verify stage. A worker's isolated PASS is not
62
+ an integrated PASS.
36
63
 
37
- On an integration failure, assign the defect to the owning item when the dependency is known. When the combination itself causes the failure, stop parallel dispatch and repair serially. Record the decision and results in the flow evidence. The decision's record carries the four labelled Approach items stated at the top of `.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md`.
64
+ On an integration failure, assign the defect to the owning story when the
65
+ dependency is known. When the combination itself causes the failure, stop the
66
+ fan-out and repair serially. Record the gate's result and the integration
67
+ results in the stage report. The decision's record is a short decision record in
68
+ the form stated at the top of
69
+ `.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md`.
38
70
 
39
71
  Host limits above this policy: `.qfai/assistant/rule/shared-skill-delegation-baseline.md#host-backstops-above-the-declared-shape`.
@@ -4,8 +4,41 @@
4
4
 
5
5
  Read the UI surface paths `uiux.surfacePaths` declares in qfai.config.yaml, and resolve paths.contractsDir from the same file. Read every UI contract under its ui/ directory, and the root DESIGN.md if present for the brand tokens.
6
6
  When a prototyping loop ran in this checkout, read its handoff at .qfai/prototype/final/handoff.json: the final prototype, its procurement and the implementation notes, or, for a restyle, its live routes, its stylesheet and motion entry points and the implementation notes.
7
+ When `.qfai/prototype/progress.md` records `iterationKind` `restyle` with `restyleLevel` `none` and no handoff was written, the restyle stopped with nothing to fix: implement makes no change to the screens it covered.
7
8
  Read the flow, story, acceptance criterion, and example that the implementation changes.
8
- For each screen the change renders, read its `supplements` and `structure` in the UI contract before adding text: the screen shows its title, group headings, labels and declared supplements, and no other text.
9
+
10
+ ## Plain text in UI source
11
+
12
+ `npx qfai validate` reads `.qfai/prototype/final/index.html`, the `index.html` of the latest `iter-NN/`, and the
13
+ `.html`, `.tsx`, `.jsx`, `.vue` and `.svelte` files `uiux.surfacePaths` selects, except test, spec and story
14
+ files. A plain text there is a literal text node, non-empty after trimming and sample data included, outside
15
+ `h1`-`h6`, `label`, `button`, `a` (and `Link`, `RouterLink`, `NuxtLink`), `legend`, `th`, `caption`, `option`,
16
+ `summary`, `title`, `script`, `style` and an element with `role="alert"` or `role="status"`. Attribute values
17
+ and expressions are never plain text; a string literal that is a whole JSX child is.
18
+
19
+ Each plain text needs a reason comment directly before it, or before its parent element, with only whitespace
20
+ between. A missing reason is `QFAI-UITEXT-001` and a malformed one `QFAI-UITEXT-002`; `QFAI-UITEXT-003` means a `.tsx` or `.jsx` file is selected but `typescript` cannot be resolved from the project root. All three are errors and cannot be waived.
21
+
22
+ For a text you cannot justify, try these in order:
23
+
24
+ 1. Delete it.
25
+ 2. Replace it with another component: an icon with an accessible name, a disabled state, a badge.
26
+ 3. Move its job to an element already there: a label, a heading, the button wording, the empty state.
27
+ 4. Only then write the reason.
28
+
29
+ ```html
30
+ <!-- qfai-text: why=the fee is charged only on this step; without=users pay a fee they never saw -->
31
+ <p>A 2% fee applies to card payments.</p>
32
+ ```
33
+
34
+ ```tsx
35
+ <section>
36
+ {/* qfai-text: why=the fee is charged only on this step; without=users pay a fee they never saw */}
37
+ <p>A 2% fee applies to card payments.</p>
38
+ </section>
39
+ ```
40
+
41
+ Vue and Svelte use the HTML form. Both keys are required and non-empty, no other key is allowed, and `why` and `without` must say different things. The reason names the specific failure the text prevents; "helps the user" is not a reason.
9
42
 
10
43
  ## Routing
11
44
 
@@ -24,4 +57,4 @@ For a UI affecting example, report the screen state, action, expected and observ
24
57
 
25
58
  A fix made for a finding of that review refreshes the capture it changes, and a fix that changes behaviour gets its one focused re-review (`.qfai/assistant/rule/review-convergence.md#one-review`). A passing code test cannot substitute for the visual and interaction evidence that the acceptance criterion requires.
26
59
 
27
- Capture each declared task at a desktop width and a narrow width, in the normal state and in every declared empty, error, loading and success state the screen has. A text the contract declares that the capture lacks, or a text the capture shows that the contract does not declare, is a finding.
60
+ Capture each declared task at a desktop width and a narrow width, in the normal state and in every declared empty, error, loading and success state the screen has.
@@ -4,7 +4,6 @@ title: QFAI Maintain (Non-normative edits)
4
4
  description: "Use when invoked by name or handed a QFAI work order. Use it for a change to wording, a typo, a code comment or document prose that is meant to change no behaviour."
5
5
  argument-hint: "<the text or comment to change>"
6
6
  allowed-tools: [Read, Glob, Grep, Write, Edit, Bash, TodoWrite, Task, Agent]
7
- roles: [orchestrator, doc-steward, implementation-reviewer]
8
7
  steps: [maintain-edit]
9
8
  requires: [common-review-cycle]
10
9
  mode: execution-focused
@@ -12,10 +11,8 @@ mode: execution-focused
12
11
 
13
12
  ## /qfai-maintain - Non-normative edits
14
13
 
15
- [DRIFT-PROTOCOL:REQUIRED]
16
-
17
14
  Run the entry check of
18
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
15
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
19
16
  first.
20
17
 
21
18
  ## Inputs
@@ -33,7 +30,7 @@ Questions to the user follow
33
30
  edit with a semantic effect.
34
31
 
35
32
  Run the steps as
36
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#running-steps-mandatory`
33
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#running-steps`
37
34
  sets out: read `.qfai/assistant/step/<name>/STEP.md` for the current step only,
38
35
  run it, then the next. No step is skipped.
39
36
 
@@ -3,21 +3,10 @@ name: qfai-migration-v1-to-v2
3
3
  title: QFAI 1.x to 2.x Migration
4
4
  description: "Move an existing QFAI 1.x spec-pack project to the 2.x story-based spec tree using the bundled steps, then install and check the free-text entry. Use when asked to migrate a project that still holds QFAI 1.x spec packs."
5
5
  allowed-tools: [Read, Glob, Write, Edit, Bash]
6
- roles:
7
- [
8
- orchestrator,
9
- requirements-analyst,
10
- solution-architect,
11
- devops-ci-engineer,
12
- architecture-reviewer,
13
- ]
14
- routing-profile: architecture-heavy
15
6
  ---
16
7
 
17
8
  ## /qfai-migration-v1-to-v2
18
9
 
19
- [DRIFT-PROTOCOL:REQUIRED]
20
-
21
10
  ## User Questions (AskUserQuestion Protocol)
22
11
 
23
12
  Follow `.qfai/assistant/rule/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`
@@ -132,9 +121,7 @@ keep authors separate from reviewers.
132
121
  `## Reminder hooks`, the line about trusting the Codex hooks with `/hooks`
133
122
  included. Step 12 checks the entry and writes nothing.
134
123
  7. Resolve every item step 12 lists under `## For a person`. Rerun step 11 for
135
- an item it installs, and step 10 for a `gitignore` item. A
136
- `qfai.config.yaml` routing override is the project's, so ask its owner
137
- before changing it. Resolve each `old-path` item with the
124
+ an item it installs, and step 10 for a `gitignore` item. Resolve each `old-path` item with the
138
125
  person who wrote the file, by rewording the line so that it no longer names
139
126
  the old path, using the 2.x path that the guide's table gives for it. Rerun step 12 until it exits 0.
140
127
  8. Then run `npx qfai validate` through the launcher proven by preflight.
@@ -178,7 +165,7 @@ saying it is already done. The complete write boundary is in
178
165
 
179
166
  ### Reviewer Gate
180
167
 
181
- The architecture reviewer checks the old-to-new mapping and preservation of
168
+ The reviewer is `architecture-reviewer`. It checks the old-to-new mapping and preservation of
182
169
  unplaced content. The reviewer checks the twelve reports, rerun
183
170
  behavior, and validation result. Enforce the Drift Protocol and
184
171
  `.qfai/assistant/rule/test-layers.md` when reviewing test obligations. Counts and effort
@@ -200,13 +200,12 @@ Finish each kind of item that a step leaves as follows:
200
200
  when step 8 rewrote the old annotations to the example level. Finish each
201
201
  with the test, or with a `decisions.md` row whose Content is `Test exception:`
202
202
  followed by the ID of the example or criterion, whose Approach holds the
203
- reason and whose Status is DONE.
203
+ reason.
204
204
  - **A test-case annotation in an E2E file.** Step 8 leaves it unchanged,
205
205
  because an example annotation there is an error, and lists its file, line,
206
206
  annotation and example. Settle it with a test outside the E2E layer annotated
207
207
  with that example, or with a `decisions.md` row whose Content is
208
- `Test exception: <EX>`, whose Approach holds the reason and whose Status is
209
- DONE. Then delete the old annotation, because step 8 lists it on each run
208
+ `Test exception: <EX>`, whose Approach holds the reason. Then delete the old annotation, because step 8 lists it on each run
210
209
  until it is deleted.
211
210
  - **An annotation of an unplaced example.** Step 8 keeps it as written and lists
212
211
  its file and line. Edit an annotation by hand only for an example step 4 left
@@ -270,19 +269,16 @@ Step 12 makes the checks a shipped plan needs of the project, checks what step
270
269
  11 installs, and lists the project files that still name a 1.x path. Each failed
271
270
  check is reported by name:
272
271
 
273
- | Check | Fails when |
274
- | ------------------ | ------------------------------------------------------------------------------------------------ |
275
- | `plan-invalid` | A step a built-in plan runs is not installed under `.qfai/assistant/step/` |
276
- | `reviewer-missing` | A `routing:` override in `qfai.config.yaml` drops a reviewer the package's default routing needs |
277
- | `invalid-mode` | `workflow.mode` is set to anything other than `active`, `shadow` or `off` |
278
- | `gitignore` | The managed `.gitignore` block differs from the one the installed package writes |
279
- | `qfai-run-link` | A host skill directory has no link to `.qfai/assistant/skill/qfai-run/` |
280
- | `old-path` | A line of a tracked project file names a 1.x path |
272
+ | Check | Fails when |
273
+ | --------------- | -------------------------------------------------------------------------------- |
274
+ | `plan-invalid` | A step a built-in plan runs is not installed under `.qfai/assistant/step/` |
275
+ | `invalid-mode` | `workflow.mode` is set to anything other than `active`, `shadow` or `off` |
276
+ | `gitignore` | The managed `.gitignore` block differs from the one the installed package writes |
277
+ | `qfai-run-link` | A host skill directory has no link to `.qfai/assistant/skill/qfai-run/` |
278
+ | `old-path` | A line of a tracked project file names a 1.x path |
281
279
 
282
280
  Run step 11 again for what it installs, and step 10 again for a `gitignore`
283
- item. A routing override belongs to the
284
- project, so its owner decides whether to restore the reviewer. Rerun step 12
285
- until it exits 0.
281
+ item. Rerun step 12 until it exits 0.
286
282
 
287
283
  ### Files the project wrote
288
284
 
@@ -172,13 +172,6 @@ Step 3 groups its `## For a person` items under `### Content` and
172
172
  or decides. `### Identifiers` holds an item that only pairs an old ID with its
173
173
  new one, such as a changed constraint ID. A group with no item is not printed.
174
174
 
175
- Step 3 writes a `routing:` override into `qfai.config.yaml` only for an entry
176
- of `agent-routing.yml` that differs from the installed default. It writes none
177
- for an entry equal to a default or to an entry a 1.x release shipped. Step 3
178
- lists each routing entry it does write under `## For a person`, with its name
179
- and a warning that a routing entry copied from a 1.x manifest hides the roles
180
- the 2.x skills declare.
181
-
182
175
  ## Business rules
183
176
 
184
177
  Rules are numbered per contract, `BR-<contract number>-NNNN` from `0001` in plan
@@ -4,14 +4,6 @@ title: QFAI Prototyping (DESIGN.md-driven UX Loop)
4
4
  description: "Use when invoked by name or handed a QFAI work order to settle a visual or interaction decision by prototyping UI contracts under the root DESIGN.md."
5
5
  argument-hint: ""
6
6
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Agent, Bash]
7
- roles:
8
- [
9
- orchestrator,
10
- product-experience-architect,
11
- devops-ci-engineer,
12
- product-surface-reviewer,
13
- implementation-reviewer,
14
- ]
15
7
  steps: [prototyping-grill, prototyping-preflight, prototyping-loop, prototyping-handoff]
16
8
  requires: [common-review-cycle]
17
9
  mode: execution-focused
@@ -19,10 +11,8 @@ mode: execution-focused
19
11
 
20
12
  ## /qfai-prototyping
21
13
 
22
- [DRIFT-PROTOCOL:REQUIRED]
23
-
24
14
  Run the entry check of
25
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
15
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
26
16
  first.
27
17
 
28
18
  The loop is static-first and file-based by default. Supported surfaces: web,
@@ -44,16 +34,17 @@ prototyping completes when the user confirms the prototype.
44
34
  Every file the loop writes stays under `.qfai/prototype/`: the session record,
45
35
  each iteration and its reviews, and the handoff. A `restyle` loop also edits
46
36
  the project's stylesheet and motion entry points its handoff names. No `qfai`
47
- command writes any of these files. The one file a command reads is the handoff record
37
+ command writes any of these files. A command reads the handoff record
48
38
  `.qfai/prototype/final/handoff.json`, which
49
- `npx qfai validate --profile saas-package` checks against the CLI-HANDOFF schema.
39
+ `npx qfai validate --profile saas-package` checks against the CLI-HANDOFF schema, and the plain text of the
40
+ current `index.html` pages, which `npx qfai validate` checks.
50
41
 
51
42
  ## Inputs Priority
52
43
 
53
44
  When unsure, read inputs in this order:
54
45
 
55
46
  - P1: `.qfai/assistant/rule/*`, and `.qfai/assistant/skill/qfai-grilling/SKILL.md` before either session — the one before the loop and the one each reviewed prototype resumes
56
- - P2: `.qfai/assistant/rule/agent-selection.md`, the routed cards under `.qfai/assistant/agent/`, and project context in the story tree
47
+ - P2: `.qfai/assistant/rule/agent-selection.md`, the cards under `.qfai/assistant/agent/`, and project context in the story tree
57
48
  - P3: root `DESIGN.md` — the brand identity every iteration is built and reviewed against
58
49
  - P4: the UI contracts under `<contractsDir>/ui/**/*.{yaml,yml}` and the references each step lists
59
50
  - P5: earlier iterations and their reviews under `.qfai/prototype/`
@@ -114,4 +105,4 @@ no question. Under a no-question mode, list any remaining actions instead.
114
105
  project_memory:
115
106
 
116
107
  - Prototyping completes on the user's confirmation; no command certifies it.
117
- - Every file the loop writes is under `.qfai/prototype/`, except the stylesheet and motion entry points a `restyle` loop edits; a `qfai` command reads only `final/handoff.json`.
108
+ - Every file the loop writes is under `.qfai/prototype/`, except the stylesheet and motion entry points a `restyle` loop edits; a `qfai` command reads only `final/handoff.json` and the plain text of the current `index.html` pages.
@@ -1,6 +1,6 @@
1
1
  # Generator Iteration Prompt
2
2
 
3
- Injected into the product-experience-architect sub-agent each iteration.
3
+ Read by the session agent, which generates, at the start of each iteration.
4
4
  Brand identity is locked by root `DESIGN.md`. Iterate on **information
5
5
  architecture**, **navigation flow**, and **usability** — not visual
6
6
  identity.
@@ -8,7 +8,7 @@ identity.
8
8
  ## Contents
9
9
 
10
10
  - Read order
11
- - HTML envelope (mandatory on every iter)
11
+ - HTML envelope (every iteration)
12
12
  - Hard constraints
13
13
  - Output layout
14
14
  - The first iteration (seed)
@@ -37,13 +37,15 @@ identity.
37
37
  `iter-(NN-1)/review.json` (critique, scores,
38
38
  `layoutAntiPatternsDetected`, `designMdViolations`,
39
39
  `pivotDirective`), `iter-(NN-2)/review.json` when present, and
40
- `progress.md`. A review or confirmation from an earlier run is not one of
40
+ `progress.md`. Where one of them is an iteration with variants, read
41
+ the review of the variant the user picked in its place, and none after a
42
+ combination or a rejection. A review or confirmation from an earlier run is not one of
41
43
  them: the run's first iteration is the first after `progress.md` records
42
44
  its `runScope`, present or absent.
43
45
  6. In a scoped run, every iteration: `runScope` in `progress.md` and
44
46
  `.qfai/prototype/final/index.html`.
45
47
 
46
- ## HTML envelope (mandatory on every iter)
48
+ ## HTML envelope (every iteration)
47
49
 
48
50
  Every `iter-NN/index.html` must start with the head below; replace
49
51
  `{{...}}` with literal values read from DESIGN.md front-matter:
@@ -261,6 +263,32 @@ The generator must express every styled surface as one of:
261
263
  entry in `designMdViolations[]`. Fix the value once and the finding clears —
262
264
  do not expect the count to track the number of places it appears.
263
265
 
266
+ ### Plain text needs a reason
267
+
268
+ `npx qfai validate` reads `final/index.html` and the latest `iter-NN/index.html`
269
+ under `.qfai/prototype/` and reports, as an error, a plain text with no reason
270
+ comment directly before it or before its parent element. Sample data in a
271
+ static page is plain text too. Plain text is a literal text node outside a heading, `label`,
272
+ `button`, `a`, `legend`, `th`, `caption`, `option`, `summary`, `title`,
273
+ `script`, `style` and `role="alert"` or `role="status"`. For a text you cannot
274
+ justify, in this order:
275
+
276
+ 1. Delete it.
277
+ 2. Replace it with another component: an icon with an accessible name, a
278
+ disabled state, a badge.
279
+ 3. Move its job to an element already there: a label, a heading, the button
280
+ wording, the empty state.
281
+ 4. Only then write the reason.
282
+
283
+ ```html
284
+ <!-- qfai-text: why=the fee is charged only on this step; without=users pay a fee they never saw -->
285
+ <p>A 2% fee applies to card payments.</p>
286
+ ```
287
+
288
+ Both keys are required, no other key is allowed, and `why` and `without` say
289
+ different things. "Helps the user" is not a reason; the reviewer rejects a
290
+ generic one.
291
+
264
292
  ## Output layout
265
293
 
266
294
  Write `.qfai/prototype/iter-NN/index.html` and nothing else. The reviewer
@@ -290,6 +318,26 @@ envelope, the one self-contained file, the `<link rel="stylesheet">` ban and
290
318
  - The seed and pivot rules below do not apply as written. The first restyle
291
319
  iteration restyles the screens as they are, and a restyle `pivot` rethinks
292
320
  only the visual treatment: screens, fields and behaviour stay.
321
+ - Change only what the `restyleLevel` in `progress.md` allows: at `targeted`,
322
+ only what the audit found, keeping the palette, type and layout; at `none`,
323
+ only the refinements the user accepted, as `progress.md` lists them.
324
+ - Keep every text the screens show: figures, proper names, field values and
325
+ copy. Changing displayed text, an icon or an image is not a restyle; report
326
+ it as a change the contract needs.
327
+
328
+ Edit the aspects a stylesheet and motion reach in this order, and finish each
329
+ across every screen in scope before starting the next: spacing, color, type,
330
+ layout, details such as radius, borders, shadows and states, then motion.
331
+ Layout means only what the stylesheet arranges; new markup is a contract
332
+ change. The order follows what depends on what:
333
+
334
+ - Spacing comes first, because once the rhythm is right every other element
335
+ reads differently.
336
+ - Type comes before layout, because a heading's size decides where it sits.
337
+ - Motion comes last, because it fits a screen that already works without it.
338
+
339
+ When nearly every rule changes, plan the aspects in this order and write the
340
+ result in one pass, as long as each aspect is applied.
293
341
 
294
342
  ### Scoped runs
295
343
 
@@ -304,10 +352,33 @@ change the scope needs outside those parts is reported, not made.
304
352
 
305
353
  ## The first iteration (seed)
306
354
 
307
- Produce one self-contained `iter-00/index.html` that satisfies the spec
355
+ Produce one self-contained `iter-NN/index.html` for the run's first
356
+ iteration (`iter-00` in a first run) that satisfies the spec
308
357
  under the DESIGN.md tokens. Lead with the user's primary task;
309
358
  respect `audience.do_not_look_like`.
310
359
 
360
+ Take the sample data from the examples that the in-scope UI contract's rules
361
+ cite: their figures, names and values. Where no example gives a value the
362
+ screen needs, write a neutral one, use it the same way on every screen, and
363
+ list it in `progress.md` as sample data no example supplies. A neutral value
364
+ is never a claim: invent no metric, customer count, customer name or
365
+ testimonial, which the design anti-pattern list names as invented proof.
366
+
367
+ When `progress.md` records `variants` other than `none`, the file holds each
368
+ listed variant of the in-scope screens:
369
+
370
+ - Each answers the same spec with a different structure: a different
371
+ grouping, layout or navigation model. Variants that differ only in colour,
372
+ spacing or copy are one variant.
373
+ - `?variant=<id>` selects one, and a small floating switcher changes it in
374
+ place. The selection survives navigation between the screen routes, so
375
+ every route of a variant is reachable with its `?variant=<id>`.
376
+ - The switcher is the only element outside the screens. Brand tokens stay
377
+ locked in every variant.
378
+
379
+ The next iteration builds one prototype: the variant the user picked, the
380
+ parts they combined, or a pivot carrying their rejection. Drop the switcher.
381
+
311
382
  ## Later iterations
312
383
 
313
384
  The user's answer comes first. The reviewer's `pivotDirective` is your
@@ -12,7 +12,8 @@
12
12
 
13
13
  `.qfai/prototype/iter-<final>/index.html` — the iteration the user
14
14
  confirmed. It is one self-contained file with one client-side route per
15
- declared screen, written by the generator.
15
+ declared screen, written by the generator. It is never an iteration with
16
+ variants: the user's answer to one runs a further iteration.
16
17
  A `restyle` loop has no such file: its iterations restyled the live app
17
18
  in place, and its handoff is the short form under Restyle handoff below.
18
19
  A scoped run also reads the `final/index.html` and `final/handoff.json` an