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
@@ -146,18 +146,18 @@ author and whoever reviews the prototype. Follow the shape
146
146
 
147
147
  ## Purposeful copy: `supplements` and `structure`
148
148
 
149
- A screen states the words it shows, so that implementation adds none the contract
150
- did not ask for and review can compare the rendered screen with what was agreed.
151
- The words are the screen `title` (its one heading), the labels of `elements` and
152
- `actions`, the group headings, and the supplements below. Two keys carry them,
153
- beside `primary_tasks`, `elements` and `actions`, which stay as they are.
149
+ Two optional keys, beside `primary_tasks`, `elements` and `actions`, describe the
150
+ words a screen shows beyond its `title` and the labels of its `elements` and
151
+ `actions`. They are description for the author and the reviewer. `npx qfai
152
+ validate` does not check them: what it checks is the UI source, where every plain
153
+ text carries a `qfai-text` reason comment.
154
154
 
155
- ### `supplements` (required)
155
+ ### `supplements` (optional)
156
156
 
157
- Every text the screen shows beyond its `title`, group headings and labels: a
158
- sentence under a field, a notice, an empty-state message, a disclosure, the result
159
- of a save or a send, the instruction after a failure, the consequence of an action
160
- that cannot be undone. Each is an entry with exactly these keys, all non-empty:
157
+ Text the screen shows beyond its `title`, group headings and labels: a sentence
158
+ under a field, a notice, an empty-state message, a disclosure, the result of a
159
+ save or a send, the instruction after a failure, the consequence of an action
160
+ that cannot be undone. Each entry uses these keys:
161
161
 
162
162
  | Key | Holds |
163
163
  | ------ | ----------------------------------------------------------------------------------------- |
@@ -167,29 +167,19 @@ that cannot be undone. Each is an entry with exactly these keys, all non-empty:
167
167
  | `text` | the words as displayed |
168
168
  | `why` | what the user could not know or do without it, and why a label or structure is not enough |
169
169
 
170
- A text shown in several states is listed once per state it shows in, each entry
171
- with its own `id`.
172
-
173
- `supplements: []` says the screen shows none. Most screens need few, and a screen
174
- need not have any. Two kinds of text are not supplements: the message of a field
175
- rule is owned by the `validations` of its element, and data the product shows or
176
- the user types is not copy the contract authors. A field message that says more
177
- than its rule does is a supplement with `when: error`.
178
-
179
- The list is the whole inventory in both directions. Text the screen shows that is
180
- not listed is excess. A listed text the screen does not show is an unmet need, so
181
- a necessary condition, cost, destination, result, recovery step or consequence
182
- that is written here cannot be dropped by a later tidy-up; removing it is a
183
- change to the contract, which goes back to `/qfai-sdd`.
170
+ Most screens need few, and a screen need not have any. The message of a field
171
+ rule belongs to the `validations` of its element, and data the product shows or
172
+ the user types is not copy the contract authors.
184
173
 
185
174
  Write `why` for the point of decision. "Explains the Save button" is a reason to
186
175
  delete the text. "After the click the user cannot see where the draft went" is a
187
- reason to keep it.
176
+ reason to keep it. The same reason, in the same strength, goes into the
177
+ `qfai-text` comment in the source.
188
178
 
189
179
  ### `structure` (optional)
190
180
 
191
- The groups the screen is read in, in reading order. Each is an entry with exactly
192
- `id`, `tasks`, `members` and, when the group shows a heading, `heading`:
181
+ The groups the screen is read in, in reading order. Each entry uses `id`,
182
+ `tasks`, `members` and, when the group shows a heading, `heading`:
193
183
 
194
184
  | Key | Holds |
195
185
  | --------- | ------------------------------------------------------------------ |
@@ -198,50 +188,15 @@ The groups the screen is read in, in reading order. Each is an entry with exactl
198
188
  | `members` | the `elements[].id` and `actions[].id` values it holds, in order |
199
189
  | `heading` | the displayed heading; leave the key out when the group shows none |
200
190
 
201
- An id belongs to one group, and an element or action may be left out of every
202
- group. `structure` is optional only for a screen that shows no heading beyond its
203
- `title`. A screen that shows any other heading, at any level, has one group with a
204
- `heading` for each, so a screen with several `h2` headings writes `structure`.
205
- Leaving the key out says the screen shows no such heading; it never says the
206
- screen may show one without a group. A group needs a task and a member, so the
207
- heading must head something the user reads or acts on: declare the table or list
208
- that shows data as an element, and the group holds it. A heading over prose or
209
- supplements alone has neither a task nor a member, and does not belong on the
210
- screen. `npx qfai validate` does not check this, so the
211
- reviewer compares the rendered headings with the groups. A group heading is
212
- not the screen title: a second heading above or beside the real one repeats it.
213
- A group that serves no task does not belong on the screen; name the task it
214
- enables, or leave the heading and the group out.
215
-
216
- ### Which key holds which text
217
-
218
- Every text the screen shows has one home. The table applies the definitions above
219
- to the text authors and reviewers most often disagree about:
220
-
221
- | Rendered text | Home |
222
- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
223
- | The one page heading (`h1`) | `title` |
224
- | A heading over a group of elements or actions (`h2`, `h3`) | `structure[].heading` of that group |
225
- | A small line above or beside a heading (eyebrow, kicker) | a supplement with `near` set to the group; it is not a heading and not a label |
226
- | The text of a field, button or other control | `label` of that element or action |
227
- | Link text | `label` of a `navigate` action |
228
- | A table column header | recommended: `label` of an element declared for that column, as elements are the display fields |
229
- | A figure caption | a supplement with `near` set to the element it describes |
230
- | An item of a list the product writes (a fixed checklist) | a supplement |
231
- | An item of a list made of data the product shows | outside the contract: data is not copy the contract authors |
232
- | Product or site-identity text (a name, a tagline) | `label` when it is a link or control, otherwise a supplement |
233
- | The message of a field rule | `validations` of that element |
234
-
235
- Nothing is outside the contract merely because it repeats across screens. Text that
236
- repeats on every screen is listed on each, and when no `why` that names a decision
237
- can be written for it, the text is a candidate for removal from the screen rather
238
- than a reason to leave it unlisted.
191
+ A group heading must head something the user reads or acts on, and a group that
192
+ serves no task does not belong on the screen. A group heading is not the screen
193
+ title: a second heading above or beside the real one repeats it.
239
194
 
240
195
  ### A worked example
241
196
 
242
197
  The sample at `templates/contracts/ui-contract.sample.yaml` shows a complete
243
198
  screen. Its draft action reads "Save draft", and no paragraph says what Save draft
244
- does. What the label cannot say is declared instead: `Saved to Drafts` after the
199
+ does. What the label cannot say is described instead: `Saved to Drafts` after the
245
200
  click, and `Not saved. Your entries are still here. Try again.` after a failure.
246
201
  The user learns where the draft went and what a failure means, and nothing is
247
202
  written twice.
@@ -258,44 +213,8 @@ Subtraction removes text that adds no meaning. It never removes:
258
213
 
259
214
  Moving such text into a tooltip or a placeholder does not keep it. A word or
260
215
  character count never approves or rejects a screen; a count is an observation
261
- a finding may cite.
262
-
263
- ### What validate checks
264
-
265
- `QFAI-CONTRACT-043` reports `supplements` absent, a key that is not a list, an
266
- entry that is not a mapping, a missing, empty or extra key, a `when` outside the
267
- five states, and a repeated `id`; the same for `structure` when it is written.
268
- `QFAI-CONTRACT-044` reports a `members`, `tasks` or `near` that names an id
269
- the screen does not declare, and an element or action in two groups.
270
- `QFAI-CONTRACT-045` warns when a group heading is the screen title, or a
271
- supplement's text is the title, a group heading, the label of what it sits near, or
272
- another supplement's text near the same target in the same state; case, spacing and
273
- closing punctuation do not make a text different. Whether a sentence is needed is
274
- judged against the task by the reviewer; validate compares ids and exact wording
275
- only.
276
-
277
- `npx qfai validate --rendered <file>` compares what the screens rendered with
278
- these lists. Your own browser run writes the file, and QFAI renders nothing:
279
- `{ "screens": [{ "contract": "UI-0001", "screen": "order_create", "when": "default", "texts": ["..."] }] }`,
280
- one entry per screen and state, holding the texts the screen showed. Leave out
281
- data the product shows, text the user typed and the message of a field rule.
282
- `QFAI-CONTRACT-047` names a rendered text that is no title, group heading, label
283
- or supplement of that state, and `QFAI-CONTRACT-048` a supplement of that state
284
- the screen did not render; `QFAI-CONTRACT-046` names a file or an entry out of
285
- shape. A supplement counts only for its own `when`, so a text shown in several
286
- states needs its entry for each. Only the screens and states the file holds are
287
- compared, so a render of
288
- the default state alone checks the default state.
289
-
290
- A contract written before these keys was valid without them. Add
291
- `supplements` to each screen, listing each text it shows beyond its title, group
292
- headings and labels; `supplements: []` is only for a screen that shows no such
293
- text. Keep `structure` out while the screen
294
- shows no heading beyond its title; the first such heading needs its group.
295
-
296
- Two contracts that state the same screen `id` each hold their own `supplements`
297
- and `structure`; the project-wide screen list compares `title`, `route` and
298
- `primary_tasks` only.
216
+ a finding may cite. Whether a described text is needed is the reviewer's
217
+ judgement, not a validate finding.
299
218
 
300
219
  ## Screen contract rules
301
220
 
@@ -339,14 +258,6 @@ Render the element with that marker, or remove the marker from the contract.
339
258
  **A label does not match.** Update the contract label, then the rendered text or
340
259
  marker mapping. Updating one side leaves the two out of step.
341
260
 
342
- **`QFAI-CONTRACT-043` names a screen with no `supplements`.** List each text the
343
- screen shows beyond its title, group headings and labels, one entry with `id`,
344
- `near`, `when`, `text` and `why`; write `supplements: []` only if it shows no
345
- such text.
346
-
347
- **`QFAI-CONTRACT-045` warns that a supplement repeats a label.** Delete the supplement,
348
- or word it so it tells the user something the label does not.
349
-
350
261
  **The discussion pack already has screen contracts, so this looks redundant.**
351
262
  It is not. A discussion pack is discovery output and is non-normative; the
352
263
  downstream skills and every validate lane read `<paths.contractsDir>/ui/*.yaml`.
@@ -369,6 +280,5 @@ For a UI-bearing visual flow, the root `DESIGN.md` is authored and validated by
369
280
  - [ ] Every UI-bearing contract has one full declared ID, at least one screen, and a matching `contracts.md` row.
370
281
  - [ ] Screen IDs, routes, primary tasks, labels, markers, and actions are stable and testable.
371
282
  - [ ] Every declared action has an observable effect, including relevant failure states.
372
- - [ ] Every screen declares `supplements` (`[]` when none), each with the reason the text is needed, and its `structure` names every heading beyond the title.
373
283
  - [ ] No supplement restates a label, heading or action the screen already shows, and none is development commentary.
374
284
  - [ ] Prototyping coverage uses full contract IDs and the current cycle-0 fields.
@@ -28,8 +28,8 @@ QFAI CLI applies.
28
28
  ## Normalization Rules
29
29
 
30
30
  - Preserve source IDs where available.
31
- - Normalize the sidecar's notes on displayed text into the screen's `supplements`
32
- and `structure`, as the UI contract guide shapes them. Notes for the author or
31
+ - Normalize the sidecar's notes on displayed text into the screen's optional
32
+ `supplements` and `structure`, as the UI contract guide shapes them. Notes for the author or
33
33
  the reviewer are not displayed text and are not copied into either key.
34
34
  - Convert prose into machine-readable arrays or objects.
35
35
  - Reject placeholder text instead of copying it into contracts.
@@ -72,8 +72,8 @@ screens:
72
72
  # structure (optional): the groups the screen is read in, in reading order.
73
73
  # `tasks` are primary_tasks ids, `members` are elements/actions ids, and
74
74
  # `heading` is the displayed heading of the group; leave it out for a group
75
- # that shows none. Without `structure` the screen shows no heading beyond
76
- # its title. An id belongs to one group.
75
+ # that shows none. An id belongs to one group. This key describes the
76
+ # screen; validate does not check it.
77
77
  structure:
78
78
  - id: g_customer
79
79
  heading: Customer
@@ -86,17 +86,18 @@ screens:
86
86
  - id: g_commit
87
87
  tasks: [t1, t3, t4]
88
88
  members: [submit_order, save_draft, discard_draft]
89
- # supplements (required): every text the screen shows beyond its title,
90
- # group headings and labels. Field validation messages are the exception;
91
- # they belong to the element's `validations`. `[]` says the screen shows
92
- # none. `near` is an elements/actions/structure id, `when` is one of
89
+ # supplements (optional): text the screen shows beyond its title, group
90
+ # headings and labels. Field validation messages belong to the element's
91
+ # `validations`. This key describes the copy; validate does not check it.
92
+ # Validate checks the UI source instead: every plain text there carries a
93
+ # `qfai-text` reason comment. `near` is an elements/actions/structure id, `when` is one of
93
94
  # default, empty, loading, error, success, and `why` says what the user
94
95
  # could not know or do without the text, and why a label or the structure
95
96
  # cannot carry it.
96
97
  #
97
98
  # There is no supplement that restates what "Save draft" does: the label
98
99
  # says it. What the label cannot say is where the draft went and what a
99
- # failed save means, so those two are declared.
100
+ # failed save means, so those two are described.
100
101
  supplements:
101
102
  - id: sp_draft_saved
102
103
  near: save_draft
@@ -43,3 +43,4 @@ flowchart TD
43
43
  - Skeleton: `<smallest command that proves the application entrypoint starts>`
44
44
  - Validate: `<qfai validate command>`
45
45
  - Pack / distribution: `<package or artifact check command, or remove this line>`
46
+ - Turn-end check: `<labels of the commands above, comma-separated, fast enough to run whenever an agent ends its turn, or remove this line>`
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Decisions
4
4
 
5
- | ID | Content | Approach | Status |
6
- | --- | ------- | -------- | ------ |
5
+ | ID | Content | Approach |
6
+ | --- | ------- | -------- |
@@ -1,44 +1,72 @@
1
1
  <!--
2
- Each row records one decision. Its Approach cell holds these four items, in
3
- this order, each written as `- ` followed by its label:
2
+ Each row records one decision the user made. It is appended once the decision
3
+ is made, and afterwards keeps its ID and is never removed or renumbered;
4
+ only its wording may be restated. The register holds
5
+ decisions only; a question not yet decided goes to open-questions.md.
4
6
 
5
- - `Evidence:` one or more entries, separated by `; `. A `file:` entry is a
6
- repository-relative path, optionally followed by `#L<start>-L<end>`. A
7
- `command:` entry is the command, then `→` and a short summary of its result.
8
- - `Grounds:` which evidence supports the decision, and how.
9
- - `Residual risk:` the risk that remains, or `none — <reason>`.
10
- - `Rollback:` the steps that undo the decision, or `none — <reason>`.
7
+ A decision, an approval of a critical decision or a release included, becomes
8
+ a row only when it is hard to reverse, would surprise a reader without
9
+ context, and was the result of a real trade-off. The stage report states
10
+ every other decision.
11
11
 
12
- No item is empty, and only the last two may take `none — <reason>`. What a
13
- kind of row must state in its Approach, such as a change request's proposed
14
- correction, goes inside these items. Write a `|` inside a cell as `\|`.
12
+ A new row's ID is DEC-yyyymmddhhMMss: the UTC time the row is written, as 14
13
+ digits. When a row of this register already holds that second, take the next
14
+ second no row holds. A legacy DEC-NNNN row keeps its ID.
15
15
 
16
- Use this form for every new row. A passing validation result does not prove
17
- that every decision row follows it.
16
+ The opening of Content gives a row its kind:
18
17
 
19
- A release approval, with `<...>` standing for the project's values, has this
20
- Content cell:
18
+ - `Declined: <option>` is an option the user rejected. Its Approach records
19
+ who declined it and when.
20
+ - `Test exception: <BF, AC or EX>` exempts that item while the row exists.
21
+ - `Retired: <ID>, <ID>…` names the story-tree IDs a change retired, so none
22
+ is issued again. It approves nothing and is written whatever the recording
23
+ test above says.
24
+ - Any other Content is a decision the user made.
25
+
26
+ A declined row is a rejected option and authorizes nothing. A later decision
27
+ that refers to an earlier row opens its Approach with the earlier ID:
28
+
29
+ - `Supersedes DEC-…` replaces the earlier decision.
30
+ - `Narrows DEC-…` replaces part of it.
31
+ - `Reopens DEC-…` reopens a declined option.
32
+
33
+ The earlier row stays as written. The order of rows means nothing: a merge may
34
+ interleave the rows two branches appended.
35
+
36
+ Write each row as a short decision record. Content states what was
37
+ decided; Approach says why, in one to three short sentences: the context
38
+ that forced the choice and the reason it won, and, for an approval, who
39
+ approved it, when and the label of the option chosen. Point to where the
40
+ detail lives, such as a contract rule, a story or a pull request, instead of
41
+ restating it. Add an optional item only when it tells a later reader
42
+ something those sentences do not, each written as `- ` followed by its label,
43
+ after any opening citation above:
44
+
45
+ - `Considered:` the options that lost, and why.
46
+ - `Consequences:` what the decision makes easier or harder.
47
+ - `Rollback:` the steps that undo it, when they are not obvious.
48
+
49
+ Content and Approach together stay within 600 characters; validation warns
50
+ on a longer row. Write a `|` inside a cell as `\|`.
51
+
52
+ A release approval that passes the recording test, with `<...>` standing for
53
+ the project's values, has this Content cell:
21
54
 
22
55
  Release <X.Y.Z> approved by <name> on <date>, option "<label>"
23
56
 
24
57
  and this Approach cell, written on one line and without backticks around it:
25
58
 
26
- - Evidence: file:CHANGELOG.md; command:<the release checks> → <result> - Grounds: <why the checks support the release> - Residual risk: none — <reason> - Rollback: <the steps that retract the release>
27
-
28
- A row that records a spec change following from an earlier approval may name
29
- that earlier decision by its ID in `Grounds:`, in place of a new answer from
30
- the user. Its `Evidence:` still lists what supports the change.
59
+ <the release checks and their result, in one sentence>. - Rollback: <the steps that retract the release>
31
60
 
32
61
  A stage that does not own this file records its decisions in its own final
33
- report, with the same four items under the same rules.
34
- A legacy root has only the Decisions section. When reviewed historical pages
35
- are adopted, insert an optional '## Decision pages' section before '## Decisions',
36
- with only unique direct '- decisions/page-NNNN.md' entries in read order.
37
- Each page uses the same closed four-column table and has no page index.
38
- Read listed pages before this root table; append new rows only to this root.
39
- Every physical root and page, including comments and blank lines, stays within
40
- 500 lines. Rotation is never automatic; use the separately approved relocation
41
- procedure in the SDD triage reference.
62
+ report, in the same short form.
63
+
64
+ A root may list decision pages in an optional '## Decision pages' section
65
+ before '## Decisions', with only unique direct '- decisions/page-NNNN.md'
66
+ entries in read order. Each page uses the same closed three-column table and
67
+ has no page index. Read listed pages before this root table. Append new rows
68
+ only to this root, which has no line limit; never append to a page. No row
69
+ moves between files.
42
70
 
43
71
  -->
44
72
 
@@ -46,5 +74,5 @@ procedure in the SDD triage reference.
46
74
 
47
75
  ## Decisions
48
76
 
49
- | ID | Content | Approach | Status |
50
- | --- | ------- | -------- | ------ |
77
+ | ID | Content | Approach |
78
+ | --- | ------- | -------- |
@@ -1,19 +1,23 @@
1
1
  <!--
2
- Each row records one open question. After a row is added, only its Status
3
- changes. Status is TODO, WIP, DONE, DEFERRED, `DONE (by DEC-NNNN)` or
4
- `SUPERSEDED (by DEC-NNNN)`.
2
+ Each row records one open question, and exists exactly while the question is
3
+ open. A row is never edited.
5
4
 
6
- When a decision row answers the question, set `DONE (by DEC-NNNN)`, naming that
7
- row. When a decision makes what the row states wrong before the question is
8
- answered, set `SUPERSEDED (by DEC-NNNN)` and append a new row for the question
9
- that remains. A reader of the row then finds the decision that overrides its
10
- text. Validation reports a named decision that no decisions row declares,
11
- and warns on a plain DONE, because it names no decision.
5
+ A new row's ID is OQ-yyyymmddhhMMss: the UTC time the row is written, as 14
6
+ digits. When a row of this register already holds that second, take the next
7
+ second no row holds. A legacy OQ-NNNN row keeps its ID.
8
+
9
+ When a decision settles a question, the same change appends the decision row
10
+ to decisions.md, naming this row's ID, and deletes this row. To defer a
11
+ question already written, delete its row and append a new one whose Approach
12
+ names the next decision point and says `Replaces OQ-…` with the deleted ID.
13
+ Validation reports a deleted question that no decision row and no question
14
+ row names. A row whose Content opens `Unadjudicated:` is an unanswered
15
+ critical product decision, pending while the row exists.
12
16
  -->
13
17
 
14
18
  # Open Questions
15
19
 
16
20
  ## Open Questions
17
21
 
18
- | ID | Content | Approach | Status |
19
- | --- | ------- | -------- | ------ |
22
+ | ID | Content | Approach |
23
+ | --- | ------- | -------- |
@@ -22,10 +22,8 @@ mode: execution-focused
22
22
 
23
23
  ## /qfai-triage - Requests that end without a tracked change
24
24
 
25
- [DRIFT-PROTOCOL:REQUIRED]
26
-
27
25
  Run the entry check of
28
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
26
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
29
27
  first.
30
28
 
31
29
  This skill answers, closes, splits or hands over a request, or carries out an
@@ -23,10 +23,8 @@ mode: evidence-focused
23
23
 
24
24
  ## /qfai-verify — Quality Gates and Evidence
25
25
 
26
- [DRIFT-PROTOCOL:REQUIRED]
27
-
28
26
  Run the entry check of
29
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
27
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check`
30
28
  first.
31
29
 
32
30
  ## Inputs
@@ -91,7 +89,7 @@ When declaring DONE, include:
91
89
  - any gap left open, stated rather than hidden.
92
90
 
93
91
  Open questions that place a **new obligation on the product** are routed to
94
- the owner phase (`/qfai-sdd`) as an advisory / Change Request proposal per
92
+ the owner phase (`/qfai-sdd`) as an advisory / proposed specification change per
95
93
  `.qfai/assistant/rule/drift-protocol.md#reviewer-originated-obligations`.
96
94
  Questions about this skill's own inputs or settings stay in its own output for
97
95
  the user to answer. This skill does not write `open-questions.md`.
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Verdict file
12
12
 
13
- `/qfai-verify` MUST write `.qfai/report/verify.json` at the end of the run. This file is the machine-readable verdict; the stage report is the human-readable account. No `qfai` command reads it, so an absent `verify.json` does not fail `npx qfai validate`.
13
+ `/qfai-verify` writes `.qfai/report/verify.json` at the end of the run. This file is the machine-readable verdict; the stage report is the human-readable account. No `qfai` command reads it, so an absent `verify.json` does not fail `npx qfai validate`.
14
14
 
15
15
  Canonical path: `.qfai/report/verify.json`. Create the `.qfai/report/` directory if absent — it is the same directory `validate.json` is written to.
16
16
 
@@ -15,8 +15,6 @@ QFAI Skill Body (SSOT)
15
15
 
16
16
  ## /web-research — Web Research Pipeline
17
17
 
18
- [DRIFT-PROTOCOL:REQUIRED]
19
-
20
18
  ## User Questions (AskUserQuestion Protocol)
21
19
 
22
20
  Follow `.qfai/assistant/rule/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`.
@@ -26,7 +24,7 @@ Skill-specific examples:
26
24
  - HITL gate confirmation
27
25
  - research scope and depth decisions
28
26
 
29
- ## Sub-agent Delegation (MANDATORY)
27
+ ## Sub-agent Delegation
30
28
 
31
29
  Follow `.qfai/assistant/rule/shared-skill-delegation-baseline.md`.
32
30
  The sections below add only pipeline-specific detail; where they and the
@@ -43,18 +43,18 @@ any existing file unchanged; skip this step for it.
43
43
  of a missing file, a pack that records no design direction leaves the brand
44
44
  unchosen. Brand intent is `hard-required`: ask for it, and under `--auto`
45
45
  stop and name it. Never adopt the sample design. For an existing valid file,
46
- validation and authorized repairs that preserve its brand and tokens
46
+ validation and triaged repairs that preserve its brand and tokens
47
47
  require no new brand selection. A brand or token change needs the
48
- authorization and source values in step 2.
48
+ triaged change and source values in step 2.
49
49
  2. **Bound an existing-file repair.** Write a missing file from the recorded
50
50
  direction. For an existing file, SDD triage must name its exact path and the
51
- requested change, and a new WIP change request must authorize both. Apply
52
- only the authorized change; preserve existing brand and tokens unless their
53
- change is authorized and supported by recorded direction or named theme
54
- values. Stop without writing unsupported values. Without that authorization,
55
- validate the existing file without an overwrite; an inherited DONE row
56
- authorizes no new change. An unreplaced sample is refused.
57
- 3. **Author a missing file or the authorized fields of an existing file**,
51
+ requested change; that names the triaged change. Apply
52
+ only the triaged change; preserve existing brand and tokens unless the
53
+ user decided their change and it is supported by recorded direction or named
54
+ theme values. Stop without writing unsupported values. Without a triaged
55
+ change, validate the existing file without an overwrite. An
56
+ unreplaced sample is refused.
57
+ 3. **Author a missing file or the triaged fields of an existing file**,
58
58
  following
59
59
  `.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md#output-mapping`:
60
60
  the intent fields first, then the archetype, then `brand.theme`, then the
@@ -9,7 +9,7 @@ requires: []
9
9
 
10
10
  The calling step names the gate and the scope. This step resolves the command,
11
11
  runs it and records what happened. Where a command comes from is
12
- `.qfai/assistant/rule/shared-skill-operating-baseline.md#standard-commands-mandatory`,
12
+ `.qfai/assistant/rule/shared-skill-operating-baseline.md#standard-commands`,
13
13
  and how a failure is handled is
14
14
  `.qfai/assistant/rule/shared-skill-operating-baseline.md#gate-failure-autorepair-protocol`.
15
15
  Neither is restated here.
@@ -24,7 +24,7 @@ Neither is restated here.
24
24
  - `qfai.config.yaml` for `paths.contractsDir`, `paths.outDir` and the test
25
25
  globs.
26
26
  - The launcher the preflight established, for a qfai command
27
- (`.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher-mandatory`).
27
+ (`.qfai/assistant/rule/shared-skill-operating-baseline.md#canonical-qfai-launcher`).
28
28
  - `.agents/rules/temporary-files.md`, when this step writes captured output or a script to a
29
29
  file.
30
30
  - `.agents/rules/api-budget.md`, when this step reads CI state or the project's items through
@@ -35,10 +35,10 @@ reports what it settled in its final report.
35
35
  A settled decision is written where the story tree keeps it. Adopt a supported
36
36
  recommendation in the appropriate `decisions.md` row or in the authored
37
37
  artifact. Record an unresolved choice in `open-questions.md` with its next
38
- action. Record a rejected option as a REJECTED decision row, so it stays
39
- excluded on reruns.
38
+ action. Record a rejected option as a decision row whose Content opens `Declined:`, so
39
+ it stays excluded on reruns.
40
40
 
41
- Each decision record carries the four labelled Approach items stated at the top of
41
+ Each decision record is a short decision record in the form stated at the top of
42
42
  `.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md`.
43
43
 
44
44
  ## One session
@@ -9,7 +9,7 @@ requires: []
9
9
 
10
10
  Design, tests and code fit a project only when its facts are current. The
11
11
  contract this step serves is
12
- `.qfai/assistant/rule/workflow.md#policy-check-mandatory`:
12
+ `.qfai/assistant/rule/workflow.md#policy-check`:
13
13
  it runs once per run, at the start, and no affected work continues on stale policy.
14
14
  The ultra-light routes `answer-in-session` and `run-operation` do not run it.
15
15
 
@@ -40,9 +40,11 @@ them; it is the procedure that applies them.
40
40
  this route or its pull request covered its commits. A resolution that adds
41
41
  content neither side had is not conflict-only. The stage report names the
42
42
  merge and why no reviewer ran. In the `resolve-conflicts` route, a
43
- resolution that touches a story-tree file, a contract, or `decisions.md` or
44
- `open-questions.md` is not exempt: it gets the code review, and
45
- `architecture-reviewer` too for a contract. A parent skill invoked by name
43
+ resolution that touches a story-tree file or a contract is not exempt: it
44
+ gets the code review, and `architecture-reviewer` too for a contract. A
45
+ conflict confined to `decisions.md`, its pages and `open-questions.md` is
46
+ resolved by merging the base, whose union merge keeps both sides' rows; that
47
+ merge edits no row and gets no reviewer. A parent skill invoked by name
46
48
  uses the reviewers its own `## Review` section names, such as `qfai-discussion`'s.
47
49
 
48
50
  In a route, a code review whose target replaces at most five lines, a
@@ -73,7 +75,7 @@ them; it is the procedure that applies them.
73
75
  1. **Build the request.** Name the scope, the target files and the review
74
76
  focus. Put the answers an earlier stage recorded on the same artifact into
75
77
  this review's request before dispatching reviewers, under
76
- `.qfai/assistant/rule/review-convergence.md#answered-demands-must`.
78
+ `.qfai/assistant/rule/review-convergence.md#answered-demands`.
77
79
  For the code review, name each test the run recorded `red: ci-deferred`:
78
80
  the reviewer reads it against the code before the fix and confirms that
79
81
  its assertion fails there
@@ -83,13 +83,13 @@ Where each outcome is recorded is
83
83
  The default user session reaches four of the five endings. An explicitly
84
84
  delegated discussion may also end `adopted` under the master's conditions:
85
85
 
86
- | Ended | What the user did | Authoring |
87
- | ------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
- | `confirmed` | Confirmed on the session's own condition: no node open — the frontier empty **and** no fact lookup still running | Starts |
89
- | `user-closed` | Said `proceed`, `done`, or words to that effect | Starts. Lookups already running are finished and each decision still open becomes a labelled assumption, except one a document requires the user to make and record |
90
- | `adopted` | Explicitly delegated judgment for this scope | Starts only after the recorded delegation conditions are met; no open node, lookup or unsupported human decision remains |
91
- | `no-question` | Nothing — `--auto` reached nobody | Starts. Every node still open is registered — a decision, and a fact only the user holds, which nothing else can supply, and the open count is then what blocks completion |
92
- | `stopped` | Said `stop` | **Does not start.** Report every open decision as open and end the run |
86
+ | Ended | What the user did | Authoring |
87
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | `confirmed` | Confirmed on the session's own condition: no node open — the frontier empty **and** no fact lookup still running — and a clean confirmation-sheet reply (`grilling.md` § The confirmation sheet) | Starts |
89
+ | `user-closed` | Said `proceed`, `done`, or words to that effect | Starts. Lookups already running are finished and each decision still open becomes a labelled assumption, except one a document requires the user to make and record |
90
+ | `adopted` | Explicitly delegated judgment for this scope | Starts only after the recorded delegation conditions are met; no open node, lookup or unsupported human decision remains |
91
+ | `no-question` | Nothing — `--auto` reached nobody | Starts. Every node still open is registered — a decision, and a fact only the user holds, which nothing else can supply, and the open count is then what blocks completion |
92
+ | `stopped` | Said `stop` | **Does not start.** Report every open decision as open and end the run |
93
93
 
94
94
  **No ending authorizes authoring while a `hard-required` input this invocation
95
95
  consumes is missing.** Those are excluded from both assumption paths: an