qfai 2.1.1 → 2.1.2

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 (134) hide show
  1. package/README.md +56 -36
  2. package/assets/defaults/agent-routing/qfai-triage.yml +9 -0
  3. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  4. package/assets/init/.claude/settings.json +27 -9
  5. package/assets/init/.codex/hooks.json +20 -8
  6. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  7. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  8. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  9. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  10. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  11. package/assets/init/.qfai/assistant/rule/drift-protocol.md +58 -2
  12. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +6 -4
  13. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  14. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +15 -25
  15. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +8 -8
  16. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  17. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -3
  18. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +3 -7
  19. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  20. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +1 -6
  21. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  22. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +9 -3
  23. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  24. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +46 -0
  25. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +3 -0
  26. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +3 -3
  27. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +12 -6
  28. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +1 -265
  29. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  30. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +4 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +2 -3
  32. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +17 -1
  33. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +30 -17
  34. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  35. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +47 -24
  36. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +218 -11
  37. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +4 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +14 -0
  39. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +4 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -0
  41. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +23 -5
  42. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +8 -0
  43. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -4
  44. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +132 -4
  45. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +14 -2
  46. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +114 -0
  47. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -29
  48. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +38 -1
  49. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +3 -0
  51. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +29 -19
  52. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +5 -4
  53. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  54. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +72 -7
  55. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +35 -21
  56. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  57. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  58. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  59. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  60. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  61. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  62. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  63. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +0 -4
  64. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +98 -8
  65. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +3 -2
  66. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +1 -0
  67. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  68. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +1 -3
  69. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  70. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  71. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +4 -1
  72. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  73. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  74. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +3 -3
  75. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  76. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +4 -3
  77. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  78. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  79. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +6 -5
  80. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +1 -1
  81. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  82. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +39 -5
  83. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  84. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  85. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  86. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  87. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +1 -3
  88. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  89. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  90. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  91. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +30 -8
  92. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +5 -4
  93. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  94. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  95. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  96. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  97. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  98. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  99. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  100. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  101. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  102. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +1 -0
  103. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +37 -9
  104. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  105. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +7 -16
  106. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  107. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +6 -4
  108. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +121 -30
  109. package/assets/init/root/.agents/rules/ai-readable-markdown.md +2 -2
  110. package/assets/init/root/.agents/rules/api-budget.md +187 -8
  111. package/assets/init/root/.agents/rules/documentation-clarity.md +162 -33
  112. package/assets/init/root/.agents/rules/minimal-implementation.md +3 -3
  113. package/assets/init/root/.agents/rules/reminders.json +27 -14
  114. package/assets/init/root/.agents/rules/session-feedback.md +136 -0
  115. package/assets/init/root/.agents/rules/temporary-files.md +33 -0
  116. package/assets/init/root/.agents/rules/user-questions.md +48 -37
  117. package/assets/init/root/.github/workflows/qfai-docs.yml +1 -1
  118. package/assets/init/root/AGENTS.md +23 -22
  119. package/assets/sandbox-templates/default-deny.yaml +9 -3
  120. package/assets/schemas/workflow/extraction.schema.json +85 -5
  121. package/assets/uix-rev/comparison-review.md +1 -1
  122. package/assets/uix-rev/contracts-review.md +1 -2
  123. package/dist/cli/index.cjs +6697 -8810
  124. package/dist/cli/index.cjs.map +1 -1
  125. package/dist/cli/index.mjs +6036 -8152
  126. package/dist/cli/index.mjs.map +1 -1
  127. package/dist/index.cjs +4947 -7746
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.cts +18 -658
  130. package/dist/index.d.ts +18 -658
  131. package/dist/index.mjs +4866 -7640
  132. package/dist/index.mjs.map +1 -1
  133. package/package.json +4 -6
  134. package/assets/init/root/CLAUDE.md +0 -46
@@ -5,12 +5,20 @@ What the user sees while a request is worked, and how a question reaches them.
5
5
  ## Contents
6
6
 
7
7
  - Every screen
8
+ - Launcher recovery
9
+ - Refreshing installed instructions
10
+ - Executing a step
8
11
  - The scope question
9
12
  - The announcement
10
13
  - Questions
14
+ - Repair found by a question-only stage
11
15
  - A step only a person can take
16
+ - Authorized external actions
17
+ - Replies to a waiting step
18
+ - Independent targets under one goal
12
19
  - Halt notice
13
20
  - Final report
21
+ - Work orders summary
14
22
 
15
23
  ## Every screen
16
24
 
@@ -21,6 +29,49 @@ What the user sees while a request is worked, and how a question reaches them.
21
29
  - Show nothing while a call is running beyond the host's own activity
22
30
  indicator.
23
31
 
32
+ ## Launcher recovery
33
+
34
+ Read this section if the canonical launcher is missing or its preflight fails,
35
+ before planning.
36
+
37
+ Use the project's package manager and declared install command in this checkout:
38
+
39
+ - If `package.json` declares `qfai`, install the project's dependencies here.
40
+ - If it does not, add `qfai` as a development dependency using that package manager.
41
+ - Repeat the launcher preflight. Plan only after it succeeds.
42
+
43
+ Never use a published, remote or cached QFAI launcher as a fallback.
44
+
45
+ ## Refreshing installed instructions
46
+
47
+ Read this section before applying corrected guidance to an adopting project.
48
+
49
+ Install or update its project-local QFAI dependency using the project's package
50
+ manager and approved package source. Verify that the canonical launcher resolves
51
+ that installation, then inspect the installed step and reference files for the
52
+ required guidance. A source fix or package version string alone does not prove
53
+ that a published package contains it.
54
+
55
+ Preview the refresh with that verified local launcher using
56
+ `npx qfai init --force --dry-run`. Review the managed files it would replace,
57
+ including any direct local edits, before `npx qfai init --force`. Review the
58
+ resulting diff. Force refresh overwrites managed assistant and rule masters;
59
+ project specs, contracts, rule overlays, `skill.local/`, configuration overrides
60
+ and existing entry documents remain project-owned. Keep them intact; do not
61
+ replace them with templates to make the refresh pass.
62
+
63
+ ## Executing a step
64
+
65
+ Read this section when a step is short or passes without edits.
66
+
67
+ Read `STEP.md` at the plan's path and follow its Procedure. Run only its declared
68
+ commands and pass its Gate.
69
+
70
+ A `passThrough` step first reads what its Passes when section names. If that
71
+ condition holds, write nothing and record the reason in the stage report.
72
+ Do not skip the step. The planned independent review still runs, even when the
73
+ step is only two lines.
74
+
24
75
  ## The scope question
25
76
 
26
77
  The scopes are the plan's, or the chosen candidate's after the candidate
@@ -52,8 +103,9 @@ Once the plan and its scope are known, and before the first stage:
52
103
  - the chosen stages in order;
53
104
  - the files the work may change.
54
105
 
55
- It asks nothing and lists no skipped stage. Text that is not a request gets no
56
- plan and no announcement.
106
+ The announcement asks nothing and lists no skipped stage. Continue with the
107
+ policy check and the first stage in the same turn without waiting for a reply.
108
+ Text that is not a request gets no plan and no announcement.
57
109
 
58
110
  ## Questions
59
111
 
@@ -77,12 +129,33 @@ Independent questions go in one round; a dependent one waits for its answer.
77
129
  - Under a no-question mode nothing is asked. `SKILL.md` says what is done
78
130
  instead.
79
131
 
132
+ ## Repair found by a question-only stage
133
+
134
+ Read this section when a question-only request finds a defect and its move to
135
+ tracked-file repair lacks explicit authority for the same target.
136
+
137
+ Show the defect and its evidence, the proposed repair scope and the planned
138
+ checks. Put one question through the structured question tool in the form
139
+ `.agents/rules/user-questions.md` requires:
140
+
141
+ - **Repair:** authorize the stated repair and checks for this target.
142
+ - **Report and stop:** report the finding and stop this target without edits.
143
+
144
+ Write nothing before the answer. Repair permission takes the destination's
145
+ existing plan; add no stage or scope. The guards for a third branch move, a
146
+ scope that leaves stages out and release approval still apply.
147
+
148
+ Under a no-question mode, report the defect and required repair permission and
149
+ stop that target. Write no tracked `open-questions.md` row for this choice;
150
+ asking for no questions alone supplies no repair authority. Other authorized
151
+ independent targets may continue.
152
+
80
153
  ## A step only a person can take
81
154
 
82
- A change can depend on an action outside the repository that only the user can
83
- take: a setting in a hosted dashboard, or a credential issued in a service's
84
- web console. The plan stays the repository change. The work stops before the
85
- stage that needs the action and says three things:
155
+ A change can depend on a step only a person can take: interactive login, a
156
+ new permission grant or an expansion of authority. The plan stays the
157
+ repository change. The work stops before the stage that needs that action
158
+ and says three things:
86
159
 
87
160
  - what the user must do, in plain words, and where;
88
161
  - what shows it was done;
@@ -93,14 +166,130 @@ Put it as one question that ends the turn, in the form
93
166
  `.agents/rules/user-questions.md` sets out. The options are that the user did
94
167
  it, and `stop`.
95
168
 
96
- - The agent never types a password, token or key, and never changes an account
97
- or service setting. The user does both in the service's own page.
169
+ - The user completes person-only login, new permission grants and authority
170
+ expansion in the service's own page. A human-run or triage handoff never
171
+ performs the user's operation on their behalf.
98
172
  - The agent reads only the evidence it named. It reports the action as
99
173
  confirmed or not confirmed, and goes on after it only when confirmed or the
100
174
  user says to go on.
101
175
  - Under a no-question mode nothing is asked. The work that does not depend on
102
176
  the action goes on, and the final report lists the action as not done.
103
177
 
178
+ ## Authorized external actions
179
+
180
+ Read this section when a repository change needs an account setting or a
181
+ credential installed outside the repository.
182
+
183
+ An agent may perform that action only when prior user instructions or project
184
+ policy cover the specific target and action, and the host provides an allowed
185
+ safe channel. A connector's availability alone proves neither authority nor
186
+ access. Reuse covering authority without inventing a new permission grant.
187
+
188
+ Check that the actual credential's account, project, scope and expiry fit that
189
+ authority. One-time permission is not continuing access. Third-party credential
190
+ ownership needs its own authority; permission for this project does not supply
191
+ it. Use only the host's actual safe channel for credential installation. Never
192
+ put a password, token or key in chat, logs or tracked files, or ask the user to
193
+ paste it there. Interactive login, new permission grants and authority expansion
194
+ remain person-only actions.
195
+
196
+ If authority, credential ownership or a safe channel is absent or unknown, or
197
+ the host denies the action, stop the dependent action. Give concrete manual
198
+ steps, the evidence that would confirm them and a read-only verification check.
199
+ Do not bypass the denial or infer missing authority from a generic request to
200
+ proceed. Keep a human-run or triage handoff as a handoff; other authorized
201
+ independent work may continue.
202
+
203
+ Record host access or CI start, authorization, credential installation, CI
204
+ results, merge and publication separately in the existing stage report. For
205
+ each relevant effect state confirmed, pending, unverified or not requested,
206
+ with its target, exact revision, evidence URL when available, blocker and
207
+ resume condition where needed. Missing evidence stays unverified. A green CI
208
+ result proves neither merge nor publication. Report the implemented repository
209
+ change separately from unverified external effects.
210
+
211
+ ## Replies to a waiting step
212
+
213
+ Read this section before treating a user's reply as a new request.
214
+
215
+ - A reply answering a pending question or reporting the requested operation's
216
+ result resumes the same waiting step, including a reported failure. Use no
217
+ new plan and no skill invocation for that reply.
218
+ - Free text supplying the requested value is an answer to that waiting step,
219
+ even if it does not repeat an option label.
220
+ Never treat an unrelated instruction as selection or approval of an option.
221
+ - Dismissal or no response is not an answer or permission. Continue a routine
222
+ choice only under authorization the user already gave. A missing hard-required
223
+ fact, uncovered mandatory approval, cancellation or explicit tool block stays
224
+ protected; do only independent work that remains authorized.
225
+ - An independent new request is planned under the extraction and scope rules
226
+ in `SKILL.md`. If a reply also contains one, resume the waiting step with its
227
+ answer and plan the independent request separately.
228
+ - A separate explicit request to investigate the failure or repeat the operation
229
+ is planned as a new request under those same rules.
230
+ - An answer to a closed request for information follows only the plan's branch
231
+ for received information. Add no branch or step.
232
+ - For an ambiguous reply, do not assume success, completion, new facts or
233
+ approval. State what remains unconfirmed. Ask for any fact or decision still
234
+ needed under the normal question rules.
235
+
236
+ Background waiting needs no question. Report the current state, awaited
237
+ evidence or result and resume condition; promise no automatic restart unless
238
+ the host provides it. Follow `.agents/rules/user-questions.md` § 6 when an
239
+ answer is needed. A completion-only final report needs no question.
240
+
241
+ ## Independent targets under one goal
242
+
243
+ Read this section before handling several independent targets under one goal
244
+ or switching the checkout during a target's wait.
245
+
246
+ Plan each target separately only when its scope is settled and independent.
247
+ Keep each plan's scope, stage order, steps, review and release points. A target
248
+ with an unfinished prerequisite waits; mixed findings with unsettled scopes
249
+ still take the existing bundle/decomposition handling. Give newly eligible
250
+ targets within the goal's criteria their own plans. Report an out-of-scope
251
+ finding as a follow-up, never as an extra step in the current target.
252
+ If no planned stage serves work this target needs, stop that target and name
253
+ the owner and stage skill to invoke. Other authorized independent targets may
254
+ continue.
255
+
256
+ Use the existing stage reports and handoff messages to retain each target's
257
+ plan and scope, stage and step, branch and exact head, evidence, open approval
258
+ or blocker, and resume condition. Report waiting targets as waiting. Before
259
+ writing or using a result, confirm its target and head. A green check for an
260
+ older or different head does not pass the current one; pending checks do not
261
+ complete verification. A matching red check resumes the planned gate and its
262
+ fix procedure. Keep each review verdict bound to the commit reviewed; never
263
+ relabel it as a review of a newer head or add a review the plan does not name.
264
+
265
+ Before changing the shared checkout, wait for every writer and local gate
266
+ using it, preserve target edits in a permitted commit of only its paths, and
267
+ ensure the whole index and worktree are clean. Unknown dirty files postpone
268
+ the switch; do not stash, reset or delete them to move on. A reviewer using
269
+ live files or checkout-dependent execution must finish. A read-only reviewer
270
+ using only `git show <fixed SHA>:<path>` may continue across a clean orchestrator switch;
271
+ the reviewer never switches the checkout. CI-only pending gates use the
272
+ existing DELEGATED commit allowance only under a user instruction or project
273
+ policy covering that verification commit and its tracked paths. The project
274
+ must declare the gate CI-only and name its actual check. Every nondelegated gate
275
+ must pass. A delegated red check stops transport of the same unchanged candidate.
276
+ Explicit CI-only delegation covering transport may instead carry actual changes
277
+ addressing that failure through the existing planned fix into a new candidate,
278
+ even while HEAD names the failed commit. Keep the prior head, check, run and
279
+ observed result as FAIL; never relabel that evidence pending. Report the actual
280
+ fix and the new head after committing. Its missing or pending CI result leaves
281
+ verification incomplete. Ordinary FAIL or UNRUN still stops the commit. A commit
282
+ grants no push or pull request authority: each remote action needs its own covered
283
+ instruction or policy. Waiting alone never authorizes a commit or skipped gate.
284
+
285
+ Use standing delegation only for the targets and actions it actually covers.
286
+ Report routine choices as the agent's decisions under that authority, never
287
+ as the user's individual option approval. A request to ask nothing supplies
288
+ no uncovered approval. If a critical decision or release approval is missing,
289
+ stop that target before dependent work and follow the existing question or
290
+ no-question rules. Other authorized independent work may continue. A stop of
291
+ the whole goal stops every target.
292
+
104
293
  ## Halt notice
105
294
 
106
295
  One notice when the work stops before its end:
@@ -121,10 +310,28 @@ reset, a stash, a branch switch or a worktree removal.
121
310
  | At the chosen scope | The chosen stages complete, the stages not chosen, and a verdict for each gate that ran, never that a change is done |
122
311
  | At a closing step | The closure outcome and each follow-up request, never that a change is done |
123
312
  | With a gate failing | Each failing gate marked pre-existing or new, with its owner. Nothing reads as complete |
313
+ | With delegated CI pending | The verification commit, pending checks and resume condition; verification remains incomplete |
124
314
 
315
+ - For a CI wait, name the target, current head, run ID or URL when available,
316
+ check, actual outcome and counts, blocker and resume condition. State when no
317
+ run exists. Missing, red or mismatched evidence stops formal completion or
318
+ merge; every required check needs actual passing evidence for the current head.
319
+ - Report repository outcome separately from external publication. A local commit
320
+ is not a push or pull request, and passing repository checks do not prove a
321
+ deployment, package publication or other external effect occurred.
125
322
  - A gate shows its verdict only.
126
323
  - An external effect nobody requested is listed as not requested.
127
324
  - The report does not restate the history of the work.
128
- - The report ends with a question listing the next actions, the recommended one
129
- first, as `.agents/rules/user-questions.md` § 6 sets out. Under a no-question
130
- mode it lists them instead.
325
+ - Ask for the next action only when proceeding requires the user's answer,
326
+ in the shape `.agents/rules/user-questions.md` § 6 requires. A report that
327
+ only states completion needs no question. Under a no-question mode, list any
328
+ remaining actions without asking.
329
+
330
+ ## Work orders summary
331
+
332
+ Read this section when parts ran in parallel. Report one row per part given to
333
+ a sub-agent.
334
+
335
+ | Step | Role (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
336
+ | ---- | ---------------- | --------------- | ----------------- | ------------- | ------------- | ---------------------------- |
337
+ | 1 | `<role>` | `<instance id>` | `<part in words>` | The step file | The result | PASS/REVISE |
@@ -181,9 +181,10 @@ keeps its scopes: `--route` returns none.
181
181
  `schema` for an extraction field, naming its `cause`: `missing` for a required
182
182
  field that is absent, `unknown` for a key the extraction does not take,
183
183
  `wrong-type` for a value of another type, `wrong-value` for a value outside the
184
- field's vocabulary, and `invalid` for the rule that ties `alternatives` to
185
- `confidence`; each cause states what was expected and received, or the field
186
- name. `unknown-route` for a route the catalog does
184
+ field's vocabulary, and `invalid` for the rules tying `alternatives` to
185
+ `confidence` or requiring `owned-temporary-cleanup` to use `intent: order` and
186
+ empty `artifacts`, including alternative readings. Each cause states what was
187
+ expected and received, or the field name. `unknown-route` for a route the catalog does
187
188
  not name, `plan-invalid` for a plan that does not load, naming its `file` and
188
189
  `cause`, `artifact-unserved` for an artifact the extraction names when no stage
189
190
  of the route writes any artifact it names, so the work stops before the first
@@ -8,6 +8,10 @@ Before a step `releasePoint` names runs, ask the user to approve the release; wh
8
8
  `verify-commit` runs after that, so the commit holds the approval. Nothing after it
9
9
  runs without the approval, which authorizes no push, merge, tag or publication.
10
10
 
11
+ After approval at a handoff release point, `qfai-run` writes the required
12
+ approval row in `decisions.md` before `triage-handoff` runs. Every triage step
13
+ still changes no tracked file. No handed-off operation runs on the user's behalf.
14
+
11
15
  ## Decision point
12
16
 
13
17
  At a step `decisionPoints` names, put each critical
@@ -19,6 +23,16 @@ yourself, ask nothing, and list it with its reason in the final report.
19
23
 
20
24
  ## Branch point
21
25
 
26
+ A question-only request with `artifacts: []` may move to a route that writes
27
+ tracked files only under explicit same-target repair authority from the user's
28
+ request or project policy. Reuse that authority without another repair
29
+ question. Otherwise, show the defect evidence, repair scope and planned checks
30
+ and ask through the structured question tool: repair, or report and stop.
31
+ Write nothing before the answer. Under a no-question mode with no covering
32
+ authority, report the defect and required permission and stop that target;
33
+ write no tracked `open-questions.md` row. Asking for no questions alone grants
34
+ no repair authority.
35
+
22
36
  When a step `branchPoints` names reports an outcome
23
37
  paired with one route, move there; with several, to the one the step
24
38
  names; with `decision-table`, to the route `plan --in` gives the step's
@@ -91,9 +91,10 @@ Report the source selected, BF and US IDs touched, decision and OQ IDs, contract
91
91
  files and index rows, each per-flow validation result and log, independent
92
92
  reviewer verdicts, adopted grilling decisions, rejected options still excluded,
93
93
  and remaining questions. The next implementation route is `/qfai-implement`; UI work
94
- may pass through `/qfai-prototyping` first. The report ends with a question
95
- listing those next actions, as `.agents/rules/user-questions.md` § 6 sets out.
96
- Under a no-question mode, list them in the report instead.
94
+ may pass through `/qfai-prototyping` first. Ask about those next actions only
95
+ when proceeding requires the user's answer, as `.agents/rules/user-questions.md`
96
+ § 6 sets out. A completion-only report needs no question. Under a no-question
97
+ mode, list any remaining actions instead.
97
98
 
98
99
  ## Default Autopilot Policy
99
100
 
@@ -53,6 +53,7 @@ Discussion UI/UX files are **non-normative** discovery / reference artifacts —
53
53
  not only where the attribute is written out — a framework that builds the
54
54
  attribute from a variable still writes the marker somewhere.
55
55
  - **Every entry under `screens` is a screen, once.** Each UI-bearing contract declares one full `UI-NNNN` ID and a nonempty `screens[]` list. Each screen has an ID and route, unique within its contract. The prototyping cycle covers all declared UI-bearing contract IDs; filenames do not select a legacy spec tier. `QFAI-CONTRACT-042` names malformed screen entries.
56
+ - **Every screen states the text it shows.** A screen declares `supplements` (`[]` when it shows none) and may declare `structure`. `QFAI-CONTRACT-043` names a key that is absent or malformed, `QFAI-CONTRACT-044` an id the screen does not declare, and `QFAI-CONTRACT-045` a text shown twice.
56
57
  - **A contract's ID comes from its directory.** `api/` holds `API` contracts,
57
58
  `db/` `DB` and `ui/` `UI`; the QFAI repository's own `cli/` holds `CLI`
58
59
  contracts. The ID is `<KIND>-NNNN`.
@@ -22,6 +22,7 @@ naming the pattern is what works.
22
22
  - Placement
23
23
  - Motion and transitions
24
24
  - Copy in the UI
25
+ - Copy that adds no meaning
25
26
  - Information architecture and flow
26
27
  - States and accessibility
27
28
  - Implementation defaults
@@ -51,11 +52,13 @@ naming the pattern is what works.
51
52
  flow_ and _States and accessibility_ do, `interface-clarity.md` and the spec
52
53
  are the rules. The entry is the form a breach of them takes on a generated
53
54
  screen.
54
- - The reviewer inside the prototyping loop does not apply this list. Root
55
- `DESIGN.md` locks the brand values that reviewer sees, so
56
- a pattern is caught where the design direction is reviewed and where
57
- `DESIGN.md` is written. No entry here is a `lap-*` detection, and none blocks
58
- the loop.
55
+ - The reviewer inside the prototyping loop does not apply the sections about
56
+ identity. Root `DESIGN.md` locks the brand values that reviewer sees, so a
57
+ pattern there is caught where the design direction is reviewed and where
58
+ `DESIGN.md` is written. That reviewer does apply _Copy that adds no meaning_,
59
+ through the criterion on explanatory text, because those patterns are about
60
+ what the text tells the user, not about a brand. No entry here is a `lap-*`
61
+ detection.
59
62
 
60
63
  ## Color and background
61
64
 
@@ -269,6 +272,21 @@ naming the pattern is what works.
269
272
  - The screen shows technical detail nobody asked for, such as GPU status or
270
273
  average generation time.
271
274
 
275
+ ## Copy that adds no meaning
276
+
277
+ These patterns are judged against the screen's tasks and the `supplements` its UI
278
+ contract declares, in SDD, in implementation and in every surface review. A chosen
279
+ visual direction does not exempt them. A disclosure about demo data, cost, storage
280
+ or transmission that is true and shown where the user decides is not one of them:
281
+ judge where it sits and what it lets the user do, not the word.
282
+
283
+ - A second heading or a sentence repeats the main heading, an action label, a
284
+ state, or the content beside it.
285
+ - A condition the user already knows is explained again where it adds nothing to
286
+ the decision being made.
287
+ - Production copy carries a development instruction, implementation commentary,
288
+ or a demo note repeated on screen after screen.
289
+
272
290
  ## Information architecture and flow
273
291
 
274
292
  - Sections follow the stock order: hero, logos, three features, stats or
@@ -25,6 +25,14 @@ Use source-backed discussion requirements to write one connected, testable story
25
25
  - An EX is one concrete input and expected result for exactly one AC. Split examples whose paths can pass or fail independently.
26
26
  - A BR is one independently falsifiable constraint. If removing a clause leaves another complete rule, split it.
27
27
 
28
+ A capacity-only sibling may represent the same actual actor goal within the
29
+ same BF when requested AC or EX additions exceed the source story's remaining
30
+ capacity. Prefer preserving published cases and IDs, and place only new,
31
+ cohesive incoming cases under their own covering change request. Confirm
32
+ retired-inclusive capacity and the owning approval before writing; this
33
+ exception invents no new product outcome and grants no future creation or move
34
+ permission.
35
+
28
36
  Allocate each ID as the highest ID of its kind in its defined scope plus one, counting retired IDs. Never reuse an ID. The scopes and widths are in the `ID allocation` section of the triage reference.
29
37
 
30
38
  ## Ambiguity
@@ -4,10 +4,35 @@ Use this sequence for /qfai-sdd. The shipped templates under ../templates/spec/
4
4
 
5
5
  ## Stage 0: source inventory
6
6
 
7
- 1. Run npx qfai sdd preflight and read its selectedInputPath and source. Respect an explicitly selected discussion pack, including one older than the newest pack.
8
- 2. Read the selected pack, completed reviews that target it, explicit user requirements, and the existing story tree. A pack is reference and provenance material. Disposition its applicable review advice in the SDD report, a decision row, or an open question. A pack discrepancy does not itself block SDD.
9
- 3. Stop if there is no usable input source. Stop on an unresolved product decision that cannot safely be inferred; record the question in open-questions.md.
10
- 4. If no discussion pack exists and an imported specification does, run npx qfai sdd preflight --import <path> with that file, which selects it as the source. An explicit user requirement is used as it is and named in the SDD report. Do not manufacture a discussion pack.
7
+ 1. Use the launcher established by
8
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher-mandatory`.
9
+ Record its resolved package path and version in the SDD report. Check that
10
+ the installed Stage 0 instructions support the procedure being used.
11
+ 2. Run `npx qfai sdd preflight` and read its `selectedInputPath` and `source`.
12
+ Respect an explicitly selected discussion pack, including one older than the
13
+ newest pack.
14
+ 3. Read the selected pack, completed reviews that target it, explicit user
15
+ requirements, and the existing story tree. A pack is reference and provenance
16
+ material. Disposition its applicable review advice in the SDD report, a decision
17
+ row, or an open question. A pack discrepancy does not itself block SDD. For
18
+ the current request, read the existing purpose in
19
+ `<paths.specsDir>/01_policy/objective.md` and inspect related flows and stories.
20
+ 4. A missing discussion pack does not mean that specifications are missing. If
21
+ an existing readable specification is authoritative for this request, run
22
+ `npx qfai sdd preflight --import <path>` with that file. The fallback does
23
+ not replace a selected pack or bypass unsafe pack names, unreadable files,
24
+ invalid active pointers, config errors, or a mismatched tool.
25
+ 5. Use an explicit user requirement as supplied and name it in the SDD report.
26
+ Do not invent an import file from conversation. Without a file, CLI preflight
27
+ can remain blocked while SDD assesses that explicit requirement.
28
+ 6. Use `/qfai-discussion` only when no usable source exists; stop SDD until one
29
+ is available. Stop on an unresolved product decision that cannot safely be
30
+ inferred; record the question in `open-questions.md`. Do not manufacture or
31
+ regenerate a past discussion pack, or regenerate the existing purpose,
32
+ merely to clear preflight.
33
+ 7. Import-lite readiness identifies the input source. It does not establish
34
+ complete requirements or a validation PASS. Keep the existing purpose and
35
+ current request while updating only affected flow and story content.
11
36
 
12
37
  ## Stage 1: triage and decisions
13
38
 
@@ -7,6 +7,7 @@ Triage selects the smallest story-tree change that answers each incoming require
7
7
  - Inputs
8
8
  - Operation choice
9
9
  - Decision and question rows
10
+ - Published decision prefix recovery
10
11
  - Approval and no-question mode
11
12
  - Retiring an EX, AC or BR
12
13
  - ID allocation
@@ -34,7 +35,7 @@ Inspect the impact cascade: policy → BF → US → AC → EX → enforcing con
34
35
  ## Decision and question rows
35
36
 
36
37
  Use <paths.specsDir>/decisions.md and <paths.specsDir>/open-questions.md, each with exactly ID, Content, Approach, Status. Append a row; later only Status may change, including to `PARTLY SUPERSEDED (by DEC-NNNN)` when a later row narrows a decision without replacing it.
37
- Do not edit the first three cells or remove the row. Use the next highest ID in the table plus one. A retired item still reserves its BF or US ID.
38
+ Do not edit the first three cells or remove the row, except for explicit branch-added decision renumbering under ID allocation below or the bounded published decision prefix recovery below. Inherited rows retain those cells. Use the next highest ID in the table plus one. A retired item still reserves its BF or US ID.
38
39
 
39
40
  decisions.md records only what the user decided: each change request the user approved or declined,
40
41
  and each critical decision the user made. A row is appended once the user has decided what it records.
@@ -58,6 +59,45 @@ whose Content opens Unadjudicated:, at TODO until decided. A justified test exce
58
59
  decision Content with Test exception:, names the exact BF, AC, or EX it exempts, and puts the reason
59
60
  in Approach. It takes effect only at DONE; it never exempts descendant items.
60
61
 
62
+ A test annotation may remain pending only when authority to change the
63
+ specification covers that state and the test deferral is approved. Record the
64
+ specification change in its own `Change request:` row. Record the deferral as a
65
+ `Test exception:` decision naming the exact AC at DONE. Its Approach states
66
+ the reason, untested scope, owner, next decision date and condition for restoring
67
+ the annotation.
68
+
69
+ DONE establishes the exception decision; it does not mean test completion.
70
+ The existing info finding names the exempted AC and its decision without
71
+ claiming test execution or coverage. The exception never exempts descendant EX
72
+ obligations or authorizes changes to EX or BR scope. Do not silently substitute
73
+ an EX or prose rewrite for an approved specification change. Use the next
74
+ decision date for manual review; there is no automatic expiry and no automatic
75
+ warning.
76
+
77
+ When specification changes are forbidden or either authority is missing, first
78
+ append an `Unadjudicated:` OQ at TODO. Name the affected IDs, expected versus
79
+ actual behavior, implementation-change evidence, owner and required permission.
80
+ Stop dependent AC, EX and BR edits; independent authorized work may continue.
81
+
82
+ ## Published decision prefix recovery
83
+
84
+ When an approved request names a published malformed decision added by the
85
+ branch, read `.qfai/assistant/rule/drift-protocol.md#published-decision-prefix-recovery`.
86
+ That rule defines the source, byte boundaries, exact prefix and stop conditions.
87
+ Approval of the generic protocol alone authorizes no target; append a separate
88
+ new target-specific recovery change request using `templates/change-request.md`.
89
+
90
+ Record the fixed base and unique common ancestor, absence of the target in both,
91
+ the published source commit's ancestry, raw Approach digests and the exact
92
+ approved prefix. Immediately before writing, recheck the unique current row,
93
+ its original ID, Content and Status, and its old digest. Preserve every original
94
+ Approach byte as the suffix and leave every other row unchanged. Recheck the
95
+ existing form and validation; status or supersession clears no malformed form.
96
+ Record actual results, including any stopped recovery, without claiming an
97
+ automatic repair. Inherited records and open-question rows remain excluded.
98
+ Rollback follows the recorded new-digest check and restores the original form
99
+ failure; it never resets, amends or force pushes.
100
+
61
101
  ## Approval and no-question mode
62
102
 
63
103
  Use the shared user-question protocol for CREATE, DELETE, SPLIT, MERGE, SUPERSEDE, and UPDATE:REMOVE. Present the target and rationale. Do not self-approve. A request from the user in the session that names the operation and its effect is the approval, and no second question is asked.
@@ -81,7 +121,7 @@ A story-tree or contract file changes only on the user's approval:
81
121
  records who approved it, when, and the label of the option chosen.
82
122
  3. Move the row to DONE once every change it names is written.
83
123
 
84
- A row present before the stage started keeps its ID, Content and Approach.
124
+ A row present before the stage started keeps its ID, Content and Approach, except for explicit branch-added decision renumbering under ID allocation below or published decision prefix recovery above. Inherited rows keep those cells without exception.
85
125
  Only a row this stage appended changes its Status.
86
126
 
87
127
  ## Retiring an EX, AC or BR
@@ -104,12 +144,74 @@ Read all IDs of the kind in the relevant scope, including IDs named by retiremen
104
144
  A contract number spans every contract kind, and a BR is numbered inside its contract. DEC and OQ each span their table.
105
145
  Empty numeric scopes begin at 0001, and AC/EX tails begin at 01. Do not reuse an ID because its file was removed or a row was rejected.
106
146
 
147
+ ### Capacity before writing
148
+
149
+ AC and EX tails stay two digits, from 01 through 99. Before writing a planned
150
+ batch, report each affected kind and story, its high-water number H (0 when
151
+ empty), remaining capacity 99-H and the number of requested additions. Count
152
+ valid IDs in the tree and decisions, including retired IDs, plus observed
153
+ published parallel heads and known reservations under the project's existing
154
+ method. Name the fixed observation and what it did not cover. A snapshot
155
+ reserves nothing and cannot cover unpublished concurrent work.
156
+
157
+ If requested additions exceed 99-H, stop before any partial allocation or
158
+ invalid declaration. Never fill gaps, reuse retired IDs or emit tail 100.
159
+ An empty scope has capacity 99. H = 98 allows one addition at tail 99, not two;
160
+ a retired 99 still exhausts the scope. Recheck newly published claims or
161
+ collisions before publication.
162
+
163
+ ### Capacity partition
164
+
165
+ Only additions exceeding an actual AC or EX scope's remaining 99-H qualify for
166
+ a capacity-only story partition. Record the source story, affected kind, H,
167
+ remainder and requested count first. Prefer leaving every published case and ID
168
+ in place and putting a cohesive incoming group in a capacity-checked sibling
169
+ under the same BF and actual actor goal. An in-force owning change request must
170
+ explicitly approve this partition and its affected paths before writing.
171
+
172
+ State the sibling's truthful cohesive scope and settle each criterion's owner;
173
+ do not invent a new product outcome, duplicate an obligation or weaken it.
174
+ A different actor, goal, flow or intended behavior needs its existing owning
175
+ approval path. Additions that fit the original scope do not qualify. Missing
176
+ authority, insufficient destination capacity or no truthful partition stops
177
+ the dependent write. This prospective split places new overflow cases; moving
178
+ an existing case also needs the complete map below. These instructions approve
179
+ no future specific creation, move or split.
180
+
181
+ ### Actual moves and incoming collisions
182
+
183
+ Before an approved actual AC/EX move or incoming collision repair, make a
184
+ complete one-to-one map of:
185
+
186
+ - the fixed source commit and declaration path;
187
+ - each original BF/US/AC/EX identity and its case meaning;
188
+ - destination story, AC/EX IDs and paths;
189
+ - every affected active BR citation and counted adjacent test declaration;
190
+ - unaffected cases and the input, expected outcome and executable assertion
191
+ each mapped case preserves.
192
+
193
+ Check both scopes' retired-inclusive capacity. Each destination EX needs one
194
+ existing destination AC; each AC needs an EX. Preserve every moved EX's
195
+ owning BR link and counted test obligation. An ID change alone proves no
196
+ coverage. Retire old moved IDs in a new approved record and never refill them.
197
+ Inherited published DEC ID, Content and Approach cells and their old-ID
198
+ references remain historical and unchanged; update only approved active
199
+ references.
200
+
201
+ Keep unaffected published cases and IDs. Identify same-number branch cases by
202
+ fixed provenance and meaning, and change only the provably incoming item,
203
+ without blanket replacement. Unknown ownership, ambiguous collisions,
204
+ uncovered declarations, missing counted test links, changed assertions or an
205
+ incomplete map stops the move without a completion claim. This is a manual
206
+ approval and mapping procedure, not a relocation executor or mapping schema.
207
+
107
208
  Two branches can take the same next ID. When a merge leaves one ID on two items:
108
209
 
109
210
  1. The merge target's item keeps the ID. Renumber the incoming item, the one the merge brings in.
110
211
  2. Give it the next ID of its scope.
111
212
  A renumbered BF or US takes its child IDs and its directory names with it, as a move to another BF does below.
112
- 3. Change every citation of the old ID in the same commit.
213
+ 3. Change every citation belonging to the incoming item in the same commit.
214
+ For a decision, leave inherited references unchanged.
113
215
  4. State the old ID, the new ID and the renamed record's subject or path in the commit message.
114
216
  A citation of the old ID elsewhere is then told apart from the item that kept it.
115
217
 
@@ -118,7 +220,33 @@ A row the incoming branch added takes the next ID of its table.
118
220
  An ID that two merged records already share is not renumbered:
119
221
  ask the user for a change request row that states which record each citation meant.
120
222
 
121
- A move to another BF changes the story's US ID and all child AC and EX IDs. Record the old IDs as retired, allocate new IDs in the destination scope, and update every citation before the move is complete.
223
+ For a unique decision added by the incoming branch, repair its ID before merging:
224
+
225
+ ```text
226
+ qfai sdd renumber-decision --from <old-DEC-ID> --to <new-DEC-ID> --base <local-ref>
227
+ ```
228
+
229
+ The explicit base and HEAD must resolve locally and have one common ancestor
230
+ that declares no source row. The base may already use that ID; the current
231
+ tree must declare it only once. Choose an unused destination above both story trees'
232
+ highest decision number, retired IDs included, within the four-digit grammar.
233
+ The command reserves no number and chooses no final number automatically.
234
+
235
+ Read the preview's fixed SHAs, IDs, relative paths and replacement lines or
236
+ counts. It writes nothing and dumps no original lines or full files. Each
237
+ invocation builds its own plan. Run with `--apply` to recheck that invocation's
238
+ fixed refs and original bytes before writing; changed refs after a preview can
239
+ produce a different plan. Preflight-only
240
+ `--format`, `--fail-on`, `--import` and `--assume` are not accepted here.
241
+ Only provably branch-added exact references change. Inherited references stay
242
+ fixed; ambiguous ownership, dirty or linked candidates, unsupported text or
243
+ failed reads stop the whole plan before writing. Unrelated links and dirty
244
+ files are not candidates. Apply rechecks original bytes before each write.
245
+ Rollback restores a changed file only if its bytes still match this invocation's
246
+ replacement, preserving concurrent changes and naming any unrestored path.
247
+ These checks guarantee neither atomic concurrency nor power-loss safety.
248
+
249
+ A move to another BF changes the story's US ID and all child AC and EX IDs. It follows the existing approval path, not the same-BF capacity exception. Apply the complete map above to approved active citations and retire old IDs in a new approved record; inherited DEC cells and their historical references stay unchanged.
122
250
 
123
251
  ## Completion of triage
124
252