qfai 2.1.1 → 2.2.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 (185) hide show
  1. package/README.md +56 -36
  2. package/assets/defaults/agent-routing/qfai-implement.yml +9 -0
  3. package/assets/defaults/agent-routing/qfai-triage.yml +18 -0
  4. package/assets/defaults/workflows/answer-in-session.yml +8 -0
  5. package/assets/defaults/workflows/quarantine-flaky.yml +3 -0
  6. package/assets/defaults/workflows/repair-consistency.yml +1 -0
  7. package/assets/defaults/workflows/run-operation.yml +11 -0
  8. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  9. package/assets/defaults/workflows/write-procedure.yml +18 -0
  10. package/assets/graph/codegraph-native.mjs +174 -0
  11. package/assets/graph/graphify-native.py +72 -0
  12. package/assets/init/.claude/settings.json +9 -9
  13. package/assets/init/.codex/hooks.json +8 -8
  14. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  15. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  16. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  17. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  18. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  19. package/assets/init/.qfai/assistant/rule/constitution.md +31 -15
  20. package/assets/init/.qfai/assistant/rule/drift-protocol.md +119 -2
  21. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +6 -4
  22. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +27 -0
  23. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +21 -9
  24. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  25. package/assets/init/.qfai/assistant/rule/review-convergence.md +25 -12
  26. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +16 -25
  27. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +16 -11
  28. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  29. package/assets/init/.qfai/assistant/rule/workflow.md +2 -1
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +6 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +20 -15
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  34. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +1 -6
  35. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -20
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +4 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +8 -2
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +16 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  41. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +46 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +5 -2
  43. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +3 -3
  44. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +12 -6
  45. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +1 -265
  46. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +4 -3
  48. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +2 -3
  49. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +17 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +52 -37
  51. package/assets/init/.qfai/assistant/skill/qfai-run/references/codex-cloud-install.md +80 -0
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  53. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +83 -49
  54. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +226 -11
  55. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +6 -3
  56. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +132 -0
  57. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +14 -0
  58. package/assets/init/.qfai/assistant/skill/qfai-run/scripts/codex-cloud-install.mjs +117 -0
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +4 -3
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -0
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +23 -5
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +20 -7
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +8 -0
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -4
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -1
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +159 -4
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +14 -2
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +146 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -29
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +38 -1
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  74. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +12 -0
  75. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +34 -21
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +5 -4
  77. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  78. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +80 -15
  79. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +35 -21
  80. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  81. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  82. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  83. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  84. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  85. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  86. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  87. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +33 -20
  88. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +124 -8
  89. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +10 -2
  90. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -0
  91. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +26 -9
  92. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +15 -8
  93. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +5 -1
  94. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +6 -1
  95. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  96. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +6 -4
  97. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  98. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  99. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -2
  100. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  101. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  102. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +69 -0
  103. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +24 -7
  104. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  105. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +7 -6
  106. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  107. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  108. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +6 -5
  109. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +34 -3
  110. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  111. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +39 -5
  112. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  113. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  114. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  115. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  116. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +9 -3
  117. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  118. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  119. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  120. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +34 -10
  121. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +7 -6
  122. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  123. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  124. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  125. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  126. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  127. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  128. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +50 -0
  129. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  130. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  131. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  132. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +1 -0
  133. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +37 -9
  134. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  135. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +14 -16
  136. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  137. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +46 -4
  138. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +133 -30
  139. package/assets/init/root/.agents/rules/ai-readable-markdown.md +2 -2
  140. package/assets/init/root/.agents/rules/api-budget.md +187 -8
  141. package/assets/init/root/.agents/rules/document-schema.md +17 -0
  142. package/assets/init/root/.agents/rules/documentation-clarity.md +163 -34
  143. package/assets/init/root/.agents/rules/graph-exploration.md +150 -0
  144. package/assets/init/root/.agents/rules/grilling.md +100 -43
  145. package/assets/init/root/.agents/rules/minimal-implementation.md +3 -3
  146. package/assets/init/root/.agents/rules/reminders.json +27 -18
  147. package/assets/init/root/.agents/rules/session-feedback.md +131 -0
  148. package/assets/init/root/.agents/rules/temporary-files.md +33 -0
  149. package/assets/init/root/.agents/rules/untrusted-content.md +2 -2
  150. package/assets/init/root/.agents/rules/user-questions.md +51 -40
  151. package/assets/init/root/.github/workflows/qfai-docs.yml +3 -3
  152. package/assets/init/root/.github/workflows/qfai-tests.yml +88 -35
  153. package/assets/init/root/.github/workflows/qfai-validate.yml +2 -2
  154. package/assets/init/root/AGENTS.md +24 -22
  155. package/assets/sandbox-templates/default-deny.yaml +9 -3
  156. package/assets/schemas/workflow/extraction.schema.json +89 -5
  157. package/assets/scripts/check-mdschema.mjs +77 -8
  158. package/assets/uix-rev/comparison-review.md +1 -1
  159. package/assets/uix-rev/contracts-review.md +1 -2
  160. package/dist/cli/index.cjs +9444 -10071
  161. package/dist/cli/index.cjs.map +1 -1
  162. package/dist/cli/index.mjs +9421 -10041
  163. package/dist/cli/index.mjs.map +1 -1
  164. package/dist/graph/cli.cjs +1568 -0
  165. package/dist/graph/cli.cjs.map +1 -0
  166. package/dist/graph/cli.d.cts +9 -0
  167. package/dist/graph/cli.d.ts +9 -0
  168. package/dist/graph/cli.mjs +1541 -0
  169. package/dist/graph/cli.mjs.map +1 -0
  170. package/dist/graph/hook.cjs +817 -0
  171. package/dist/graph/hook.cjs.map +1 -0
  172. package/dist/graph/hook.d.cts +9 -0
  173. package/dist/graph/hook.d.ts +9 -0
  174. package/dist/graph/hook.mjs +792 -0
  175. package/dist/graph/hook.mjs.map +1 -0
  176. package/dist/index.cjs +7634 -8517
  177. package/dist/index.cjs.map +1 -1
  178. package/dist/index.d.cts +146 -658
  179. package/dist/index.d.ts +146 -658
  180. package/dist/index.mjs +7462 -8318
  181. package/dist/index.mjs.map +1 -1
  182. package/dist/process-C21nTvkT.d.cts +12 -0
  183. package/dist/process-C21nTvkT.d.ts +12 -0
  184. package/package.json +4 -6
  185. 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,10 @@ 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, where the route runs one, and the first stage in the same turn
108
+ without waiting for a reply.
109
+ Text that is not a request gets no plan and no announcement.
57
110
 
58
111
  ## Questions
59
112
 
@@ -77,12 +130,33 @@ Independent questions go in one round; a dependent one waits for its answer.
77
130
  - Under a no-question mode nothing is asked. `SKILL.md` says what is done
78
131
  instead.
79
132
 
133
+ ## Repair found by a question-only stage
134
+
135
+ Read this section when a question-only request finds a defect and its move to
136
+ tracked-file repair lacks explicit authority for the same target.
137
+
138
+ Show the defect and its evidence, the proposed repair scope and the planned
139
+ checks. Put one question through the structured question tool in the form
140
+ `.agents/rules/user-questions.md` requires:
141
+
142
+ - **Repair:** authorize the stated repair and checks for this target.
143
+ - **Report and stop:** report the finding and stop this target without edits.
144
+
145
+ Write nothing before the answer. Repair permission takes the destination's
146
+ existing plan; add no stage or scope. The guards for a third branch move, a
147
+ scope that leaves stages out and release approval still apply.
148
+
149
+ Under a no-question mode, report the defect and required repair permission and
150
+ stop that target. Write no tracked `open-questions.md` row for this choice;
151
+ asking for no questions alone supplies no repair authority. Other authorized
152
+ independent targets may continue.
153
+
80
154
  ## A step only a person can take
81
155
 
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:
156
+ A change can depend on a step only a person can take: interactive login, a
157
+ new permission grant or an expansion of authority. The plan stays the
158
+ repository change. The work stops before the stage that needs that action
159
+ and says three things:
86
160
 
87
161
  - what the user must do, in plain words, and where;
88
162
  - what shows it was done;
@@ -93,14 +167,130 @@ Put it as one question that ends the turn, in the form
93
167
  `.agents/rules/user-questions.md` sets out. The options are that the user did
94
168
  it, and `stop`.
95
169
 
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.
170
+ - The user completes person-only login, new permission grants and authority
171
+ expansion in the service's own page. A human-run or triage handoff never
172
+ performs the user's operation on their behalf.
98
173
  - The agent reads only the evidence it named. It reports the action as
99
174
  confirmed or not confirmed, and goes on after it only when confirmed or the
100
175
  user says to go on.
101
176
  - Under a no-question mode nothing is asked. The work that does not depend on
102
177
  the action goes on, and the final report lists the action as not done.
103
178
 
179
+ ## Authorized external actions
180
+
181
+ Read this section when a repository change needs an account setting or a
182
+ credential installed outside the repository.
183
+
184
+ An agent may perform that action only when prior user instructions or project
185
+ policy cover the specific target and action, and the host provides an allowed
186
+ safe channel. A connector's availability alone proves neither authority nor
187
+ access. Reuse covering authority without inventing a new permission grant.
188
+
189
+ Check that the actual credential's account, project, scope and expiry fit that
190
+ authority. One-time permission is not continuing access. Third-party credential
191
+ ownership needs its own authority; permission for this project does not supply
192
+ it. Use only the host's actual safe channel for credential installation. Never
193
+ put a password, token or key in chat, logs or tracked files, or ask the user to
194
+ paste it there. Interactive login, new permission grants and authority expansion
195
+ remain person-only actions.
196
+
197
+ If authority, credential ownership or a safe channel is absent or unknown, or
198
+ the host denies the action, stop the dependent action. Give concrete manual
199
+ steps, the evidence that would confirm them and a read-only verification check.
200
+ Do not bypass the denial or infer missing authority from a generic request to
201
+ proceed. Keep a human-run or triage handoff as a handoff; other authorized
202
+ independent work may continue.
203
+
204
+ Record host access or CI start, authorization, credential installation, CI
205
+ results, merge and publication separately in the existing stage report. For
206
+ each relevant effect state confirmed, pending, unverified or not requested,
207
+ with its target, exact revision, evidence URL when available, blocker and
208
+ resume condition where needed. Missing evidence stays unverified. A green CI
209
+ result proves neither merge nor publication. Report the implemented repository
210
+ change separately from unverified external effects.
211
+
212
+ ## Replies to a waiting step
213
+
214
+ Read this section before treating a user's reply as a new request.
215
+
216
+ - A reply answering a pending question or reporting the requested operation's
217
+ result resumes the same waiting step, including a reported failure. Use no
218
+ new plan and no skill invocation for that reply.
219
+ - Free text supplying the requested value is an answer to that waiting step,
220
+ even if it does not repeat an option label.
221
+ Never treat an unrelated instruction as selection or approval of an option.
222
+ - Dismissal or no response is not an answer or permission. Continue a routine
223
+ choice only under authorization the user already gave. A missing hard-required
224
+ fact, uncovered mandatory approval, cancellation or explicit tool block stays
225
+ protected; do only independent work that remains authorized.
226
+ - An independent new request is planned under the extraction and scope rules
227
+ in `SKILL.md`. If a reply also contains one, resume the waiting step with its
228
+ answer and plan the independent request separately.
229
+ - A separate explicit request to investigate the failure or repeat the operation
230
+ is planned as a new request under those same rules.
231
+ - An answer to a closed request for information follows only the plan's branch
232
+ for received information. Add no branch or step.
233
+ - For an ambiguous reply, do not assume success, completion, new facts or
234
+ approval. State what remains unconfirmed. Ask for any fact or decision still
235
+ needed under the normal question rules.
236
+
237
+ Background waiting needs no question. Report the current state, awaited
238
+ evidence or result and resume condition; promise no automatic restart unless
239
+ the host provides it. Follow `.agents/rules/user-questions.md` § 6 when an
240
+ answer is needed. A completion-only final report needs no question.
241
+
242
+ ## Independent targets under one goal
243
+
244
+ Read this section before handling several independent targets under one goal
245
+ or switching the checkout during a target's wait.
246
+
247
+ Plan each target separately only when its scope is settled and independent.
248
+ Keep each plan's scope, stage order, steps, review and release points. A target
249
+ with an unfinished prerequisite waits; mixed findings with unsettled scopes
250
+ still take the existing bundle/decomposition handling. Give newly eligible
251
+ targets within the goal's criteria their own plans. Report an out-of-scope
252
+ finding as a follow-up, never as an extra step in the current target.
253
+ If no planned stage serves work this target needs, stop that target and name
254
+ the owner and stage skill to invoke. Other authorized independent targets may
255
+ continue.
256
+
257
+ Use the existing stage reports and handoff messages to retain each target's
258
+ plan and scope, stage and step, branch and exact head, evidence, open approval
259
+ or blocker, and resume condition. Report waiting targets as waiting. Before
260
+ writing or using a result, confirm its target and head. A green check for an
261
+ older or different head does not pass the current one; pending checks do not
262
+ complete verification. A matching red check resumes the planned gate and its
263
+ fix procedure. Keep each review verdict bound to the commit reviewed; never
264
+ relabel it as a review of a newer head or add a review the plan does not name.
265
+
266
+ Before changing the shared checkout, wait for every writer and local gate
267
+ using it, preserve target edits in a permitted commit of only its paths, and
268
+ ensure the whole index and worktree are clean. Unknown dirty files postpone
269
+ the switch; do not stash, reset or delete them to move on. A reviewer using
270
+ live files or checkout-dependent execution must finish. A read-only reviewer
271
+ using only `git show <fixed SHA>:<path>` may continue across a clean orchestrator switch;
272
+ the reviewer never switches the checkout. CI-only pending gates use the
273
+ existing DELEGATED commit allowance only under a user instruction or project
274
+ policy covering that verification commit and its tracked paths. The project
275
+ must declare the gate CI-only and name its actual check. Every nondelegated gate
276
+ must pass. A delegated red check stops transport of the same unchanged candidate.
277
+ Explicit CI-only delegation covering transport may instead carry actual changes
278
+ addressing that failure through the existing planned fix into a new candidate,
279
+ even while HEAD names the failed commit. Keep the prior head, check, run and
280
+ observed result as FAIL; never relabel that evidence pending. Report the actual
281
+ fix and the new head after committing. Its missing or pending CI result leaves
282
+ verification incomplete. Ordinary FAIL or UNRUN still stops the commit. A commit
283
+ grants no push or pull request authority: each remote action needs its own covered
284
+ instruction or policy. Waiting alone never authorizes a commit or skipped gate.
285
+
286
+ Use standing delegation only for the targets and actions it actually covers.
287
+ Report routine choices as the agent's decisions under that authority, never
288
+ as the user's individual option approval. A request to ask nothing supplies
289
+ no uncovered approval. If a critical decision or release approval is missing,
290
+ stop that target before dependent work and follow the existing question or
291
+ no-question rules. Other authorized independent work may continue. A stop of
292
+ the whole goal stops every target.
293
+
104
294
  ## Halt notice
105
295
 
106
296
  One notice when the work stops before its end:
@@ -121,10 +311,35 @@ reset, a stash, a branch switch or a worktree removal.
121
311
  | 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
312
  | At a closing step | The closure outcome and each follow-up request, never that a change is done |
123
313
  | With a gate failing | Each failing gate marked pre-existing or new, with its owner. Nothing reads as complete |
314
+ | With delegated CI pending | The verification commit, pending checks and resume condition; verification remains incomplete |
124
315
 
316
+ - For a CI wait, name the target, current head, run ID or URL when available,
317
+ check, actual outcome and counts, blocker and resume condition. State when no
318
+ run exists. Missing, red or mismatched evidence stops formal completion or
319
+ merge; every required check needs actual passing evidence for the current head.
320
+ - Report repository outcome separately from external publication. A local commit
321
+ is not a push or pull request, and passing repository checks do not prove a
322
+ deployment, package publication or other external effect occurred.
323
+ - Name `common-policy-check` and its outcome, or that it did not run and why.
125
324
  - A gate shows its verdict only.
126
325
  - An external effect nobody requested is listed as not requested.
127
326
  - 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.
327
+ - Ask for the next action only when proceeding requires the user's answer,
328
+ in the shape `.agents/rules/user-questions.md` § 6 requires. A report that
329
+ only states completion needs no question. Under a no-question mode, list any
330
+ remaining actions without asking.
331
+ - When the report closes the user's last task and nothing waits on the user,
332
+ with no question, approval or choice open, follow
333
+ `.agents/rules/session-feedback.md` once, after the report. A report at a
334
+ chosen scope, at a halt, with a gate failing or CI pending, or with a question
335
+ is a pause and runs no review, and neither does a report after the review
336
+ already ran for the user's latest instruction.
337
+
338
+ ## Work orders summary
339
+
340
+ Read this section when parts ran in parallel. Report one row per part given to
341
+ a sub-agent.
342
+
343
+ | Step | Role (sub-agent) | Agent instance | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE/PENDING) |
344
+ | ---- | ---------------- | --------------- | ----------------- | ------------- | ------------- | ---------------------------- |
345
+ | 1 | `<role>` | `<instance id>` | `<part in words>` | The step file | The result | PASS/REVISE |
@@ -154,6 +154,8 @@ the ids of the stages it runs in plan order, and `true` for the narrowest.
154
154
  that writes code, every verify stage that ends the route follows.
155
155
  - `medium` adds the change note and the gates to those stages; where `narrow`
156
156
  already holds implementation, it equals `narrow`.
157
+ - Documentation-only maintenance or procedure writing keeps the change note
158
+ and closing gates. A procedure plan therefore gets `broad` alone.
157
159
  - A security intake plan gets `broad` alone.
158
160
  - `broad` runs every stage.
159
161
 
@@ -181,9 +183,10 @@ keeps its scopes: `--route` returns none.
181
183
  `schema` for an extraction field, naming its `cause`: `missing` for a required
182
184
  field that is absent, `unknown` for a key the extraction does not take,
183
185
  `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
186
+ field's vocabulary, and `invalid` for the rules tying `alternatives` to
187
+ `confidence` or requiring `owned-temporary-cleanup` to use `intent: order` and
188
+ empty `artifacts`, including alternative readings. Each cause states what was
189
+ expected and received, or the field name. `unknown-route` for a route the catalog does
187
190
  not name, `plan-invalid` for a plan that does not load, naming its `file` and
188
191
  `cause`, `artifact-unserved` for an artifact the extraction names when no stage
189
192
  of the route writes any artifact it names, so the work stops before the first
@@ -0,0 +1,132 @@
1
+ # Reached-step observations
2
+
3
+ Use this procedure at each existing stage boundary to compare reached scoped work with actual observations. Keep the comparison in the existing ignored human stage report or handoff. It is not a completion detector, new gate or evidence schema.
4
+
5
+ ## Contents
6
+
7
+ - Reach and termination
8
+ - The stage comparison
9
+ - Missing proof and observed omission
10
+ - Purpose and source binding
11
+ - No-write passes
12
+ - Gate observations
13
+ - Recover existing receipts safely
14
+ - Native read-only example
15
+ - Existing review and limits
16
+
17
+ ## Reach and termination
18
+
19
+ Compare the finite set of steps whose turn was reached in the selected scope before a declared stop or termination. Name the selected scope, reached boundary and any declared stop. Legitimately excluded or unreached work is neither an omission nor completed work.
20
+
21
+ Preserve plan order, scope, stop conditions and pass-through. A branch outcome ends its old route at the declared point; later steps of that route are not fabricated as completed. Do not add a step to obtain proof or silently omit a reached obligation.
22
+
23
+ ## The stage comparison
24
+
25
+ Use the existing stage report, not a new schema. For each reached step retain these human-readable observations:
26
+
27
+ | Observation | What to retain |
28
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------- |
29
+ | Identity | Plan step, owner, purpose, target and source identity; include the full source head where applicable. |
30
+ | Work | Actual input reads, action or output and artifact references. A file path alone does not establish its contents or use. |
31
+ | Gate | Applicable Gate observations from the actual command and result, without borrowing an unrelated green result. |
32
+ | Assessment | Supported completion, an observed incomplete result, or UNVERIFIED with missing proof, owner and resume condition. |
33
+
34
+ A supported comparison assesses this reached step only. It does not pass unrelated gates, complete later work or establish that an agent understood instructions.
35
+
36
+ ## Missing proof and observed omission
37
+
38
+ A plan declaration or content-read receipt establishes neither procedural execution nor understanding or adherence. Missing evidence leaves completion UNVERIFIED: name the missing proof or blocker, owner and resume condition. Absence alone does not prove that an action was omitted.
39
+
40
+ Positive target-bound evidence that a required action was not performed is different. Report the observed omission and its evidence as an incomplete result, then resume the existing authorized owner procedure. Do not add a step, route, review or gate. An actor's target-bound record explicitly saying the required action was not performed can support an omission; an absent output file alone cannot.
41
+
42
+ Keep these two assessments distinct. Do not claim an omission merely because a report is missing, or hide positive omission evidence behind an unknown-proof label.
43
+
44
+ ## Purpose and source binding
45
+
46
+ Check the target, source identity and purpose before consuming evidence or resuming writes. A wrong target, old source or wrong purpose leaves completion UNVERIFIED with the actual missing proof or blocker. A matching command name or totals are not enough proof.
47
+
48
+ An unrelated green build cannot complete a reached design step. If its required artifact or procedural proof is missing, leave that completion UNVERIFIED and name the owner and resume condition. Keep the build's actual result without using it for a different obligation.
49
+
50
+ Inspect available receipts against the reached step and current source. A successful read of an old artifact shows only what that source contains; it does not verify the current work.
51
+
52
+ ## No-write passes
53
+
54
+ A reached pass-through step records the actual input reads and their source identity, the `Passes when` condition it checked, and its declared no-write reason. The step ran despite writing nothing; this is not a skip.
55
+
56
+ Retain applicable Gate observations for the planned independent review. A valid pass remains available to that review. Do not require an invented output for a step whose checked pass condition permits no write.
57
+
58
+ ## Gate observations
59
+
60
+ Retain the actual command, purpose, status and observed result, including an available exit or signal outcome. For test commands retain actual executed case counts and their evidence. For non-test commands use execution/result evidence with no invented case counts.
61
+
62
+ Keep the artifact reference and any available outcome. Unknown exit, counts or evidence remain unknown. Actual FAIL, UNRUN and pending results cannot become PASS through step metadata, a declaration or a read receipt. Existing delegated transport is not formal completion; its pending result stays visible until actual evidence arrives.
63
+
64
+ UNVERIFIED is an assessment in the human comparison. It adds no state or field to the public verification output. Preserve the existing command result and required gates rather than replacing them with this assessment.
65
+
66
+ ## Recover existing receipts safely
67
+
68
+ Inspect existing receipts and recover available target-bound proof before deciding what is genuinely owed. Do not repeat an irreversible or external action merely to manufacture evidence. A missing reference can often be repaired by linking a receipt that already exists.
69
+
70
+ If proof is unavailable or cannot be recovered safely, keep the blocker, owner and resume condition. Resume only genuinely owed work with existing covered authority through its current owner procedure. Gathering observations does not grant new action permission.
71
+
72
+ ## Native read-only example
73
+
74
+ This optional example invokes existing native Git reads, not a new QFAI command.
75
+ Review the local checkout, full source identifier and tracked text artifact path before use.
76
+ Read only text already cleared for this report; do not dump secrets or publish its contents automatically.
77
+ Save the block in an owned temporary `.mjs` file and supply those three arguments in that order.
78
+ Binary verification and unreviewed inputs are outside this example.
79
+
80
+ The reads are bounded to 1 MiB of output and 10 seconds each. Repository override environment variables are excluded, optional index writes are disabled, and the status read uses no filesystem monitor. A bounded or failed read can leave partial evidence; do not treat it as a complete receipt.
81
+
82
+ ```js
83
+ import { spawnSync } from "node:child_process";
84
+
85
+ const [checkout, source, artifact] = process.argv.slice(2);
86
+ if (!checkout || !source || !artifact) {
87
+ process.stderr.write("Supply the reviewed checkout, source and tracked artifact.\n");
88
+ process.exit(1);
89
+ }
90
+
91
+ if (![40, 64].includes(source.length) || /[^0-9a-f]/i.test(source)) {
92
+ process.stderr.write("Supply a full 40- or 64-digit hexadecimal source identifier.\n");
93
+ process.exit(1);
94
+ }
95
+
96
+ const env = Object.fromEntries(
97
+ Object.entries(process.env).filter(([key]) => !key.toUpperCase().startsWith("GIT_")),
98
+ );
99
+ const reads = [
100
+ ["rev-parse", "--verify", "HEAD"],
101
+ ["status", "--porcelain=v1", "--untracked-files=no"],
102
+ ["show", `${source}:${artifact}`],
103
+ ];
104
+ for (const args of reads) {
105
+ const result = spawnSync(
106
+ "git",
107
+ ["--no-optional-locks", "-c", "core.fsmonitor=false", "-C", checkout, ...args],
108
+ { encoding: "utf8", env, maxBuffer: 1024 * 1024, timeout: 10_000 },
109
+ );
110
+ process.stdout.write(`git ${args[0]} exit: ${result.status ?? "unavailable"}\n`);
111
+ process.stdout.write(result.stdout ?? "");
112
+ process.stderr.write(result.stderr ?? "");
113
+ if (result.error) process.stderr.write(`${result.error.message}\n`);
114
+ if (result.signal) process.stderr.write(`Signal: ${result.signal}\n`);
115
+ if (result.error || result.signal || result.status !== 0) process.exitCode = 1;
116
+ }
117
+ ```
118
+
119
+ The example reports raw read outcomes.
120
+ Its zero exit does not complete a plan step.
121
+ Compare the observed current HEAD with the requested source and the actual target/purpose before using the artifact.
122
+ A missing artifact read is failed evidence collection, not proof that its required action was omitted.
123
+ Successful reads and unchanged files do not establish a `Passes when` decision; the owner records that actual decision separately.
124
+
125
+ ## Existing review and limits
126
+
127
+ The already-planned independent reviewer assesses the reached work it reviews against actual observations and reports unresolved proof without an extra review or gate. Preserve reviewer independence, count, route and plan order. The comparison changes none of the selected scope, termination, pass-through, authority or required gate obligations.
128
+
129
+ No engine, command, plan key, runtime schema, ledger, registry or automatic obedience detector is introduced.
130
+ Reports remain existing human artifacts.
131
+ A passing instruction fixture does not prove host understanding or adherence, and the native read example proves only its observed reads and outcomes.
132
+ Missing or stale observations can still leave work UNVERIFIED; no automatic or zero-cost conformance claim is made.
@@ -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
@@ -0,0 +1,117 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { accessSync, constants, readFileSync, statSync } from "node:fs";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
+
6
+ function failure(label, error, recovery) {
7
+ const reason = error?.code ?? error?.name ?? "unavailable";
8
+ process.stderr.write(`${label}: ${reason}. ${recovery}\n`);
9
+ return 1;
10
+ }
11
+
12
+ function run(command, args, cwd, label) {
13
+ const result = spawnSync(command, args, { cwd, shell: false, stdio: "inherit" });
14
+ if (result.error)
15
+ return failure(
16
+ `${label} could not start`,
17
+ result.error,
18
+ "Check that the executable is available and the target cwd is readable, then rerun dependency preparation.",
19
+ );
20
+ if (result.signal) {
21
+ process.stderr.write(
22
+ `${label} ended on signal ${result.signal}. Review the failed command output and resolve its cause before rerunning dependency preparation.\n`,
23
+ );
24
+ return 1;
25
+ }
26
+ if (result.status !== 0) {
27
+ process.stderr.write(
28
+ `${label} exited ${result.status ?? "without an exit code"}. Review the failed command output and resolve its cause before rerunning dependency preparation.\n`,
29
+ );
30
+ return result.status ?? 1;
31
+ }
32
+ return 0;
33
+ }
34
+
35
+ function filePresent(file) {
36
+ try {
37
+ return statSync(file).isFile();
38
+ } catch (error) {
39
+ if (error?.code === "ENOENT") return false;
40
+ throw error;
41
+ }
42
+ }
43
+
44
+ function prepare() {
45
+ const args = process.argv.slice(2);
46
+ if (args.length < 4 || args[0] !== "--cwd" || args[2] !== "--" || !args[3]) {
47
+ process.stderr.write("Supply --cwd <absolute-checkout> -- <executable> [argument...].\n");
48
+ return 1;
49
+ }
50
+ const cwd = args[1];
51
+ if (!path.isAbsolute(cwd)) {
52
+ process.stderr.write("The cwd must be an absolute project directory.\n");
53
+ return 1;
54
+ }
55
+ try {
56
+ if (!statSync(cwd).isDirectory()) {
57
+ process.stderr.write("The cwd must be a readable project directory.\n");
58
+ return 1;
59
+ }
60
+ accessSync(cwd, constants.R_OK);
61
+ } catch (error) {
62
+ return failure(
63
+ "Cannot read the cwd directory",
64
+ error,
65
+ "Supply a readable absolute checkout directory, then rerun dependency preparation.",
66
+ );
67
+ }
68
+
69
+ const installed = run(args[3], args.slice(4), cwd, "Installation");
70
+ if (installed !== 0) return installed;
71
+
72
+ let proof = "local binary";
73
+ try {
74
+ if (!filePresent(path.join(cwd, "node_modules", ".bin", "qfai"))) {
75
+ const marker = [".pnp.cjs", ".pnp.loader.mjs"].some((name) =>
76
+ filePresent(path.join(cwd, name)),
77
+ );
78
+ if (!marker) {
79
+ process.stderr.write(
80
+ "The target checkout has no canonical qfai launcher. Check that the reviewed target declares qfai and that the installation prepares its canonical qfai launcher before rerunning dependency preparation.\n",
81
+ );
82
+ return 1;
83
+ }
84
+ const manifest = JSON.parse(readFileSync(path.join(cwd, "package.json"), "utf8"));
85
+ if (!manifest?.dependencies?.qfai && !manifest?.devDependencies?.qfai) {
86
+ process.stderr.write("The target PnP project must declare qfai as a dependency.\n");
87
+ return 1;
88
+ }
89
+ const confirmed = run(
90
+ "yarn",
91
+ ["exec", "qfai", "--help"],
92
+ cwd,
93
+ "Canonical launcher confirmation",
94
+ );
95
+ if (confirmed !== 0) return confirmed;
96
+ proof = "Plug'n'Play";
97
+ }
98
+ } catch (error) {
99
+ return failure(
100
+ "Canonical qfai launcher proof failed",
101
+ error,
102
+ "Check the target package.json and canonical qfai launcher, then rerun dependency preparation.",
103
+ );
104
+ }
105
+ process.stdout.write(`Dependency preparation succeeded in ${cwd} (${proof}).\n`);
106
+ return 0;
107
+ }
108
+
109
+ try {
110
+ process.exitCode = prepare();
111
+ } catch (error) {
112
+ process.exitCode = failure(
113
+ "Dependency preparation failed",
114
+ error,
115
+ "Check the target cwd and reviewed installation command, then rerun dependency preparation.",
116
+ );
117
+ }
@@ -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`.