qfai 2.2.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/README.md +37 -20
  2. package/assets/init/.claude/settings.json +35 -1
  3. package/assets/init/.codex/hooks.json +24 -0
  4. package/assets/init/.github/instructions/code-review.instructions.md +1 -1
  5. package/assets/init/.qfai/assistant/agent/architecture-reviewer.md +4 -4
  6. package/assets/init/.qfai/assistant/agent/fullstack-engineer.md +129 -0
  7. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +76 -4
  8. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +9 -5
  9. package/assets/init/.qfai/assistant/agent/requirements-reviewer.md +13 -3
  10. package/assets/init/.qfai/assistant/rule/agent-selection.md +22 -42
  11. package/assets/init/.qfai/assistant/rule/communication.md +1 -1
  12. package/assets/init/.qfai/assistant/rule/constitution.md +77 -242
  13. package/assets/init/.qfai/assistant/rule/drift-protocol.md +31 -165
  14. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +4 -3
  15. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +4 -4
  16. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +2 -2
  17. package/assets/init/.qfai/assistant/rule/references/placeholder-scan.md +2 -3
  18. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +3 -3
  19. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +15 -6
  20. package/assets/init/.qfai/assistant/rule/research-first-protocol.md +7 -6
  21. package/assets/init/.qfai/assistant/rule/review-convergence.md +7 -7
  22. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +82 -66
  23. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +19 -21
  24. package/assets/init/.qfai/assistant/rule/test-layers.md +1 -1
  25. package/assets/init/.qfai/assistant/rule/thinking.md +2 -2
  26. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +5 -5
  27. package/assets/init/.qfai/assistant/rule/ui-procurement.md +1 -1
  28. package/assets/init/.qfai/assistant/rule/workflow.md +16 -16
  29. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +27 -60
  30. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +3 -17
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/03_Story-Workshop.md +1 -2
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -3
  33. package/assets/init/.qfai/assistant/skill/qfai-grill/SKILL.md +9 -10
  34. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +45 -58
  35. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/confirmation-sheet.md +71 -0
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +35 -18
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +3 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +2 -18
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +53 -21
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +35 -2
  41. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +2 -5
  42. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +2 -15
  43. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +10 -14
  44. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +0 -7
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +6 -15
  46. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +76 -5
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +2 -1
  48. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +60 -5
  49. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +15 -6
  50. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +42 -11
  51. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +8 -10
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +12 -7
  53. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +4 -4
  54. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +1 -1
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +10 -25
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +27 -29
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +13 -3
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +36 -3
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +8 -9
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +6 -6
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +7 -7
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +5 -5
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +7 -7
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +3 -3
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +115 -199
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +25 -25
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +23 -113
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +2 -2
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +8 -7
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions/page-NNNN.md +2 -2
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +59 -31
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/open-questions.md +15 -11
  74. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +1 -14
  75. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +2 -13
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +1 -1
  77. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +19 -21
  78. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +9 -11
  79. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +2 -3
  80. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +3 -4
  81. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -2
  82. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +8 -7
  83. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +7 -9
  84. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +0 -2
  85. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +43 -2
  86. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +0 -2
  87. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +0 -2
  88. package/assets/init/.qfai/assistant/step/implement-acceptance/STEP.md +1 -5
  89. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +0 -5
  90. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +0 -4
  91. package/assets/init/.qfai/assistant/step/implement-bisect/STEP.md +0 -5
  92. package/assets/init/.qfai/assistant/step/implement-credentials/STEP.md +0 -4
  93. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -18
  94. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +0 -6
  95. package/assets/init/.qfai/assistant/step/implement-minimize/STEP.md +0 -5
  96. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +0 -6
  97. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +1 -3
  98. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +0 -4
  99. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +0 -4
  100. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +2 -6
  101. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +0 -6
  102. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +0 -4
  103. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +5 -7
  104. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +0 -4
  105. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +0 -5
  106. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +0 -5
  107. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +10 -18
  108. package/assets/init/.qfai/assistant/step/implement-test-fix/STEP.md +0 -5
  109. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +0 -3
  110. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -21
  111. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -6
  112. package/assets/init/.qfai/assistant/step/prototyping-handoff/STEP.md +0 -2
  113. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +106 -31
  114. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +0 -2
  115. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +18 -19
  116. package/assets/init/.qfai/assistant/step/sdd-cycle/STEP.md +8 -11
  117. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +25 -6
  118. package/assets/init/.qfai/assistant/step/sdd-gate/STEP.md +0 -1
  119. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +6 -8
  120. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +71 -82
  121. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +0 -2
  122. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +0 -2
  123. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +0 -2
  124. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +0 -2
  125. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +0 -2
  126. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +0 -2
  127. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +0 -2
  128. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +29 -17
  129. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +0 -2
  130. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +0 -2
  131. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +0 -2
  132. package/assets/init/.qfai/assistant/step/verify-advisory/STEP.md +0 -2
  133. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +0 -2
  134. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +2 -6
  135. package/assets/init/.qfai/assistant/step/verify-context/STEP.md +7 -26
  136. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +0 -2
  137. package/assets/init/.qfai/assistant/step/verify-manual/STEP.md +0 -2
  138. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +0 -2
  139. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +0 -2
  140. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +0 -2
  141. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +0 -2
  142. package/assets/init/root/.agents/rules/ai-readable-markdown.md +8 -1
  143. package/assets/init/root/.agents/rules/delegation-steering.md +69 -0
  144. package/assets/init/root/.agents/rules/grilling.md +81 -52
  145. package/assets/init/root/.agents/rules/minimal-implementation.md +5 -5
  146. package/assets/init/root/.agents/rules/reply-forms.md +191 -0
  147. package/assets/init/root/.agents/rules/session-feedback.md +104 -27
  148. package/assets/init/root/.agents/rules/user-questions.md +6 -1
  149. package/assets/init/root/.gitattributes +5 -6
  150. package/assets/init/root/AGENTS.md +4 -2
  151. package/assets/mdschema/story/03_contract/tech.mdschema.yml +1 -1
  152. package/assets/mdschema/story/decisions/page-NNNN.mdschema.yml +3 -3
  153. package/assets/mdschema/story/decisions.mdschema.yml +4 -4
  154. package/assets/mdschema/story/open-questions.mdschema.yml +3 -3
  155. package/assets/schemas/workflow/extraction.schema.json +0 -2
  156. package/dist/cli/index.cjs +3826 -3929
  157. package/dist/cli/index.cjs.map +1 -1
  158. package/dist/cli/index.mjs +3793 -3904
  159. package/dist/cli/index.mjs.map +1 -1
  160. package/dist/graph/cli.cjs +14 -2
  161. package/dist/graph/cli.cjs.map +1 -1
  162. package/dist/graph/cli.d.cts +1 -1
  163. package/dist/graph/cli.d.ts +1 -1
  164. package/dist/graph/cli.mjs +14 -2
  165. package/dist/graph/cli.mjs.map +1 -1
  166. package/dist/graph/hook.cjs.map +1 -1
  167. package/dist/graph/hook.mjs.map +1 -1
  168. package/dist/hook/turn-end.cjs +1022 -0
  169. package/dist/hook/turn-end.cjs.map +1 -0
  170. package/dist/hook/turn-end.d.cts +2 -0
  171. package/dist/hook/turn-end.d.ts +2 -0
  172. package/dist/hook/turn-end.mjs +998 -0
  173. package/dist/hook/turn-end.mjs.map +1 -0
  174. package/dist/index.cjs +3635 -4578
  175. package/dist/index.cjs.map +1 -1
  176. package/dist/index.d.cts +20 -21
  177. package/dist/index.d.ts +20 -21
  178. package/dist/index.mjs +3696 -4641
  179. package/dist/index.mjs.map +1 -1
  180. package/dist/process-qqX2Owgq.d.cts +18 -0
  181. package/dist/process-qqX2Owgq.d.ts +18 -0
  182. package/package.json +2 -2
  183. package/assets/defaults/agent-routing/_contract.yml +0 -77
  184. package/assets/defaults/agent-routing/common.yml +0 -14
  185. package/assets/defaults/agent-routing/qfai-discussion.yml +0 -57
  186. package/assets/defaults/agent-routing/qfai-implement.yml +0 -236
  187. package/assets/defaults/agent-routing/qfai-maintain.yml +0 -12
  188. package/assets/defaults/agent-routing/qfai-prototyping.yml +0 -48
  189. package/assets/defaults/agent-routing/qfai-sdd.yml +0 -56
  190. package/assets/defaults/agent-routing/qfai-triage.yml +0 -108
  191. package/assets/defaults/agent-routing/qfai-verify.yml +0 -92
  192. package/assets/defaults/agent-routing/skills.yml +0 -59
  193. package/assets/defaults/review-profiles.yml +0 -25
  194. package/assets/init/.qfai/assistant/agent/acceptance-test-engineer.md +0 -81
  195. package/assets/init/.qfai/assistant/agent/backend-engineer.md +0 -90
  196. package/assets/init/.qfai/assistant/agent/completion-reviewer.md +0 -88
  197. package/assets/init/.qfai/assistant/agent/delivery-planner.md +0 -85
  198. package/assets/init/.qfai/assistant/agent/devops-ci-engineer.md +0 -78
  199. package/assets/init/.qfai/assistant/agent/discovery-analyst.md +0 -81
  200. package/assets/init/.qfai/assistant/agent/doc-steward.md +0 -78
  201. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +0 -94
  202. package/assets/init/.qfai/assistant/agent/orchestrator.md +0 -92
  203. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +0 -101
  204. package/assets/init/.qfai/assistant/agent/qa-gatekeeper.md +0 -153
  205. package/assets/init/.qfai/assistant/agent/qa-strategist.md +0 -82
  206. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +0 -96
  207. package/assets/init/.qfai/assistant/agent/solution-architect.md +0 -89
  208. package/assets/init/.qfai/assistant/agent/test-design-analyst.md +0 -132
  209. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +0 -52
  210. package/dist/process-C21nTvkT.d.cts +0 -12
  211. package/dist/process-C21nTvkT.d.ts +0 -12
@@ -4,159 +4,33 @@ This rule governs changes discovered after a specification or contract has been
4
4
 
5
5
  ## Decision-register pages
6
6
 
7
- Listed decision pages and their root index are protected project artifacts.
8
- Read pages in list order, followed by the root table, before interpreting a
9
- request. A page preserves the same row identity and Status permissions as the
10
- root. New rows are appended only to the root table. Missing, unsafe or unreadable
11
- members stop permission decisions; a partial history grants no authority.
12
-
13
- A historical DONE row is not permission to relocate the register again.
14
- Physical relocation requires a separately adopted execution change request and
15
- a reviewed raw-byte receipt for the exact source and target. Preserve every row
16
- occurrence, cell, Status, order and line ending, plus the current root tail.
17
- Relocation does not permit duplicate cleanup, Status repair or normalization of
18
- inherited cells. Relocation changes physical home only; it neither adds nor removes
19
- a logical row. A migration projection grants no write authority. Never rotate
20
- automatically. Each physical file still meets the inclusive 500-line limit;
21
- formatting exclusions preserve bytes and never waive schema or semantic checks.
7
+ Read listed decision pages in list order, followed by the root table, before
8
+ interpreting a request. A page row follows the same rules as a root row. New
9
+ rows are appended only to the root table, which has no line limit, and no row
10
+ moves between files. A missing, unsafe or unreadable member stops the reading
11
+ of the register; a partial register settles nothing.
22
12
 
23
13
  ## Core rule
24
14
 
25
15
  A downstream skill does not edit an approved specification, policy, contract, or QFAI-owned rule on its own authority. It records the discrepancy and returns the affected artifact to its owner. A discussion pack is discovery material; the story tree and contracts are the current specification.
26
16
 
27
- Protected project artifacts include the policy and business-flow trees under paths.specsDir, decisions.md,
17
+ Upstream artifacts include the policy and business-flow trees under paths.specsDir, decisions.md,
28
18
  open-questions.md, and every file under paths.contractsDir. Production code and tests that implement an approved
29
- obligation may change in a later task, but the change must preserve or deliberately reapprove that obligation.
19
+ obligation may change in a later task, but the change must preserve that obligation or change it through its owner.
30
20
  QFAI-owned files under .qfai/assistant/rule/ are updated through the package, then synchronized by init.
31
21
 
32
- A new change-request row in decisions.md is permitted without an earlier change request.
33
- Existing rows are append-only records: a prior row may change its Status cell,
34
- while its ID, Content, and Approach stay fixed. The sole ID-change exception is
35
- explicit local renumbering of a unique branch-added decision absent from the
36
- unique common ancestor of HEAD and a required local base. That operation changes
37
- only its ID and provably branch-added exact references. Inherited row cells and
38
- references stay fixed. A changed obligation needs a new row, even when an older
39
- row discusses the same topic.
40
-
41
- The sole Approach-change exception is the published decision prefix recovery
42
- below. It preserves the target's ID, Content, Status and complete original
43
- Approach suffix. It excludes inherited rows and open-question rows.
44
-
45
- The sole row-removal exception is the merge-added identical decision copy
46
- recovery below. It removes only proven raw-identical surplus copies of a
47
- decision and keeps one original. It excludes open-question rows.
22
+ A decisions.md row keeps its ID and is never removed; its wording may be restated,
23
+ but a changed obligation needs a new row, even when an older row discusses the same topic. An open-questions.md
24
+ row is never edited; it is deleted when a decision settles it, or replaced by a
25
+ new row when it is deferred.
48
26
 
49
27
  ## Allowed exceptions (minimal whitelist)
50
28
 
51
29
  - A project may add a local overlay beside a shipped rule. The overlay adds project guidance; it does not repeal a shipped rule.
52
- - An owner skill may change its own upstream artifact after the required approval has been recorded. It then checks dependent tests before completion.
30
+ - An owner skill may change its own upstream artifact once any critical decision the change needs has been answered. It then checks dependent tests before completion.
53
31
 
54
32
  These exceptions do not authorize a downstream stage to rewrite an upstream row or a vendored rule.
55
33
 
56
- A change that touches no protected file needs no change request. A bugfix whose
57
- diff changes no file under `01_policy/`, `02_business-flow/` or
58
- paths.contractsDir appends no `Change request:` row. A row naming a story file
59
- the bugfix did not touch would state an upstream change that did not happen.
60
-
61
- ## Published decision prefix recovery
62
-
63
- The SDD owner may prepend only an approved Evidence/Grounds prefix to a
64
- published malformed decision added by the branch. Approval of this protocol
65
- does not authorize any target. First obtain a separate new in-force recovery
66
- change request naming the target and its repository-relative file.
67
-
68
- 1. Fix the explicit base commit and its unique common ancestor with current
69
- HEAD. The target ID must be absent from both. The documented published
70
- source commit must be an ancestor of current HEAD and expose the unique
71
- original row. Inherited records and open-question rows are excluded.
72
- 2. Read the original raw cell bytes. The row must be single-line valid UTF-8,
73
- with exactly one ASCII padding space at each Approach delimiter and no
74
- additional boundary whitespace. Hash the stored Approach bytes with
75
- SHA-256, excluding only the delimiter pipes and those two padding spaces.
76
- Do not decode escapes, trim text or normalize it. Ambiguous boundaries,
77
- additional padding or invalid UTF-8 stop recovery.
78
- 3. Confirm the original Residual risk and Rollback items already satisfy the
79
- required ordered, nonempty form. The new Approach must be exactly
80
- `- Evidence: <actual file references> - Grounds: `, including its trailing
81
- space, followed by the complete original Approach as a byte-identical
82
- suffix. Preserve the original wording, order, facts, authority and scope.
83
- The prefixed row must satisfy the existing form checks.
84
- 4. Record the target ID, published source commit, fixed base and common
85
- ancestor, old and new Approach digests, exact prefix, actual file evidence,
86
- approval authority, recovery reason, residual risk and rollback in the new
87
- request. The old digest must match the published source Approach; the new
88
- digest must match the exact prefix plus that source value. Record actual
89
- authority; do not invent a user answer or approval.
90
- 5. Immediately before writing, recheck the unique current target, its
91
- byte-identical ID, Content and Status, and its recorded old Approach digest.
92
- Unknown or unavailable provenance, inherited or duplicate targets, stale
93
- data or a change beyond the approved prefix stops recovery before writing.
94
- Apply only that prefix. Keep every other row byte-identical and run the existing
95
- validation without an exemption.
96
- 6. Rollback removes only the recorded prefix when the current new Approach
97
- digest still matches. Otherwise preserve the current row and stop. Removal
98
- restores the original Approach and its validation failure. Do not reset,
99
- amend or force push.
100
-
101
- Status changes, supersession and a diagnostic's rewrite suggestion supply no
102
- recovery authority and clear no form error. Inherited malformed records need a
103
- separate owning change request; this operation cannot repair them. These are
104
- owner instructions, not an automatic recovery command or a concurrency guarantee.
105
-
106
- ## Merge-added identical decision copy recovery
107
-
108
- The SDD owner may manually remove only raw-identical surplus copies of a
109
- decision row that an exact two-parent bad merge introduced. Approval of this
110
- protocol authorizes no target. First append a separate new in-force change
111
- request that names the exact `decisions.md` path and the decision ID.
112
-
113
- 1. Name the bad merge. It must be an available ancestor of current HEAD with
114
- exactly two parents, and it must expose the introduced surplus. Name both
115
- parents and their unique common ancestor. Each of the three must hold exactly
116
- one byte-identical original of the row. Fix the explicit base and its unique
117
- comparison ancestor; both must hold one original and no surplus selected for
118
- removal. A missing or non-ancestor merge, a third parent, a non-unique
119
- ancestor or a source that does not hold exactly one original stops recovery.
120
- 2. Read the complete stored UTF-8 raw row of every selected current occurrence:
121
- all four cells, delimiters, padding and line ending. Hash each with SHA-256,
122
- including the line ending. Do not trim, decode escapes or normalize endings.
123
- Nonidentical cells, padding or endings are a different collision and are
124
- outside this recovery.
125
- 3. Record in the request the path, the ID, the bad merge, both parents, the
126
- ancestor, the base and its comparison ancestor, the location of each
127
- occurrence, the raw hash, the retain/remove mapping, the actual authority,
128
- the residual risk and the rollback. Record actual authority; invent no
129
- answer. The request fixes input lineage only.
130
- 4. After the request is appended, have the evidence for the write reviewed
131
- independently and adopted. It fixes the actual write HEAD, base and
132
- comparison ancestor, the complete preimage and replacement bytes and hashes,
133
- the mapping and the current authority. The request does not name its own
134
- commit, so the actual write revision stays distinct from the lineage above.
135
- This adds no receipt grammar and no validator input.
136
- 5. Immediately before writing, recheck the refs, their availability, the path,
137
- the authority, the occurrence count, the mapping and the bytes. Stale,
138
- missing, ambiguous, conflicting or changed proof stops before writing.
139
- Changed observations need refreshed reviewed evidence. A changed target or
140
- operation needs a new request; do not rewrite the cells of an earlier one.
141
- 6. Remove only the mapped surplus occurrences. Keep one complete original, every
142
- distinct decision and reference, every unrelated current byte and the Git
143
- history. Do not change a Status, rewrite a reference or reorder other
144
- history. Open-question rows, nonidentical collisions, ordinary duplicate
145
- cleanup and surplus that the base or its comparison ancestor already holds
146
- are excluded.
147
- 7. Rollback restores the recorded complete preimage only while the current file
148
- is byte-identical to its owned replacement. Otherwise keep the current bytes,
149
- stop and name the unrestored path. Restoring brings back the duplicate
150
- failure. Do not reset, amend or force push.
151
-
152
- The existing duplicate check, positional drift, consumed-DONE authorization and
153
- valid Status-only rules keep applying without an exemption. Other drift that
154
- the file already has stays diagnosed; it is not a prerequisite for this
155
- correction. An actual required stage gate still stops dependent work. Correcting
156
- the copies is not a whole-target PASS, and the request stays at WIP while a named
157
- action or required check is unfinished. These are owner instructions, not a
158
- command, an executor or a concurrency, atomicity or power-loss guarantee.
159
-
160
34
  ## Drift classes
161
35
 
162
36
  Intent drift means an approved obligation should change. Record the current obligation, the proposed behavior, realistic
@@ -164,41 +38,35 @@ options, their costs, and the recommendation. Defect drift means an artifact con
164
38
  declared behavior. Record a reproduction: the command and output, or the two conflicting artifact excerpts. A defect
165
39
  with one sound repair needs one proposed repair, without invented alternatives.
166
40
 
167
- Both classes use the same approval and owner-rerun path.
41
+ Both classes use the same decision and owner-rerun path.
168
42
 
169
43
  ## When drift is detected
170
44
 
171
45
  1. Stop work on the affected obligation and its dependents. Other flows continue. Name the affected BF, US, AC, EX, BR, and contract references where they exist, plus the code or tests that consume the disputed artifact. Do not claim a repository-wide stop without a repository-wide dependency.
172
- 2. Prepare the change request for the SDD owner: the affected repository-relative paths, the drift class,
46
+ 2. Prepare the proposed change for the SDD owner: the affected repository-relative paths, the drift class,
173
47
  the evidence or reproduction, the proposed change, the impacted items, and the owner rerun.
174
- 3. Obtain the user's explicit answer. Either answer makes the SDD owner append one DEC-NNNN row to decisions.md under
175
- paths.specsDir. Its four columns are ID, Content, Approach, and Status. Content starts with Change request: followed
176
- by the affected repository-relative paths, separated by commas. Only a path authorizes an edit; an ID written there
177
- authorizes nothing. Approach records the proposed change.
178
- - Approved: Approach also records who approved it, when, and the option chosen, and the row starts at WIP.
179
- - Declined: Approach also records who declined it and when, and the row is appended at REJECTED. It authorizes no
180
- edit, and the artifact stays as it is.
48
+ 3. Decide the change. A change that contradicts a specification, a contract or a recorded decision, that cannot
49
+ be taken back, or that rests on product intent nothing written states is a critical decision: put it to the
50
+ user and wait for the answer. The owner takes any other change itself and lists it with its reason in its
51
+ report. A decision becomes a decisions.md row only when it is hard to reverse, would surprise a reader
52
+ without context, and was the result of a real trade-off; the row takes the short form of the `qfai-sdd`
53
+ decisions template. Otherwise the stage report states it. An option the user rejects is a row whose
54
+ Content opens `Declined:`, whatever the recording test says, so it stays excluded on reruns.
181
55
 
182
56
  When the user cannot be asked, write no row to either table: report the proposed change as the decision still
183
- needed and keep the affected items stopped. A WIP Change request: row is the in-force authorization that the drift gate reads.
184
- TODO is not authorization. A DONE row authorizes only on the branch that appended it or moved it from WIP. A row
185
- the base already holds at DONE records a change already applied and authorizes nothing at any Status, so setting it back to WIP
186
- reopens nothing and a later edit to the same path needs a row of its own.
57
+ needed and keep the affected items stopped.
187
58
 
188
- 4. Rerun the owner skill against the affected artifact. The owner names the approved decision row, the input revision, and whether it is confirming existing content or changing it.
59
+ 4. Rerun the owner skill against the affected artifact. The owner names the decision, the input revision, and whether it is confirming existing content or changing it.
189
60
  A contract with a contract ID, such as `API-0002`, is selected by its full ID; a contract without one is selected by its repository-relative path.
190
61
  The owner updates the specification and its tests together, then validates the relevant flow.
191
62
  5. Recheck every dependent BF, AC, and EX test obligation and every affected contract reference. Rewrite tests where their former expectation is invalid. Report any uncovered obligation. No execution ledger, TC row, or status reset substitutes for this check.
192
- 6. Complete the decision row by changing Status from WIP to DONE only after the owner artifact and dependent checks are complete.
193
- A row has one Status, so DONE claims every action its Approach lists. While one of them is deferred, keep the row at WIP.
194
- Cite the DEC ID in the stage report.
195
- A second open request on the same artifact waits for the first outcome and is restated if its premise changed.
63
+ Cite the DEC ID, when a row was written, in the stage report. A second open change on the same artifact waits for the first outcome and is restated if its premise changed.
196
64
 
197
- The decision table has no separate Applied at field and no standalone CR file. Approval alone does not certify a change as applied.
65
+ No step removes or renumbers a decision row afterwards; its wording may be restated. The decision table has no Status or Applied at field, and no standalone change file exists. A decision alone does not certify a change as applied.
198
66
 
199
- ### Multiple open change requests
67
+ ### Multiple open changes
200
68
 
201
- Open requests have independent affected sets. Their union is the set of work paused. A later request against the same artifact names the earlier DEC ID and the premise it assumes. Report outstanding requests and their age so unresolved decisions remain visible.
69
+ Open changes have independent affected sets. Their union is the set of work paused. A later change against the same artifact names the earlier decision and the premise it assumes. Report outstanding changes and their age so unresolved decisions remain visible.
202
70
 
203
71
  ## Reviewer-originated obligations
204
72
 
@@ -228,7 +96,7 @@ A finding that changes an approved obligation follows When drift is detected. An
228
96
  ### The record-defect queue
229
97
 
230
98
  A stage may classify a finding as a record defect only when its completion contract names a queue and requires it to be
231
- drained. The reviewer records the incorrect statement and the artifact that proves what happened. The orchestrator
99
+ drained. The reviewer records the incorrect statement and the artifact that proves what happened. The session agent
232
100
  places it in the queue the stage names. Repair the record to match the run. If the run cannot be reconstructed honestly, treat the finding as a
233
101
  blocking evidence defect. Completion waits for the queue to drain.
234
102
 
@@ -243,10 +111,8 @@ copy of a locked file before deciding its lock is wrong.
243
111
 
244
112
  ## Non-negotiable constraints
245
113
 
246
- - Downstream stages do not patch protected upstream artifacts before an in-force Change request: decision row authorizes the path. The drift profile compares the branch against baseBranch and reports QFAI-DRIFT-001 for an unapproved protected change. The SDD owner may create the request row itself without a prior row.
114
+ - Downstream stages do not patch upstream artifacts: the owner changes them as When drift is detected says.
247
115
  QFAI-DRIFT-003 is a warning that nothing was compared, because baseBranch does not resolve.
248
- QFAI-DRIFT-004 is a warning that an uncommitted edit to a protected file is not compared:
249
- record the Change request row before you commit the change.
250
- - Existing decisions.md and open-questions.md rows retain their ID, Content, and Approach, except for the explicit branch-added decision renumbering, published decision prefix recovery and merge-added identical decision copy recovery above. Inherited rows retain those cells without exception. A former row may change Status; new content is appended as a new row.
116
+ - An existing decisions.md row keeps its ID and is never removed, though its wording may be restated, and an existing open-questions.md row is never edited; a changed decision is appended as a new row. The drift profile compares the base and the branch by row ID, so the order of rows means nothing.
251
117
  - Vendored assistant rules are changed in the package and synchronized into projects by `npx qfai init --force`, which overwrites a local edit. A project rule lives in a `*.local.md` overlay beside the vendored one.
252
- - When approval is unavailable, keep the affected items stopped and report the decision needed. Continue unrelated work.
118
+ - When a critical decision cannot be put to the user, keep the affected items stopped and report the decision needed. Continue unrelated work.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read when you write or change a shipped asset.
4
4
 
5
- ## Asset Authoring Shape (Mandatory)
5
+ ## Asset Authoring Shape
6
6
 
7
7
  A `SKILL.md` states the contract and points at the file that carries the detail. It is not where the detail lives.
8
8
 
@@ -16,6 +16,7 @@ A `SKILL.md` states the contract and points at the file that carries the detail.
16
16
 
17
17
  A hard line ceiling backs this up: **500 lines per Markdown assistant asset file** and **800 lines per YAML assistant asset file**, for every `.qfai/assistant/**/*.{md,yml,yaml}` file, counted as `content.split(/\r?\n/).length` — blank lines included.
18
18
  `npx qfai doctor` measures it and reports every file over its ceiling as `assets.lineBudget`.
19
+ The same check reports a `SKILL.md` whose body after the YAML frontmatter exceeds **20,000 characters**; a skill's reference files are not held to that limit.
19
20
  The ceiling is a backstop, not the rule: a file approaching it is a signal to move a section out, not to raise the number.
20
21
 
21
22
  The Markdown ceiling is the limit an agent can follow in one file: it follows fewer instructions as its context grows, and follows those in the middle of a long file worst. A Markdown file has a `references/` home to move detail into. A YAML asset is parsed as data and cannot be split that way (see below), which is why its ceiling is higher.
@@ -54,7 +55,7 @@ For a prose asset, raising the ceiling or claiming an exemption is not the remed
54
55
 
55
56
  ### Machine-readable assets split in their own format, or say why they cannot
56
57
 
57
- The ceiling is measured over YAML assets too — package routing and review-profile defaults and the shipped contract templates. The split above is not open to them: a validator parses those files as structured data, or a skill copies one whole into a project, so an entry moved into a Markdown sibling under `references/` leaves the parsed document and stops meaning anything. Prose about the
58
+ The ceiling is measured over YAML assets too — package workflow plans and the shipped contract templates. The split above is not open to them: a validator parses those files as structured data, or a skill copies one whole into a project, so an entry moved into a Markdown sibling under `references/` leaves the parsed document and stops meaning anything. Prose about the
58
59
  file may move there; the file's own items may not.
59
60
 
60
61
  So for a machine-readable asset at the ceiling the remedy is, in order:
@@ -62,7 +63,7 @@ So for a machine-readable asset at the ceiling the remedy is, in order:
62
63
  1. **Split it in its own format** — a sibling of the same kind that the loader or schema already reads, so every item stays parsed.
63
64
  2. **Record an exemption** where the document has to stay whole — a file generated from another asset, one the schema admits only as a single document — naming what makes the split impossible. "This file is long" is not that reason, and a prose asset may not use this step.
64
65
 
65
- ## Citation Path Form (Mandatory)
66
+ ## Citation Path Form
66
67
 
67
68
  A pointer only resolves if the reader knows what base to resolve it against. There is one base, and it is the project root.
68
69
 
@@ -4,9 +4,9 @@ Read before the first `spawn_agent` call when the host is Codex.
4
4
 
5
5
  ## Codex delegation notes
6
6
 
7
- A sub-agent should cost the orchestrator one brief and one final answer. A call
7
+ A sub-agent should cost the session agent one brief and one final answer. A call
8
8
  that only checks progress, such as a short wait, a sleep or an agent listing,
9
- is one more model call, so the orchestrator makes none.
9
+ is one more model call, so the session agent makes none.
10
10
 
11
11
  - **Self-contained brief.** Call `spawn_agent` with `fork_turns: "none"` and a
12
12
  `message` that holds everything the sub-agent needs: the task, the files to
@@ -17,8 +17,8 @@ is one more model call, so the orchestrator makes none.
17
17
  - **One final answer, no interim messages.** The brief tells the sub-agent to
18
18
  send no `send_message` updates and to return its result once, as its final
19
19
  answer. Where `wait_agent` takes no `targets`, every queued message ends the
20
- orchestrator's wait early.
21
- - **Long wait.** With no work of its own left, the orchestrator calls
20
+ session agent's wait early.
21
+ - **Long wait.** With no work of its own left, the session agent calls
22
22
  `wait_agent` with a `timeout_ms` of minutes within the maximum the tool states,
23
23
  such as `600000`, not 10 to 60 seconds. A wait that times out is
24
24
  followed by another long wait.
@@ -9,7 +9,7 @@ Follow this protocol when any of the validate, doctor, test, lint, typecheck, bu
9
9
  - inspect exit code, logs, `validate.json`, and cited files before reporting — in `validate.json`, read `counts` for the verdict and `issues[].code` for each finding; the array is `issues`, not `findings`;
10
10
  - classify each finding as skill-owned artifact, upstream spec/contract, code/test defect, environment/tooling, or user decision;
11
11
  - fix skill-owned artifacts and code/test defects autonomously when the fix is local and non-destructive;
12
- - **upstream spec/contract findings: never repair.** STOP and follow `.qfai/assistant/rule/drift-protocol.md` (Change Request + owner-skill rerun) — **even when the fix looks local and non-destructive, and even when it is one token and obviously correct**. "Local and non-destructive" is a permission for the two classes above it; it is not a test that upstream artifacts can pass.
12
+ - **upstream spec/contract findings: never repair.** STOP and follow `.qfai/assistant/rule/drift-protocol.md` (proposed change to the owner + owner-skill rerun) — **even when the fix looks local and non-destructive, and even when it is one token and obviously correct**. "Local and non-destructive" is a permission for the two classes above it; it is not a test that upstream artifacts can pass.
13
13
  Ownership, not size, decides;
14
14
  - environment/tooling findings: repair the environment when it is yours to repair (install a missing dev dependency, regenerate a lockfile, create a scratch directory). Stop for anything needing credentials, network access you do not have, or a change to CI configuration or the host machine;
15
15
  - user decision findings: never decide by default. Record the question, state the option you would take and why, and stop — a decision taken silently to keep a gate green is the same failure as repairing upstream, one layer up;
@@ -26,7 +26,7 @@ surrender. Blocked is a status, not a verdict on the run.
26
26
 
27
27
  A gate whose answer varies on identical inputs is a finding in its own right, not a run to discard. The protocol classifies it as `environment/tooling`; what follows is what that class obliges.
28
28
 
29
- **When a gate fails and a rerun with no intervening change passes**, all of the following are REQUIRED. A clean rerun on its own is not evidence for that gate.
29
+ **When a gate fails and a rerun with no intervening change passes**, all of the following are required. A clean rerun on its own is not evidence for that gate.
30
30
 
31
31
  - **Record it as an `environment/tooling` finding.** Not as a pass, and not as a code/test defect — nothing was fixed between the two runs.
32
32
  - **Disclose every run.** Report the results of all runs of that gate, in order, with their commands. Reporting only the run that passed is [selective reporting](#selective-reporting-is-invented-evidence) and is forbidden: the evidence rules are satisfied by a clean run's command and output, so nothing else stops it.
@@ -6,9 +6,8 @@ Read when the placeholder scan reports a hit.
6
6
 
7
7
  **`OQ` and `OPEN QUESTION` are exempt only as tracking structure.** Exempt: the `Open Questions` heading, a register
8
8
  table header, and a question row containing the fields required by its register. Story-tree `open-questions.md` uses
9
- `ID | Content | Approach | Status`; an empty register contains the heading and table header without a question row.
10
- Discussion registers use their own template fields. A register row's Status is structure too: `TODO` in the Status cell of a
11
- `decisions.md` or `open-questions.md` row is the row's state, not a placeholder. Article II and `.qfai/assistant/rule/workflow.md` both end an
9
+ `ID | Content | Approach`; an empty register contains the heading and table header without a question row.
10
+ Discussion registers use their own template fields. Article II and `.qfai/assistant/rule/workflow.md` both end an
12
11
  unverifiable fact by recording an Open Question, so the tracked record they prescribe must never be reported as an
13
12
  unresolved placeholder. Everywhere else the two strings are still scanned: a bare `OQ` or `OPEN QUESTION` left as a
14
13
  value in generated spec prose or a contract field, or a row missing a required field, is a hit like any other token.
@@ -10,17 +10,17 @@ Read when a reviewer finding is written or judged.
10
10
  - `defect:correctness`, `defect:security`, or `defect:code-quality` — a defect demonstrable from the changed artifacts themselves, cited with the evidence that demonstrates it (see `.qfai/assistant/rule/drift-protocol.md#defect-or-new-scope-decide-this-first`). A reviewer who can show the deliverable is wrong on its own terms does not need an `AC-*` to say so;
11
11
  - `record:<CODE>` — a defect in the run's own record rather than in the product: an evidence section, a round block, an anchor, or provenance prose. `<CODE>` names the record rule;
12
12
  - `none` — reviewer-originated scope, i.e. a new product obligation upstream never asked for.
13
- - `record:*` and `none` MUST be recorded as `advisory`; neither can be `blocking` or gate `DONE`. A `record:*` finding never re-runs the row: the orchestrator files it in the record-defect queue the reviewing stage's own completion contract names, and that contract is what drains it (`.qfai/assistant/rule/drift-protocol.md#the-record-defect-queue`). **The class needs a drain:
13
+ - `record:*` and `none` are recorded as `advisory`; neither can be `blocking` or gate `DONE`. A `record:*` finding never re-runs the row: the session agent files it in the record-defect queue the reviewing stage's own completion contract names, and that contract is what drains it (`.qfai/assistant/rule/drift-protocol.md#the-record-defect-queue`). **The class needs a drain:
14
14
  only a stage whose completion conditions require that queue drained may use it — today `/qfai-implement` alone, so `/qfai-sdd`, `/qfai-configure`, `/qfai-verify`, `/qfai-discussion` and `/web-research` reviewers must not, and there the finding keeps the class it would otherwise have had.** An entry closes only on a repaired record;
15
15
  `record:unchecked` is never a substitute for the repair — a record rule worth a round is worth a validator code.
16
16
  - **Integrity is not record class.** Evidence copied from another round or a sibling row, an anchor resolving to a run other than the one it names, and a reviewer that authored what it reviews all claim work that was not done or independence that is missing. A `PASS` built on them is refused,
17
17
  so they stay `blocking` as `defect:code-quality` and are never filed as `record:*` — which covers an honestly produced record that is merely wrong.
18
- - A `none` advisory takes the Change Request / Open Question path (`.qfai/assistant/rule/drift-protocol.md#reviewer-originated-obligations`); a `record:*` advisory takes the queue above. Neither goes to the implementer.
18
+ - A `none` advisory takes the specification-owner / Open Question path (`.qfai/assistant/rule/drift-protocol.md#reviewer-originated-obligations`); a `record:*` advisory takes the queue above. Neither goes to the implementer.
19
19
  - Only `blocking` findings force `REVISE`, and only a finding citing a behaviour-governing obligation or a defect class may be one. **The trace class bounds which findings may block; the severity is declared, and it settles whether one does.** Read as "an obligation trace is blocking", the same item was a discussion-blocking defect to one reviewer and carried advice to the next.
20
20
  - An obligation-traced finding is recorded `advisory` where a named section places the work outside the reviewed stage. The discussion review's implementation precision is that section
21
21
  (`.qfai/assistant/rule/review-convergence.md#discussion-review-precision`): the obligation is agreed, and what the advice is about is how a later stage implements it, so the finding is carried to that stage rather than demanded here. Nothing else lowers a behaviour-governing finding to `advisory`.
22
22
 
23
- ## What a reviewer may demand more of (MUST)
23
+ ## What a reviewer may demand more of
24
24
 
25
25
  A finding that asks for more work — another item, more detail, a wider set — is admissible only on
26
26
  the concrete artifacts.
@@ -15,31 +15,40 @@ paths and a reviewable diff that can be prepared within the worker's permitted
15
15
  area. Do not bypass the refusal through a shell, script or another tool.
16
16
  This does not forbid shell authoring where the host already permits it.
17
17
 
18
- The orchestrator checks the diff against the current files in its own permitted
18
+ The session agent checks the diff against the current files in its own permitted
19
19
  checkout before applying it. If that edit is refused too, leave the application
20
20
  pending and continue only independent work. Follow the existing worktree or
21
- shared-index mode in `.qfai/assistant/rule/workflow.md#concurrency-stage-independent-mandatory`
21
+ shared-index mode in `.qfai/assistant/rule/workflow.md#concurrency-every-stage`
22
22
  when assigning writers and integrating their paths.
23
23
 
24
24
  ## Work order template
25
25
 
26
+ A unit work order also names what the worker cannot read from the files and the
27
+ paths it leaves alone. That context is a few lines; a unit that needs the
28
+ conversation retold is not a unit. A judgement work order, such as a review, leaves both
29
+ fields out: its brief stays black-box, as
30
+ `.qfai/assistant/rule/shared-skill-delegation-baseline.md#session-agent-protocol`
31
+ says.
32
+
26
33
  ```text
27
34
  Task title: <short>
28
- Role: <sub-agent role>
29
- Review series: <reviewed artifact> + <reviewer role> + <replacement ordinal> # review work orders only
35
+ Agent: <card name>
36
+ Review series: <reviewed artifact> + <reviewer card> + <replacement ordinal> # review work orders only
30
37
  Goal: <what to decide/produce>
31
38
  Checkout: <absolute checkout assigned to this task by the host>
32
39
  Write paths: <exact owned paths, or none for a read-only task>
40
+ Do not touch: <paths outside the unit that the worker leaves as they are> # unit work orders only
33
41
  Edit method: <host-permitted tool; worktree creation does not grant access>
34
42
  If an edit is refused: stop that target; return tool, cwd, target, refusal text, owned paths and a reviewable diff
35
43
  Inputs (refs):
36
44
  - <file/section>
37
- - .qfai/assistant/rule/drift-protocol.md#core-rule <!-- the protected set, in front of the agent -->
45
+ - .qfai/assistant/rule/drift-protocol.md#core-rule <!-- the upstream set, in front of the agent -->
46
+ Context not in the repository: <a few lines: decisions, procedures or reasons the files do not record> # unit work orders only
38
47
  Constraints:
39
48
  - must: enforce Drift Protocol
40
49
  - must: follow applicable test-layer or validation policy
41
50
  - must_not: patch upstream artifacts directly; every upstream change requires
42
- STOP + Change Request + owner rerun per .qfai/assistant/rule/drift-protocol.md
51
+ STOP + proposed change to the owner + owner rerun per .qfai/assistant/rule/drift-protocol.md
43
52
  Output format:
44
53
  - <headings / bullet schema>
45
54
  Time budget: none | <seconds> # advisory: nothing stops at it. See .qfai/assistant/rule/stage-cost.md
@@ -1,14 +1,15 @@
1
1
  # Research-First Protocol
2
2
 
3
- QFAI's initial research protocol for `discovery-analyst`. Select the role by
4
- its card ID and the resolved routing entry, as
5
- `.qfai/assistant/rule/agent-selection.md` requires.
3
+ QFAI's initial research protocol. The session agent runs it and frames the
4
+ research itself. Two or more self-contained lookups may run in parallel on
5
+ `fullstack-engineer` under the parallel-unit gate of
6
+ `.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md`;
7
+ the session agent reads their answers into the summary.
6
8
 
7
9
  ## Trigger
8
10
 
9
- `/qfai-discussion` triggers this protocol. The resolved routing entry makes
10
- `discovery-analyst` mandatory in its framing phase. Run it whether or not the
11
- work includes UI.
11
+ `/qfai-discussion` triggers this protocol. Run it whether or not the work
12
+ includes UI.
12
13
 
13
14
  ## Output Schema
14
15
 
@@ -26,7 +26,7 @@ which owns the delegation rules these sit beside.
26
26
  names a concrete security defect, data loss or corruption, or a correctness
27
27
  defect that would break a released contract; it is never only reported.
28
28
 
29
- ## Answered demands (MUST)
29
+ ## Answered demands
30
30
 
31
31
  Within a stage there is one review, so no demand comes back in it. The rules
32
32
  below are for a later, separate stage whose own one review reads an artifact an
@@ -41,7 +41,7 @@ Evidence cells. When a later stage reviews the same artifact, its
41
41
  finding source, demand, response and evidence. When there are none, write
42
42
  `None`.
43
43
 
44
- In that later review an answered demand MUST NOT be re-raised under another wording.
44
+ In that later review an answered demand is not raised again under another wording.
45
45
  Close a repeat by citing its recorded answer. This bounds what a reviewer may
46
46
  require, not what a reviewer may report.
47
47
 
@@ -68,7 +68,7 @@ just placed elsewhere.
68
68
  `Severity: advisory`, and `Traces to:` **the obligation whose implementation the
69
69
  advice is about** — which the pack carries, since the subject is how a later
70
70
  stage implements something already agreed. Never `none`: that value means
71
- reviewer-originated scope, takes the Change Request path and reaches no
71
+ reviewer-originated scope, goes to the specification owner and reaches no
72
72
  implementer, and advice about an agreed obligation proposes no new one. Where an
73
73
  item genuinely names nothing the pack carries it is reviewer-originated scope,
74
74
  and the baseline's `none` path is the right one for it.
@@ -100,10 +100,10 @@ Wrong repository facts, missing decision traceability, scope contradictions and
100
100
  defects in the pack's own safety obligations remain in remit. Non-normative
101
101
  status is not permission to pass those.
102
102
 
103
- ## Agent-to-agent grilling (MUST)
103
+ ## Agent-to-agent grilling
104
104
 
105
105
  A grilling session between agents is a **delegated session**
106
- (`.agents/rules/grilling.md`): a griller interviews the authors, and the user is
106
+ (`.agents/rules/grilling.md`): a griller interviews the session agent, and the user is
107
107
  asked only an uncovered critical decision when questions are permitted.
108
108
  Actual scoped user delegation may authorize reversible requested judgment
109
109
  without an individual option answer; record the agents' adoption and authority
@@ -119,7 +119,7 @@ fluency rather than a better answer.
119
119
  Where the authors disagreed, the recommendation is still taken, and each
120
120
  position is recorded beside it with whose it is. The stage reports every adopted
121
121
  decision at its end without waiting for an answer. A user who disagrees
122
- overturns one through a change request or a rerun.
122
+ overturns one through a specification change or a rerun.
123
123
 
124
124
  **A critical decision without an actual answer or recorded applicable user
125
125
  authority goes to the user at once when asking is permitted**, without spending
@@ -127,7 +127,7 @@ a round. Agent agreement and round exhaustion supply no authority.
127
127
 
128
128
  | Critical decision | Why it goes to the user |
129
129
  | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
130
- | It contradicts a spec, a contract or a recorded decision | Changing settled input is a Change Request, not a design round |
130
+ | It contradicts a spec, a contract or a recorded decision | Changing settled input is the user's decision, not a design round |
131
131
  | Its effect cannot be taken back: security, lost or corrupted data, a broken released contract, spending, a legal commitment, a public release | A wrong recommendation here is not repaired by the next run |
132
132
  | It rests on product or business intent that the request, the discussion pack, the specs and the contracts all leave unstated | Two agents reasoning past the evidence converge on the more fluent argument |
133
133