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
@@ -108,7 +108,7 @@ When an agent needs to ask the user a question, the following rules apply (see a
108
108
 
109
109
  These rules bind every skill and every step through one section:
110
110
  `.qfai/assistant/rule/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`.
111
- Every SKILL.md MUST cite that anchor, and neither a SKILL.md nor a STEP.md
111
+ Every SKILL.md cites that anchor, and neither a SKILL.md nor a STEP.md
112
112
  restates the rules; a step is reached only through its parent or a work order,
113
113
  and both run under that section.
114
114
 
@@ -16,7 +16,7 @@ Inside an `npx qfai workflow` run, what authorizes the run's work and the one ta
16
16
 
17
17
  ## Absolute Rule — Output Language
18
18
 
19
- **All outputs MUST be written in the user’s working language for this session.**
19
+ **Write all outputs in the user’s working language for this session.**
20
20
 
21
21
  - If the user writes in Japanese, output Japanese.
22
22
  - If the user writes in English, output English.
@@ -118,159 +118,69 @@ behavior.
118
118
 
119
119
  ## Article VI — Clarification budget (avoid endless Q&A)
120
120
 
121
- Every command must minimize clarifying questions. The article binds each of
122
- them alike: a stage does not escape it by being about discussion, and a
123
- discussion does not become cheap by sitting inside one. What separates a stage
124
- that asks a lot from one that asks little is how many of its questions are
125
- grilling questions, which the exemption below takes out of the count.
121
+ Purpose: every command asks as few clarifying questions as it can, so the user's attention goes
122
+ where an answer can change the work. The article binds every command alike, discussion included.
126
123
 
127
124
  Default policy:
128
125
 
129
- - Ask **at most 5 clarifying questions per invocation**. The unit is one
130
- top-level skill or command invocation: every `/qfai-*` stage listed in
131
- `.qfai/assistant/rule/workflow.md` → “Stages (canonical)”, and equally a non-stage command such as
132
- `/qfai-configure` or `/web-research`. Each invocation spends its own budget and
133
- the next one starts with a full budget. It is not per session and not per
134
- conversation.
126
+ - Ask **at most 5 clarifying questions per invocation**. The unit is one top-level skill or command
127
+ invocation: every `/qfai-*` stage listed in `.qfai/assistant/rule/workflow.md` → “Stages
128
+ (canonical)”, and equally a non-stage command such as `/qfai-configure` or `/web-research`. Each
129
+ invocation starts with a full budget; it is not per session and not per conversation.
135
130
  - Prioritize **blocking** questions first.
136
131
  - If user requests `--auto`, proceed with explicit assumptions (label them).
137
132
 
138
133
  ### What spends the budget
139
134
 
140
- - A **clarification** — a question asked to resolve ambiguity in the request,
141
- the specs, or the repository — spends budget.
142
- - An **approval** — a question asked because a document requires a recorded
143
- human decision before the work may proceed — does **not** spend budget.
144
- Approvals are unbounded by construction: SDD triage requires an `Approved By`
145
- on every approval-required row and puts no cap on rows. Counting them would
146
- make this article impossible to satisfy in the stage that asks the most.
147
- - Classify **each question, not the prompt**. A prompt that carries both spends
148
- one unit per clarification it contains; only its approval questions are exempt.
149
- Attaching an approval to a clarification does not buy the clarification back.
135
+ - A **clarification**, a question asked to resolve ambiguity in the request, the specs, or the
136
+ repository, spends budget. An **approval**, a question asked because a document requires a
137
+ recorded human decision before the work may proceed, does **not**.
138
+ - Classify **each question, not the prompt**. Attaching an approval to a clarification does not buy
139
+ the clarification back.
150
140
 
151
141
  ### Counting unit
152
142
 
153
- - **Five clarifying questions per skill invocation.** The counter is owned by the
154
- agent that received the invocation, starts at zero when the invocation starts,
155
- and does **not** reset between stages of that invocation. A delegated subagent
156
- spends its caller's budget; it does not receive one of its own.
157
- - **One question item is one question**, however many options it offers. An
158
- AskUserQuestion call that bundles N question items spends N, not 1 — bundling
159
- is a presentation choice, not a discount. The plain-text fallback uses the
160
- same unit, in either shape its answer takes: one numbered choice set is one
161
- question, and one plain request for an open value is one question. A question
162
- the tool could not carry is still a question, and counting only the shape that
163
- happens to be a list would put the whole of Article X's open-value path
164
- outside the budget.
143
+ - The counter is owned by the agent that received the invocation and does **not** reset between
144
+ stages of that invocation. A delegated subagent spends its caller's budget.
145
+ - **One question item is one question**, however many options it offers. An AskUserQuestion call
146
+ that bundles N question items spends N. The plain-text fallback counts the same way, for a
147
+ numbered choice set and for a plain request for an open value alike.
165
148
 
166
149
  ### What does not count
167
150
 
168
- - **Grilling questions are exempt.** A question asked inside a grilling
169
- session — the interview `.agents/rules/grilling.md` defines, which walks a
170
- design tree in rounds until nothing is left silently assumed — is not a
171
- clarification against this budget. The exemption covers the questions a
172
- session puts to the user, which in a delegated session are only its critical
173
- decisions and the facts only the user holds. Such questions are unbounded and
174
- must still be asked after the budget is exhausted. A session ends in one of the
175
- endings that rule names, and never on a count. A cap would end it on a number instead: some
176
- plans need three questions and some need fifty, and a ceiling either truncates
177
- the first kind or looks arbitrary on the second.
178
-
179
- **A session is entered deliberately.** An invocation declares one and nothing
180
- else starts one: meeting an unfixed design does not, and neither does an
181
- ambiguity found while implementing. Outside a declared session no question is
182
- a grilling question — one about an open design decision is an ordinary
183
- clarification and spends budget. That is what decides the class when the
184
- question is asked, rather than leaving it arguable afterwards, and it is what
185
- keeps the exemption from emptying the budget. It separates grilling from
186
- clarification and nothing else: the approval and `hard-required` exemptions
187
- below turn on what a question is about, not on whether a session was declared,
188
- so they hold in every invocation.
189
-
190
- **The confirmation that closes a session is in this class with its
191
- questions.** It is the session's own end condition, so counting it would leave
192
- a session that can be neither continued nor closed.
193
-
194
- - **Approval questions are exempt.** A question whose subject is a user decision
195
- the skill declares mandatory — a per-row triage approval in `/qfai-sdd`, a
196
- destructive-operation confirmation — is a decision, not a clarification. Such questions are unbounded and must
197
- still be asked after the budget is exhausted. Skipping a mandatory approval to
198
- stay under the budget violates this article; it is not compliance with it.
199
- - **The next-action question is exempt.** The question that ends a turn leaving
200
- the next step to the user (`.agents/rules/user-questions.md` § 6) resolves no
201
- ambiguity, so it is not a clarification. It is still put after the budget is
202
- exhausted.
203
- - **`hard-required` inputs are exempt — but only where the invocation needs
204
- them.** An input a skill's `Default Autopilot Policy` lists under
205
- `hard-required` has no default and must not be guessed once the budget is
206
- exhausted. The exemption is **scoped to the inputs the requested work actually
207
- consumes**: brand intent when the run produces brand-facing
208
- output, a full `UI-NNNN` when a prototyping-scoped run cannot identify
209
- its primary UI contract, or a usable story source and `BF-NNNN` when a
210
- flow-scoped run cannot identify its target. An input the requested
211
- path never reads must not be asked for and must not block the run — a
212
- `/qfai-verify` run on a repository with no brand surface executes its quality
213
- gates without ever asking for brand intent. When a **needed** input is still
214
- missing, stop and name what is blocked. Assumptions cover clarifications,
215
- never inputs the skill declares undefaultable **and** the run requires.
216
- **An explicit `--auto` skips the asking, not the rule.** Article X rule 4 is a
217
- no-question mode, so such a run does not ask for the missing input — it stops
218
- and names it as the blocker. `--auto` waives the question, never the input: a
219
- value the skill declares undefaultable is not something a run may invent
220
- because it was told not to ask.
151
+ - **Grilling questions are exempt** and unbounded: a question asked inside a grilling session
152
+ (`.agents/rules/grilling.md#scope`) spends no budget, is still asked after the budget is
153
+ exhausted, and the session ends on one of that rule's endings, never on a count. The confirmation
154
+ that closes a session is in the same class.
155
+ - **A session is entered deliberately.** Outside a declared session no question is a grilling
156
+ question: one about an open design decision is an ordinary clarification and spends budget.
157
+ - **Approval questions are exempt.** A user decision the skill declares mandatory (a per-row triage
158
+ approval in `/qfai-sdd`, a destructive-operation confirmation) is unbounded and still asked after
159
+ exhaustion. Skipping one to stay under the budget violates this article.
160
+ - **The next-action question is exempt.** The question that ends a turn leaving the next step to
161
+ the user (`.agents/rules/user-questions.md` § 6) resolves no ambiguity, so it is not a
162
+ clarification; it is still put after the budget is exhausted.
163
+ - **`hard-required` inputs are exempt — but only where the invocation needs them.** An input a
164
+ skill's `Default Autopilot Policy` lists under `hard-required` and the requested work consumes is
165
+ never guessed: it is asked even after the budget is exhausted, and when it is still missing, or
166
+ under `--auto`, the run stops and names what is blocked. An input the requested path never reads
167
+ is neither asked for nor a blocker.
221
168
 
222
169
  Stop conditions:
223
170
 
224
171
  - User says “stop” → abort the invocation; no further work or file changes.
225
- - User says “proceed / done” → clarification-exhausted mode for the rest of the
226
- invocation. It waives clarifications only; it is **not** `--auto`, and the
227
- mandatory approvals and needed `hard-required` inputs above must still be
228
- asked.
229
- - Question budget is exhausted → clarification-exhausted mode for the rest of the
230
- invocation.
172
+ - User says “proceed / done” → clarification-exhausted mode for the rest of the invocation.
173
+ - Question budget is exhausted → clarification-exhausted mode for the rest of the invocation.
231
174
 
232
175
  ### On exhaustion
233
176
 
234
- Exhaustion stops the questions, not the work: for the remainder of the
235
- invocation the agent is in **clarification-exhausted mode** — ask no further
236
- clarifying questions, proceed with explicit assumptions, and label every
237
- assumption in the outputs.
238
-
239
- The mode has **two entry conditions and one meaning**: the budget is spent, or
240
- the user closes it early by answering `proceed` / `done`. Such an answer waives
241
- the clarifying questions the agent still had, and nothing else.
242
-
243
- Clarification-exhausted mode is **not `--auto`**. `--auto` is a no-question mode
244
- (Article X, rule 4) that forbids AskUserQuestion and plain-text questions
245
- outright, and only the explicit `--auto` flag turns it on — neither a spent
246
- budget nor a `proceed` / `done` answer does; clarification-exhausted mode
247
- silences clarifications only, so the exemptions above survive it unchanged —
248
- mandatory approvals and needed `hard-required` inputs must still be asked, under
249
- either entry condition. An agent that exhausts the budget mid-invocation, or is
250
- told to `proceed` before an approval-required change is discovered, therefore
251
- never has to choose between skipping a mandatory approval and breaking the
252
- `--auto` rules: it is not under them.
253
-
254
- An explicit **“stop” is not exhaustion**. Do not read it as `--auto` or as
255
- clarification-exhausted mode. It ends the invocation: ask nothing further, do no
256
- further work, make no further file changes, and report what was completed and
257
- what remains.
258
-
259
- Do not ask a sixth clarification. Settle the remaining ambiguity the way `--auto`
260
- does: proceed with explicit assumptions, label them, and record them in the
261
- invocation's output — as Open Questions when the assumption is still unresolved.
262
- Exhaustion silences clarifications only. A **required approval is still asked**:
263
- it never spent budget, and Article X's `--auto` no-question mode is not in force
264
- here — only its assumption-recording behaviour is. Silently stopping is not a
265
- sanctioned move, and neither is asking a sixth clarification anyway.
266
-
267
- **A grilling session survives exhaustion too**, and for the same reason: its
268
- questions never spent budget, so there is none left to run out of. A session
269
- already under way continues to its own end condition, a delegated one still
270
- requiring actual user authority for critical decisions, and a stage reached after
271
- exhaustion still opens one where its work calls for it. Treating a spent budget
272
- as the end of a session would put the design decisions back where this article
273
- found them — settled quietly, on an assumption nobody was asked about.
177
+ In **clarification-exhausted mode** the agent asks no further clarifying question, proceeds with
178
+ explicit assumptions, labels every assumption in the outputs, and records an unresolved one as an
179
+ Open Question. The mode silences clarifications only and is **not `--auto`**: mandatory approvals,
180
+ needed `hard-required` inputs, the next-action question, a grilling session under way and one a
181
+ later stage opens all survive it. An
182
+ explicit **“stop” is not exhaustion**: it ends the invocation, and the agent reports what was
183
+ completed and what remains.
274
184
 
275
185
  ---
276
186
 
@@ -290,14 +200,14 @@ instructions in other constitution documents.
290
200
 
291
201
  The floor's specification clause preserves Article IV. The ladder's first rung
292
202
  belongs here while scope is open. Once a spec row is agreed, asking whether it
293
- should exist is a Change Request.
203
+ should exist is a specification change, which goes to its owner.
294
204
 
295
205
  ### Prototyping exception (scope floor)
296
206
 
297
207
  For `/qfai-prototyping`, the confirmed prototype in `.qfai/prototype/final/`
298
208
  covers every declared UI contract and screen in the configured story tree.
299
- Shrinking what it covers is prohibited unless a documented Change Request
300
- approves it. A run scoped per `prototyping-grill` § Run scope rebuilds part of
209
+ Shrinking what it covers is prohibited unless the user approves it as a
210
+ critical decision. A run scoped per `prototyping-grill` § Run scope rebuilds part of
301
211
  a confirmed `final/` and merges it back, so it does not shrink the floor.
302
212
 
303
213
  ---
@@ -341,14 +251,14 @@ critical. Nothing is recorded beyond the stage's final report.
341
251
 
342
252
  | The stop concludes | What follows |
343
253
  | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
344
- | Settled input must change | `.qfai/assistant/rule/drift-protocol.md`: stop dependent work, raise the Change Request, record actual applicable user authority before changing it |
345
- | The obstacle is this run's to solve — an unavailable dependency, an approach that failed | The run solves it. Nothing upstream changes, so there is nothing to approve |
254
+ | Settled input must change | `.qfai/assistant/rule/drift-protocol.md`: stop dependent work, send the change to its owner, put a critical decision to the user before changing it |
255
+ | The obstacle is this run's to solve — an unavailable dependency, an approach that failed | The run solves it. Nothing upstream changes, so there is nothing to decide |
346
256
 
347
257
  Stopping does not change settled input and is not a second way to. What it
348
- contributes to a Change Request is what that protocol asks of the class: for
349
- intent drift, the options and the recommendation its `Approved option` is chosen
350
- from; for defect drift, the single correct repair, which that protocol records
351
- with `Approved option: -` and which options would only dress as a choice.
258
+ contributes to that change is what that protocol asks of the class: for
259
+ intent drift, the options and the recommendation the decision is taken from;
260
+ for defect drift, the single correct repair, which options would only dress as
261
+ a choice.
352
262
  The agents settle what the change should be; the protocol decides whether it
353
263
  happens.
354
264
 
@@ -358,86 +268,29 @@ happens.
358
268
 
359
269
  When an agent needs to ask the user a question, it must use the AskUserQuestion tool if available.
360
270
 
361
- **No question is exempt.** A confirmation, a yes-or-no, a "just checking" — each
362
- is a question and each takes this path. There is no class light enough to skip
363
- it, and the reason is what an exception gets used for: an agent looking for one
364
- is an agent that would rather not ask, and the question it skips is the one it
365
- was least sure of. `.agents/rules/user-questions.md` owns the form a question
366
- takes and states the whole of it; this article is where the obligation binds.
367
-
368
- **This is the form, not the count.** Article VI bounds how many clarifying
369
- questions an invocation asks; this article bounds what each of them looks like.
370
- Exhausting that budget changes the count and nothing here: a question that
371
- survives exhaustion still arrives in the form its answer shape calls for — a
372
- structured choice where there are choices, the tool's free-text path where the
373
- answer has no listable set of candidates. `qfai-configure`'s replacement glob is
374
- the second kind, and inventing options to narrow it would be the failure the
375
- rule master names.
271
+ **No question is exempt.** A confirmation or a yes-or-no takes this path too.
272
+ `.agents/rules/user-questions.md` owns the form a question takes; this article is where the
273
+ obligation binds. Article VI bounds the count, and this article the form.
376
274
 
377
275
  Rules:
378
276
 
379
- 0. **A no-question mode is read first.** Where rule 4 applies, no question is put
380
- to the user, so there is nothing whose availability rules 1 to 3 could judge.
381
- Actual qualifying explicit delegation may still permit agent-to-agent rounds
382
- under the master; no-question mode alone does not. Read
383
- the other way round, a mode that withholds the tool would make it unavailable,
384
- route the question to rule 3's plain-text fallback, and hand the agent a rule
385
- that says to ask beside one that says not to.
386
- 1. **Use AskUserQuestion** when the tool is available in the current environment.
387
- Availability is judged for **this question in this invocation**, not from what the
388
- host supports in general: a tool a mode withholds, or one that cannot carry the
389
- answer's shape, is unavailable for that question and takes rule 3. "Withholds"
390
- means a mode that still permits asking and offers no structured tool; a mode
391
- that permits no question at all is rule 4's, not this one's.
392
- 2. **Prefer structured choices** (radio/multi-select) over free-text input **where the
393
- question has choices** and AskUserQuestion supports them. Where the answer is open — no listable set
394
- of candidates to choose from — the free-text path is the one that carries it, and narrowing it
395
- into options is the failure rule 3 names. A name, a number or a sentence is usually open and is
396
- not open by type: where the value has to be one of a known few, the set is what the user needs to
397
- see. The preference ranks two ways of asking one question; it does not
398
- turn an open answer into a choice.
399
- 3. **Fallback**: If AskUserQuestion is unavailable for this question, present the same
400
- question as a normal message, **in the shape its answer has**: explicit numbered choices where
401
- there are choices, and a plain request for the value where the answer has no listable set of
402
- candidates. Inventing options to make an open answer fit a numbered list is the failure the form
403
- rule above names, and the fallback is not a licence for it.
404
- Where there are choices the agent SHOULD preserve structured choice semantics (enumerated
405
- options, selection constraints). State the reason it is unavailable.
406
- 4. **`--auto` mode**: When `--auto` flag is active, no questions are asked.
407
- Do not use AskUserQuestion or ask via plain text.
408
- Proceed with explicit assumptions and record them in outputs.
409
- This is not an exception to rule 1 — it is a "no-question mode".
410
- The assumptions it proceeds with are the **defaultable** ones. A
411
- `hard-required` input the invocation actually consumes has no default, so a
412
- run missing one must stop and name it rather than invent a value: `--auto`
413
- silences the question, it does not authorize the guess (Article VI).
414
- 5. **Exhausting the Article VI budget is not `--auto`**: it enters
415
- clarification-exhausted mode, which silences clarifying questions only.
416
- Rule 4 does not apply to it — mandatory approvals and the `hard-required`
417
- inputs that invocation actually consumes must still be asked. A user's
418
- `proceed` / `done` answer enters that same mode and is likewise not `--auto`;
419
- this rule is activated by the `--auto` flag alone.
420
- 6. **A grilling session does not reach the user under `--auto`.** Its questions
421
- are exempt from the Article VI budget, not from rule 4: a no-question mode
422
- sends no question to the user, whatever it is for. The session still runs — it
423
- settles what the repository settles, dispatches sub-agents for the facts, and
424
- in a delegated session adopts the griller's recommendation for non-critical
425
- decisions. A critical decision needs an actual user answer or recorded
426
- applicable authorization; without it the node stays open. It opens every **node**
427
- left over, including uncovered critical decisions and unavailable user-held
428
- facts, **as a question in the register the stage reads**, so the
429
- stage cannot complete over it. Every node, not every
430
- decision: a fact only the user holds cannot be settled from evidence either,
431
- and opening the decisions while dropping the facts loses exactly the nodes no
432
- lookup could have reached. Where a document requires the field to hold
433
- something, write the defaulted value and label it an assumption beside the
434
- open question; a labelled value under an open question is not a settled
435
- decision. What rule 4 does not license is the assumption **alone**, which
436
- reads as settled to whoever finds it next. A fact declared undefaultable has
437
- no value to write down at all: the run stops and names it. A qualifying
438
- explicitly delegated session ends `adopted` only with the master's empty-tree,
439
- actual-input and authority conditions met. No-question mode alone cannot
440
- close a node or authorize a reserved decision.
277
+ 0. **A no-question mode is read first.** Where rule 4 applies, no question is put to the user, so
278
+ rules 1 to 3 have nothing to judge.
279
+ 1. **Use AskUserQuestion** when the tool is available for **this question in this invocation**; a
280
+ tool a mode withholds, or one that cannot carry the answer's shape, sends the question to rule 3.
281
+ 2. **Prefer structured choices** where the question has choices; an open answer takes the
282
+ free-text path and is never narrowed into invented options.
283
+ 3. **Fallback**: If AskUserQuestion is unavailable for this question, ask in a normal message in
284
+ the shape its answer has (`.agents/rules/user-questions.md` § 5) and state why it is
285
+ unavailable.
286
+ 4. **`--auto` mode**: no questions are asked, by the tool or in plain text; proceed with explicit
287
+ assumptions recorded in outputs, except a needed `hard-required` input, which stops the run
288
+ (Article VI).
289
+ 5. **Exhausting the Article VI budget is not `--auto`**: it enters clarification-exhausted mode
290
+ (Article VI, On exhaustion); only the `--auto` flag activates rule 4.
291
+ 6. **A grilling session does not reach the user under `--auto`.** It opens every node left over as
292
+ a question in the register the stage reads, so the stage cannot complete over it; the rest is
293
+ `.agents/rules/grilling.md#under-a-no-question-mode`.
441
294
 
442
295
  This article survives context compaction because `.qfai/assistant/rule/constitution.md` is a P1 reload target.
443
296
 
@@ -445,26 +298,8 @@ This article survives context compaction because `.qfai/assistant/rule/constitut
445
298
 
446
299
  ## Article XI — Temporary files go in `tmp/`
447
300
 
448
- Scratch files an agent creates for its own convenience — working notes, one-off
449
- scripts, captured command output, downloaded samples, intermediate data —
450
- go in the scratch directory the host names for the session, and under the
451
- repository-root `tmp/` directory where the host names none.
452
-
453
- Scope: this article is about files written **into the working tree**. Two kinds
454
- of output are outside it:
455
-
456
- - A sandbox a test creates with `mkdtemp` under the OS temporary directory. It
457
- lives outside the repository, so it cannot put a file in any of the
458
- directories Rule 1 protects, and the test that created it removes it.
459
- - Build, test and cache output the project's own toolchain emits (`dist/`,
460
- `build/`, `.next/`, `target/`, coverage reports, package tarballs). Those
461
- paths belong to the packaging, deploy and test contracts. Leave them where the
462
- tooling puts them and never redirect them to `tmp/`.
463
-
464
- Rules:
465
-
466
- 1. **Never** create a scratch file in the repository root, `src/`, `.qfai/spec/`, or any other production/artifact directory.
467
- 2. When the host names a scratch directory for the session, use it. Otherwise use `tmp/` (repository root) as the sole staging area, with subdirectories as needed (e.g., `tmp/notes/`, `tmp/capture/`). A file the repository's own tooling must read from the working tree goes under `tmp/` whichever the host names.
468
- 3. `tmp/` MUST be listed in `.gitignore` so temporary files are never committed.
469
- 4. Clean up `tmp/` contents when the task that created them is complete. The host's own scratch directory is the host's to clean.
470
- 5. If a scratch file is found outside `tmp/` **in the working tree**, treat it as a defect and move or delete it immediately. A test's `mkdtemp` sandbox and configured toolchain output are not scratch files — see Scope above.
301
+ Purpose: a scratch file never lands in a production or artifact directory or in a commit. The rules
302
+ are `.agents/rules/temporary-files.md`. A test's `mkdtemp` sandbox under the OS temporary directory
303
+ is outside them: it lives outside the repository, and the test that created it removes it. The
304
+ `tmp/` ignore entry is written by `npx qfai init`, and `QFAI-HYG-003` reports it at info when a
305
+ QFAI-managed `.gitignore` lacks it.