qfai 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +23 -3
  2. package/assets/init/.claude/settings.json +35 -1
  3. package/assets/init/.codex/hooks.json +24 -0
  4. package/assets/init/.github/instructions/code-review.instructions.md +1 -1
  5. package/assets/init/.qfai/assistant/agent/architecture-reviewer.md +2 -2
  6. package/assets/init/.qfai/assistant/agent/fullstack-engineer.md +32 -4
  7. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +4 -4
  8. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -3
  9. package/assets/init/.qfai/assistant/agent/requirements-reviewer.md +2 -2
  10. package/assets/init/.qfai/assistant/rule/agent-selection.md +1 -1
  11. package/assets/init/.qfai/assistant/rule/communication.md +1 -1
  12. package/assets/init/.qfai/assistant/rule/constitution.md +77 -242
  13. package/assets/init/.qfai/assistant/rule/drift-protocol.md +30 -164
  14. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +3 -2
  15. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +2 -2
  16. package/assets/init/.qfai/assistant/rule/references/placeholder-scan.md +2 -3
  17. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +3 -3
  18. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +12 -3
  19. package/assets/init/.qfai/assistant/rule/review-convergence.md +6 -6
  20. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +6 -6
  21. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +17 -17
  22. package/assets/init/.qfai/assistant/rule/test-layers.md +1 -1
  23. package/assets/init/.qfai/assistant/rule/thinking.md +2 -2
  24. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +5 -5
  25. package/assets/init/.qfai/assistant/rule/ui-procurement.md +1 -1
  26. package/assets/init/.qfai/assistant/rule/workflow.md +12 -12
  27. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +12 -14
  28. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +2 -4
  29. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/03_Story-Workshop.md +1 -2
  30. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-grill/SKILL.md +1 -3
  32. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -43
  33. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/confirmation-sheet.md +71 -0
  34. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +18 -1
  35. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +2 -4
  36. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +3 -3
  37. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +35 -2
  38. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +2 -4
  39. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +0 -2
  40. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +2 -3
  41. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +5 -6
  42. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +75 -4
  43. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +2 -1
  44. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +58 -3
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +11 -2
  46. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +41 -10
  47. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +7 -8
  48. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +12 -7
  49. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +1 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +10 -12
  51. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +25 -27
  52. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +8 -10
  53. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +36 -3
  54. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +8 -9
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +6 -6
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +6 -6
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +5 -5
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +5 -5
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +3 -3
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +115 -199
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +25 -25
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +23 -113
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +2 -2
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +8 -7
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -0
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions/page-NNNN.md +2 -2
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +59 -31
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/open-questions.md +15 -11
  69. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +1 -3
  70. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +2 -4
  71. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +1 -1
  72. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +1 -3
  73. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +9 -9
  74. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +2 -2
  75. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +3 -3
  76. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -1
  77. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +6 -4
  78. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +7 -7
  79. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +43 -0
  80. package/assets/init/.qfai/assistant/step/implement-acceptance/STEP.md +1 -1
  81. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -13
  82. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +1 -1
  83. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +2 -2
  84. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +5 -5
  85. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +7 -8
  86. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +17 -17
  87. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +1 -1
  88. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +89 -12
  89. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +16 -15
  90. package/assets/init/.qfai/assistant/step/sdd-cycle/STEP.md +7 -8
  91. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +25 -4
  92. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +6 -6
  93. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +66 -75
  94. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +29 -15
  95. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +2 -4
  96. package/assets/init/.qfai/assistant/step/verify-context/STEP.md +1 -1
  97. package/assets/init/root/.agents/rules/ai-readable-markdown.md +8 -1
  98. package/assets/init/root/.agents/rules/delegation-steering.md +69 -0
  99. package/assets/init/root/.agents/rules/grilling.md +72 -43
  100. package/assets/init/root/.agents/rules/minimal-implementation.md +5 -5
  101. package/assets/init/root/.agents/rules/reply-forms.md +191 -0
  102. package/assets/init/root/.agents/rules/session-feedback.md +104 -27
  103. package/assets/init/root/.agents/rules/user-questions.md +6 -1
  104. package/assets/init/root/.gitattributes +5 -6
  105. package/assets/init/root/AGENTS.md +4 -2
  106. package/assets/mdschema/story/03_contract/tech.mdschema.yml +1 -1
  107. package/assets/mdschema/story/decisions/page-NNNN.mdschema.yml +3 -3
  108. package/assets/mdschema/story/decisions.mdschema.yml +4 -4
  109. package/assets/mdschema/story/open-questions.mdschema.yml +3 -3
  110. package/assets/schemas/workflow/extraction.schema.json +0 -2
  111. package/dist/cli/index.cjs +3749 -3029
  112. package/dist/cli/index.cjs.map +1 -1
  113. package/dist/cli/index.mjs +3718 -3006
  114. package/dist/cli/index.mjs.map +1 -1
  115. package/dist/hook/turn-end.cjs +1022 -0
  116. package/dist/hook/turn-end.cjs.map +1 -0
  117. package/dist/hook/turn-end.d.cts +2 -0
  118. package/dist/hook/turn-end.d.ts +2 -0
  119. package/dist/hook/turn-end.mjs +998 -0
  120. package/dist/hook/turn-end.mjs.map +1 -0
  121. package/dist/index.cjs +3626 -3577
  122. package/dist/index.cjs.map +1 -1
  123. package/dist/index.d.cts +19 -3
  124. package/dist/index.d.ts +19 -3
  125. package/dist/index.mjs +3544 -3498
  126. package/dist/index.mjs.map +1 -1
  127. package/package.json +2 -2
  128. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +0 -52
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sdd-triage
3
3
  owner: qfai-sdd
4
- purpose: "Select the requirement source, classify each requirement against the story tree, and record the decisions, questions and approvals the later writes depend on."
4
+ purpose: "Select the requirement source, classify each requirement against the story tree, and settle the decisions and questions the later writes depend on."
5
5
  requires: []
6
6
  ---
7
7
 
@@ -14,7 +14,7 @@ changes, and record that decision before anything depends on it.
14
14
 
15
15
  - The applicable `.qfai/assistant/rule/` files.
16
16
  - `.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md`: the operation set,
17
- the approval boundary and the decision-row format.
17
+ the critical decisions and the decision-row format.
18
18
  - `.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md` and
19
19
  `.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md`.
20
20
  - `.qfai/assistant/rule/change-classification.md`, the classification
@@ -35,7 +35,7 @@ no-argument batch, and its gate runs with `--flow BF-NNNN` for that flow.
35
35
  ## Stage 0: source and preflight
36
36
 
37
37
  1. Use the launcher established by
38
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher-mandatory`.
38
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher`.
39
39
  Record its resolved package path and version in the SDD report. Check that
40
40
  the installed Stage 0 instructions support the procedure being used.
41
41
  2. Run `npx qfai sdd preflight` and use its `selectedInputPath`; a selected
@@ -65,48 +65,44 @@ only when the existing tree cannot represent it. Trace impact through BF → US
65
65
  AC → EX and every enforcing contract.
66
66
 
67
67
  Read the complete decision register using the Decision pages rules in the triage
68
- reference before allocating IDs or relying on an in-force decision. Append new
69
- rows only to the root table. Listed pages preserve the same row identity and
70
- Status permissions; an unreadable or incomplete register stops this stage.
71
- No automatic rotation is permitted. A physical relocation requires a separately
72
- adopted execution change request and reviewed raw-byte receipt.
73
-
74
- Record in `<paths.specsDir>/decisions.md` only what the user decided: each
75
- change request the user approved or declined, and each critical decision the
76
- user made. Record unresolved
77
- questions in `<paths.specsDir>/open-questions.md`. Every row has exactly
78
- `ID | Content | Approach | Status`. Append rows only; afterwards change only
79
- Status, except for explicit branch-added decision renumbering or the bounded
80
- published decision prefix recovery in the drift protocol. A change request
81
- Content begins `Change request:` and names the
82
- affected repository-relative paths; its Approach names the operation, the affected BF or US,
83
- its source as `discussion-<id>#REQ-NNNN` when that source exists, and who
84
- approved it, when, and the option chosen. A declined change request is appended at
85
- REJECTED, recording who declined it and when. When a later decision replaces a
86
- row, change that row's Status to `SUPERSEDED (by DEC-NNNN)`, naming the later
87
- row, or to `PARTLY SUPERSEDED (by DEC-NNNN)` when it replaces only part of it.
88
- When a decision answers an open question, change that row's Status to
89
- `DONE (by DEC-NNNN)`; when a decision makes what the row states wrong before the
90
- question is answered, change it to `SUPERSEDED (by DEC-NNNN)` and append a new
91
- row for the question that remains. Either names the decision row.
92
- A decision the agent took
93
- appends no row. Do not write a second decision-record
94
- directory or a retired story file. Listed pages are members of the same register, not a second decision home.
95
-
96
- For a published malformed branch-added decision, follow
97
- `.qfai/assistant/rule/drift-protocol.md#published-decision-prefix-recovery`
98
- before any write. A separate new target-specific approved recovery change
99
- request must bind the original source, base, ancestor, raw cell bytes, digests
100
- and exact prefix. Preserve ID, Content, Status and the entire original suffix.
101
- Inherited rows, unknown provenance and stale data stop recovery. A diagnostic
102
- suggestion does not authorize a rewrite. Record the pre-write checks and the
103
- existing validation result; this step provides no recovery executor.
104
-
105
- Put each approval-required operation to the user before anything depends on
106
- it. A request from the user in the session that names the operation and its
107
- effect is that approval: list the files in the announcement and ask nothing
108
- more. `--auto` asks no questions and never supplies its own approval; stop
109
- before the dependent write and report pending approvals.
68
+ reference before allocating IDs or relying on a decision. Append new rows only
69
+ to the root table, and never move a row between files; an unreadable or
70
+ incomplete register stops this stage.
71
+
72
+ Record in `<paths.specsDir>/decisions.md` only the decisions the user made,
73
+ approvals included, that pass the recording test at the top of the
74
+ `qfai-sdd` decisions template: hard to reverse, surprising to a reader without
75
+ context, and the result of a real trade-off. The stage report states every
76
+ other decision. Record unresolved questions in `<paths.specsDir>/open-questions.md`.
77
+ Every row has exactly `ID | Content | Approach`. A new row's ID is
78
+ `DEC-yyyymmddhhMMss` or `OQ-yyyymmddhhMMss`, the UTC time it is written.
79
+
80
+ - A decisions.md row is appended once, keeps its ID and is never removed or renumbered; only its wording may be restated.
81
+ - An option the user rejects is a row whose Content opens `Declined:`,
82
+ recording who declined it and when. It authorizes nothing.
83
+ - Name each requirement's source as `discussion-<id>#REQ-NNNN` when that
84
+ source exists, in the stage report and in any row the decision writes.
85
+ - A decision that refers to an earlier row is a new row whose Approach opens
86
+ with the earlier ID: `Supersedes DEC-…`, `Narrows DEC-…`, or `Reopens DEC-…`
87
+ for a declined option.
88
+ - When a decision settles an open question, the same change appends the
89
+ decision row, naming the OQ ID, and deletes the question row.
90
+ - To defer a question already written, delete its row and append a new one
91
+ whose Approach names the next decision point and says `Replaces OQ-…`.
92
+
93
+ A decision the agent took appends no row. Do not write a second
94
+ decision-record directory or a retired story file. Listed pages are members of
95
+ the same register, not a second decision home. Write each decision's result
96
+ where it lives as the triage reference's "Where a decision's result lives"
97
+ section says: the current state only, one statement per concept.
98
+
99
+ Put each critical decision to the user before anything depends on it, as the
100
+ triage reference's "Critical decisions and no-question mode" section lists
101
+ them. A request from the user in the session that names the operation and its
102
+ effect is that answer: list the files in the announcement and ask nothing
103
+ more. Make every other story-tree or contract change yourself and list it in
104
+ the stage report. `--auto` asks no questions and never supplies its own
105
+ answer; stop before the dependent write and report pending decisions.
110
106
 
111
107
  ### UI-bearing flows
112
108
 
@@ -125,7 +121,7 @@ validator and the template it checks, a contract and the code, a record and
125
121
  what was built — decide which one owns the truth before any later step writes.
126
122
 
127
123
  1. Take the order the project has recorded, highest first:
128
- - an in-force `decisions.md` row that settles it;
124
+ - a `decisions.md` row that settles it and that no later row supersedes;
129
125
  - the story tree and the contracts, over the code, tests and prose that
130
126
  implement them, as Article IV of `.qfai/assistant/rule/constitution.md`
131
127
  states;
@@ -154,7 +150,10 @@ wired or retired:
154
150
  ## Settled mode
155
151
 
156
152
  A work order step with `mode: settled` applies a decision already recorded and
157
- approved: the one the work order's `settled` field or the request cites.
153
+ approved: the one the work order's `settled` field or the request cites. The
154
+ record is a `decisions.md` row, or the output of the step that branched here,
155
+ such as `branch: { outcome: contract-finding }`, which names the change, who
156
+ approved it and when.
158
157
 
159
158
  - Read that record and the part of the story tree it names. Do not reopen,
160
159
  grill again or widen what it settles.
@@ -163,8 +162,9 @@ approved: the one the work order's `settled` field or the request cites.
163
162
  changed criterion, a behaviour the record never mentions — stops the step.
164
163
  Write nothing, and report `branch: { outcome: outside-record }`, which moves
165
164
  the work to `decide-design`.
166
- - A citation that resolves to no in-force row stops the step: put the missing
167
- record to the operator as a question, and write nothing.
165
+ - A citation that resolves to neither a `decisions.md` row nor that branch output
166
+ stops the step: put the missing record to the operator as a question, and
167
+ write nothing.
168
168
 
169
169
  ## At a decision point
170
170
 
@@ -187,14 +187,16 @@ this step took it or the operator answered it.
187
187
 
188
188
  ## ID allocation
189
189
 
190
- Allocate each new ID from the highest ID of its kind in scope plus one,
191
- including retired IDs named in decisions rows. BF scope is project-wide; US
192
- scope is its BF; AC and EX scope is their US; a contract number's scope is every
193
- contract of every kind; BR scope is its contract, whose number the BR carries
194
- (`BR-0006-0001` belongs to `API-0006`); DEC scope is the complete ordered register; OQ scope is its own table.
195
- Empty scopes begin at `0001`, or `01` for AC and EX tails. Take each new ID from
190
+ Allocate each new BF, US, AC, EX or BR ID from the highest ID of its kind in
191
+ scope plus one, including retired IDs named in decisions rows. BF scope is
192
+ project-wide; US scope is its BF; AC and EX scope is their US; a contract
193
+ number's scope is every contract of every kind; BR scope is its contract, whose
194
+ number the BR carries (`BR-0006-0001` belongs to `API-0006`). Empty scopes begin
195
+ at `0001`, or `01` for AC and EX tails. Take each new ID from
196
196
  `npx qfai sdd next-id <kind> [<parent-ID>] --base <local-ref>` with a fetched
197
197
  base: it prints the number after the highest of the working tree and the base.
198
+ A decisions.md or open-questions.md row takes its timestamp ID instead, and
199
+ reads neither the base nor any pull request.
198
200
 
199
201
  Parallel branches pick the same next ID unless each reads the others first:
200
202
 
@@ -206,17 +208,12 @@ Parallel branches pick the same next ID unless each reads the others first:
206
208
  the IDs it adds from `git diff <base>...<head>`. Take the highest across the
207
209
  base, the working tree and those heads, plus one. Without a forge CLI, read
208
210
  the base alone.
209
- 2. When merging the base into the branch, check each ID the branch adds against
210
- the fetched base. The base's item keeps its ID; the branch renumbers its own
211
- item and every reference to it, then runs the gates again.
212
- - A DEC or OQ row: check before the merge, and renumber a DEC row with
213
- `npx qfai sdd renumber-decision` as the triage reference's ID allocation
214
- section says, or an OQ row and its references by hand. The union merge of `decisions.md` and `open-questions.md`
215
- would duplicate a colliding ID without a conflict.
216
- - Any other ID: check after the merge.
217
- 3. Keep the change-request row last in `decisions.md`, so the rows the branch
218
- added stay in ascending order at the end of the register, where the
219
- merge-time renumbering works from the lowest colliding one upward.
211
+ 2. When merging the base into the branch, check each such ID the branch adds
212
+ against the merged base. The base's item keeps its ID; the branch renumbers
213
+ its own item and every reference to it, then runs the gates again.
214
+ 3. A conflict confined to `decisions.md`, its pages or `open-questions.md` is
215
+ resolved by `git merge origin/<base>` run locally: the union merge keeps
216
+ both sides' rows. Push the merge. Renumber, edit or move no register row.
220
217
 
221
218
  ## Pre-draft grilling
222
219
 
@@ -227,16 +224,10 @@ decision it holds to the user, and list each decision it adopted in the final
227
224
  report. Each later design-writing step runs its own checkpoint the
228
225
  same way.
229
226
 
230
- ## A change to the story tree
231
-
232
- A story-tree or contract file changes only on the user's approval, as
233
- `.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md#a-change-to-the-story-tree`
234
- sets out. Every later step of the stage writes under that rule.
235
-
236
227
  ## Gate
237
228
 
238
- The affected-flow scope and approval state are recorded before any drafting
239
- step starts. Every requirement has a target, an approved or
240
- approval-free operation and a recorded impact path, as
229
+ The affected-flow scope and the answers to its critical decisions are recorded
230
+ before any drafting step starts. Every requirement has a target, an operation
231
+ the user decided or the agent took, and a recorded impact path, as
241
232
  `.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md#completion-of-triage`
242
233
  states.
@@ -32,14 +32,23 @@ operation. This step runs it and reports what happened.
32
32
  a new pull request starts when the user asked to see them pass. Poll no
33
33
  faster than the checks change. A failing check that a rerun does not clear
34
34
  stops the operation as a tracked change it needs, as below.
35
- 4. Run the operation, and observe its result: the merge commit, the deploy
35
+ 4. Never enable a host's auto-merge. Before a merge, merge the base branch into
36
+ the pull request's branch locally (`git merge origin/<base>`), push, and
37
+ wait for the checks that push starts; only then merge. A conflict the host
38
+ shows only in `decisions.md`, its pages or `open-questions.md` is resolved
39
+ the same way: the union merge completes it. Edit no register row except to
40
+ delete again a question row the union merge kept although one side deleted
41
+ it, committing that deletion before the push. Renumber no ID, and ask for no
42
+ new review of that merge. A conflict in any other file
43
+ stops the operation as a tracked change it needs.
44
+ 5. Run the operation, and observe its result: the merge commit, the deploy
36
45
  status, the closed item.
37
- 5. After a merge, check the merged result: the target branch holds the merge
46
+ 6. After a merge, check the merged result: the target branch holds the merge
38
47
  commit, and, when the user asked to see them pass or the project's policy
39
48
  requires it, the checks the project runs on that branch pass. A failure
40
49
  there is reported as `needs-change`, naming the merge commit, since the
41
50
  merge itself stands.
42
- 6. Report the result as observed, including a failure.
51
+ 7. Report the result as observed, including a failure.
43
52
 
44
53
  Before creating an issue, search the tracker for a matching open issue with the
45
54
  forge CLI's issue search and key terms from the title. When one request files
@@ -52,8 +61,8 @@ rate limit, report that and leave creating the issue to the user, unless the
52
61
  instruction allows creating it without the search. The report names the issue
53
62
  matched or created.
54
63
 
55
- An operation that needs a tracked file to change, such as a conflict to resolve
56
- or a failing check to fix, stops here: report the outcome `needs-change` with an
64
+ An operation that needs a tracked file to change, such as a conflict outside the
65
+ registers to resolve or a failing check to fix, stops here: report the outcome `needs-change` with an
57
66
  extraction of the request as the change it needs, naming the artifacts that
58
67
  change, so the decision rules route it again. Change nothing to make the
59
68
  operation pass. List each follow-up in the final report, since no close step
@@ -61,9 +70,10 @@ follows.
61
70
 
62
71
  For a request to take one base change into several branches, first check each
63
72
  branch with `git merge-tree --write-tree <branch> <base>`, which writes
64
- nothing. A branch that merges cleanly is a branch update the user asked for:
65
- update it here as an operation, merged and pushed only as the instruction
66
- names. A branch with conflicts is not an operation: report `needs-change` with
73
+ nothing. A branch that merges cleanly, or whose only conflicts lie in
74
+ `decisions.md`, its pages or `open-questions.md`, is a branch update the user
75
+ asked for: update it here as an operation, merged and pushed only as the
76
+ instruction names. A branch with any other conflict is not an operation: report `needs-change` with
67
77
  one extraction for each such branch,
68
78
  `{ intent: order, qualifiers: [meaning-preserving] }` naming the artifacts of
69
79
  its conflicting paths, so the decision rules plan `resolve-conflicts` for
@@ -86,11 +96,14 @@ request, or the version edit alone.
86
96
  2. Follow the project's release documents with the version the user named,
87
97
  never another. Start the preparation they name, such as a workflow that
88
98
  sets the version and opens the release pull request. An instruction that
89
- covers only the version edit stops once that edit is made. A release edit
90
- the documents make by hand is a tracked change: report `needs-change` with
91
- an extraction of it as an `order` naming the `release` artifact, and carry
92
- the quoted instruction and the named version into that extraction's
93
- request, so the next plan makes the edit under the same instruction.
99
+ covers only the version edit stops once that edit is made. A release-notes
100
+ or changelog edit the documents make by hand is a tracked change: report
101
+ `needs-change` with an extraction of it as an `order` naming the `release`
102
+ artifact and the `release-notes` signal, and carry the quoted instruction
103
+ and the named version into that extraction's request, so the next plan
104
+ makes the edit under the same instruction. Any other hand-made release
105
+ edit, such as a version bump the preparation does not make, has no route:
106
+ report it as a blocker that names the edit.
94
107
  3. Review the release pull request as the project's review rules say, and
95
108
  merge it only when they allow, waiting for its checks as above. Where the
96
109
  release documents make the merge the instruction for the tag, such as a
@@ -110,12 +123,13 @@ request, or the version edit alone.
110
123
 
111
124
  ## What it writes
112
125
 
113
- - No file git tracks.
126
+ - No file git tracks, apart from the base changes a merge of the base brings
127
+ in.
114
128
  - The operation, its result and any `needs-change` outcome, in the report.
115
129
 
116
130
  ## Gate
117
131
 
118
132
  The stage worker confirms the operation was one the user named, its result is
119
- recorded as observed, and no tracked file changed. For a release, it also
133
+ recorded as observed, and no tracked file changed beyond a merge of the base. For a release, it also
120
134
  confirms the delegation is quoted with its source, and that no tag, publication
121
135
  or publication approval came from the agent.
@@ -21,8 +21,7 @@ The last step of a change route. It records the run's work as a local commit.
21
21
 
22
22
  - One commit on the current branch holding the run's changes.
23
23
  - In the final report: the commit, and the files it holds. In the
24
- `resolve-conflicts` route, also each renumber commit the run made, including
25
- one left after `git reset --merge ORIG_HEAD`.
24
+ `resolve-conflicts` route, also each renumber the merge holds, as old → new.
26
25
 
27
26
  A local commit records work; it does not establish formal verification. Push,
28
27
  pull request creation and merge each need a user instruction or project policy
@@ -88,8 +87,7 @@ When the delegated check reports, `verify-repo-gate`'s `## After CI` updates the
88
87
 
89
88
  - The commit exists and holds exactly the tracked deliverables the run wrote,
90
89
  or, in the `resolve-conflicts` route, the merge the run concluded. The final
91
- report names each renumber commit the run made, including one left after
92
- `git reset --merge ORIG_HEAD`.
90
+ report names each renumber the merge holds.
93
91
  - Pending CI is named in the report with the target, current head, run ID or URL
94
92
  when available, check, observed outcome and counts, blocker and resume condition.
95
93
  If no run exists, say so; invent no run ID or result.
@@ -96,7 +96,7 @@ technical obstacle stops the work under Article IX of
96
96
  Before any gate runs, check that each gate in scope has an entry in
97
97
  `.qfai/spec/03_contract/tech.md#standard-commands-copy-paste`, the section
98
98
  `common-gate-run` reads. Discover and record a missing one as
99
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#standard-commands-mandatory`
99
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#standard-commands`
100
100
  says. A gate still without an entry is UNRUN, and no PASS is claimed over it.
101
101
 
102
102
  ## For the rest of the run
@@ -26,6 +26,12 @@ The body excludes YAML frontmatter; a character is one Unicode code point.
26
26
  A file near a limit is a signal to move a section out, not to pack more onto
27
27
  each line.
28
28
 
29
+ `qfai validate --profile verify` warns on a `SKILL.md` over 500 lines, on a
30
+ skill whose `description` and `when_to_use` exceed 1,536 characters, which a
31
+ host truncates, and on an `AGENTS.md` over 32 KiB, which a host stops reading.
32
+ It also warns on emphasis in capitals, such as `MUST` or `NEVER`, outside code
33
+ and quotations.
34
+
29
35
  ## 2. Budget what a task loads
30
36
 
31
37
  Splitting helps only when the pieces are loaded on demand. A piece that is
@@ -85,7 +91,8 @@ them, and nothing says which.
85
91
  ## Held by
86
92
 
87
93
  Review, and any check a project adds for itself. `npx qfai doctor` reports a
88
- Markdown assistant asset over the line limit in § 1.
94
+ Markdown assistant asset over the line limit in § 1, and a `SKILL.md` body over
95
+ the character limit.
89
96
 
90
97
  ## Related
91
98
 
@@ -0,0 +1,69 @@
1
+ # Delegation Steering
2
+
3
+ How an agent steers a task it handed to another agent while the user is in the
4
+ session: look at the first actions, stop a wrong course early, and replace a
5
+ brief that two corrections did not fix.
6
+
7
+ A delegated task that starts off course rarely finds its way back alone, and
8
+ each correction stacked on a wrong start leaves that start in the agent's
9
+ context. A look at the first actions costs little, and a rewritten brief costs
10
+ less than a third correction.
11
+
12
+ ## Scope
13
+
14
+ | Target | Applies |
15
+ | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
16
+ | A task delegated to another agent in a session where the user is present | Always |
17
+ | A run under `--auto`, or any run where nobody is present | Never: `.qfai/assistant/rule/shared-skill-operating-baseline.md`, "Unattended Runs: Ending a Turn", governs |
18
+ | Whether to delegate, and what a brief holds | Outside this rule: `.qfai/assistant/rule/shared-skill-delegation-baseline.md` |
19
+
20
+ ## 1. Check the first actions
21
+
22
+ Where the host shows a delegated agent's progress, read its first actions as
23
+ they appear: the files it opens, the commands it runs, its first edit. They show
24
+ whether it read the brief as meant: the right paths, the right step, nothing
25
+ outside what it was given. Where the host shows nothing before the result, the
26
+ result is the first check.
27
+
28
+ ## 2. Interrupt early
29
+
30
+ When the first actions go off course, such as a path outside the task, a step
31
+ the brief did not name or a goal read wrongly, interrupt then through the
32
+ host's message or stop mechanism. Do not wait for the result. Name what is off
33
+ and what the brief meant.
34
+
35
+ For an independent judgement, such as a review or a griller, off course means
36
+ outside its brief or its remit. A verdict the session disagrees with is not off
37
+ course, and nobody steers it. An interrupt to a judgement restates only the
38
+ brief's scope and remit, never the author's reasoning or view.
39
+
40
+ ## 3. Restart after two corrections that do not land
41
+
42
+ A correction lands when the next actions follow it. After two corrections on
43
+ one task that do not land, send no third. Stop the task, rewrite the brief and
44
+ start again. The rewritten brief carries what was learned: what the first
45
+ attempt misread, the constraint it kept missing, the facts it had to search
46
+ for. It leaves out the transcript of the failed attempt.
47
+
48
+ A rewritten judgement brief stays black-box, as the delegation baseline says:
49
+ what was learned may sharpen the scope and the remit, never add the author's
50
+ reasoning. A restarted judgement is the same one review: its work order takes
51
+ the next replacement ordinal.
52
+
53
+ When the rewritten brief goes off course the same way, start no third attempt:
54
+ put it to the user with the next actions, as `user-questions.md` sets out.
55
+
56
+ ## Related
57
+
58
+ - What a brief holds, and when to delegate at all:
59
+ `.qfai/assistant/rule/shared-skill-delegation-baseline.md`
60
+ - The unit work order template:
61
+ `.qfai/assistant/rule/references/worker-edit-boundary.md`
62
+ - A run with nobody present: `.qfai/assistant/rule/shared-skill-operating-baseline.md`
63
+ - The form of a question to the user: `user-questions.md`
64
+
65
+ ## Scope of this file
66
+
67
+ This is the master copy for every AI coding agent in this repository.
68
+ Tool-specific instruction files point here instead of restating it. Edit this
69
+ file when the rule changes.