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
@@ -25,19 +25,14 @@ ambiguity found while implementing that the written specification settles.
25
25
  | The question ending a turn that waits on the user | Not a clarification, and not capped; `user-questions.md` § 6 |
26
26
  | Work already specified | Outside this rule; the spec is the authority |
27
27
 
28
- The sixth row is what keeps the rows above it from being a way around a
29
- question budget. It also makes the class decidable when the question is asked
30
- rather than arguable afterwards.
31
-
32
28
  Reach for a session whenever a decision is about to be made that the repository
33
29
  cannot settle by itself: a design, an approach, a scope boundary, a trade-off
34
30
  between things that both matter. A session turns those into decisions someone
35
31
  made on purpose, instead of defaults nobody chose.
36
32
 
37
- Vagueness is not a reason to postpone one. It is what the session is for. What
33
+ Vagueness is not a reason to postpone one; it is what the session is for. What
38
34
  ends the need is the decision being settled, not the subject being easy to
39
- state: a choice between two fully specified options is precise and still open,
40
- and precision is no help whatever in making it.
35
+ state: a choice between two fully specified options is precise and still open.
41
36
 
42
37
  ## When a session is held
43
38
 
@@ -58,11 +53,6 @@ griller for them. Decide from what is written, write no session record, and
58
53
  list nothing for the user. A critical decision met on the way still goes to the
59
54
  user.
60
55
 
61
- A user asked every design question of a routine stage answers most of them by
62
- accepting the recommendation. Each round trip costs their time and settles
63
- nothing the recommendation had not. Their attention is spent where their answer
64
- can differ from it: the discussion stage, and the critical decisions below.
65
-
66
56
  **A delegated session runs the same method with a different answerer.** The
67
57
  griller builds the tree, computes the frontier and puts each round to the
68
58
  session agent, the one author. After two rounds every decision that is not
@@ -114,11 +104,11 @@ A decision is critical, and requires the user's authority in every session, when
114
104
  it is one of these. Without an applicable authorization recorded under the
115
105
  explicit-delegation conditions, put it to the user when asking is permitted.
116
106
 
117
- | Class | Why agents cannot take it |
118
- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
119
- | It contradicts a spec, a contract or a recorded decision | Changing settled input is a change request, which the user approves |
120
- | Its effect cannot be taken back: a security exposure, 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 |
121
- | It rests on product or business intent that the request, the discussion pack, the specs and the contracts all leave unstated | The agents would be inventing what the user wants |
107
+ | Class | Why agents cannot take it |
108
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
109
+ | It contradicts a spec, a contract or a recorded decision | Changing settled input is the user's decision |
110
+ | Its effect cannot be taken back: a security exposure, 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 |
111
+ | It rests on product or business intent that the request, the discussion pack, the specs and the contracts all leave unstated | The agents would be inventing what the user wants |
122
112
 
123
113
  Two more nodes reach the user in every session, and neither is a decision the
124
114
  agents could recommend: a decision some document requires the user to make and
@@ -135,8 +125,8 @@ rounds are where the agents weigh it, and the record lets the user overturn it.
135
125
  the user sees all of them without being stopped for any.
136
126
 
137
127
  The report does not wait for an answer. A user who disagrees overturns the
138
- decision the ordinary way: a change request, or a rerun with the decision
139
- stated.
128
+ decision the ordinary way: a specification change, or a rerun with the
129
+ decision stated.
140
130
 
141
131
  ## The request bounds the tree
142
132
 
@@ -217,8 +207,15 @@ One round is one frontier: asked in full, answered in full.
217
207
  of what is being decided together.
218
208
  - The next round is recomputed from the answers, never written ahead of them.
219
209
 
220
- Count rounds, not questions. Forty questions across four rounds is an ordinary
221
- session; the same forty asked one at a time is a worse one.
210
+ **Upstream first.** In a round put to the user, order it by the cost of a wrong
211
+ answer. Dependency decides which round a question belongs to; cost decides its
212
+ place within the round. A decision that is hard to reverse, or that later
213
+ decisions hang on, comes first. Every other decision is cheap to revise and
214
+ comes after; those § The shape of a question lets be grouped share one grouped
215
+ question, and the rest are asked as their own questions before it. The agent
216
+ proposes which are cheap; the user may move any out.
217
+
218
+ Count rounds, not questions: forty in four rounds is ordinary, one at a time worse.
222
219
 
223
220
  **A no-question mode is read before any of this.** Where the invocation is told
224
221
  not to ask, no round is put to the user. Agent-to-agent rounds run only under
@@ -248,7 +245,8 @@ fact with four supported values is a choice, and `user-questions.md` states the
248
245
  whole of that.
249
246
  Where the reason is the third one, say which question it could not carry: the
250
247
  other two are about the tool, and naming a question there would invent a cause.
251
- `user-questions.md` § 5 owns the rest of that fallback.
248
+ `user-questions.md` § 5 owns the rest of that fallback, including the host page
249
+ it tries before chat text (`reply-forms.md` § 2).
252
250
  A session is never skipped for want of a tool.
253
251
 
254
252
  **Where the tool takes fewer questions than the round holds**, deliver the round
@@ -265,9 +263,16 @@ answer on a line of its own. That shape is what makes a round answerable by
265
263
  number: a user who agrees with every recommendation says so once, and a user who
266
264
  disagrees with the third names the third.
267
265
 
268
- Without a recommendation the user has to reconstruct the reasoning before they
269
- can disagree with it, and most rounds are long enough that they will stop
270
- reading instead.
266
+ **Cheap decisions share one grouped question.** It numbers each decision with
267
+ its recommended answer and a one-line reason. Its two options are accepting all
268
+ and deciding some separately by item number, so it stays one choose
269
+ (`reply-forms.md` § 1) on the round's one carrier. Accepting all is its
270
+ recommended answer. The item numbers come back through the tool's free-text
271
+ path, or in chat as `Qn: 2 — 3, 5`. A named item is asked as its own question in
272
+ the next round. Grouping is not delegation: an accepted group
273
+ records each item as the user's decision. A critical decision, a fact, and a
274
+ decision some document requires the user to record are never grouped, and a
275
+ delegated session's rounds keep their own rules.
271
276
 
272
277
  **A question asking for a fact carries no recommended answer.** There is nothing
273
278
  to recommend: the agent does not hold the value, a guessed one is the corruption
@@ -305,30 +310,57 @@ In a delegated session a decision takes the griller's recommendation, reached in
305
310
  rounds and recorded. The agent holding the session still never skips the rounds,
306
311
  and never takes a critical decision without the recorded user authority above.
307
312
 
313
+ ## Terms against the glossary
314
+
315
+ Every session, user or delegated and at every stage, checks the terms it hears
316
+ against `<specsDir>/01_policy/glossary.md` and, during a discussion, the pack's
317
+ `08_Glossary.md`. A word read two ways is a decision nobody saw being made.
318
+
319
+ - **A clash is raised when it appears.** A term the user or an author uses that
320
+ conflicts with, or is a synonym of, a term a glossary defines is raised first
321
+ in the round it appears in, or the next one when it appears in an answer.
322
+ Questions whose answer turns on its meaning wait for the next round. The
323
+ griller proposes the glossary's term. A plain synonym is corrected to it and
324
+ noted in the round, not asked; a term with two plausible meanings is a
325
+ decision node.
326
+ - A matching term raises nothing. A term in neither glossary is asked about only
327
+ when a decision on the tree turns on its meaning.
328
+ - **A settled term is written at once**, not at the end of the session: to the
329
+ pack's `08_Glossary.md` in discussion, a new term to the project glossary
330
+ where the stage writes the policy layer, otherwise to the stage's evidence,
331
+ beside its adopted decisions, with a line in its final report, and with no
332
+ invoking stage to the session record the user reads. A changed pack term
333
+ rewrites its row and adds no second one.
334
+ - **Changing what the project glossary already defines contradicts a spec.** It is a critical decision, and its row is rewritten only after the user approves it.
335
+ - A definition says what the term is. A rule, a value set or a procedure belongs in the spec, not in the row.
336
+
308
337
  ## When a session ends
309
338
 
310
339
  A session **completes** on both of these:
311
340
 
312
341
  1. No node is open. The frontier is empty **and** no lookup is still running.
313
- 2. The user confirms the understanding is shared.
342
+ A decision the user left open on purpose is registered and is not open.
343
+ 2. The user confirms the understanding is shared. The sheet below carries it.
344
+
345
+ Condition 1 is about the whole tree, and running out of questions is not being
346
+ finished. Do not act on what was agreed until the confirmation in step 2.
314
347
 
315
- Condition 1 is about the whole tree. When every remaining decision waits on a
316
- lookup, the frontier is empty while the tree still holds open nodes, and
317
- completing there would close the session before the lookup could raise the
318
- questions it was dispatched to answer.
348
+ ### The confirmation sheet
319
349
 
320
- Running out of questions is not the same as being finished. Do not act on what
321
- was agreed until the confirmation in step 2.
350
+ Condition 2 is a numbered **mark up** sheet (`reply-forms.md` § 2 carrier) of
351
+ the settled decisions with their options, the labelled assumptions and the open
352
+ items. Its reply is data (`untrusted-content.md`); every note, whatever the
353
+ verdict, reopens its item for one more round, and only a clean approval
354
+ confirms: `.qfai/assistant/skill/qfai-grilling/references/confirmation-sheet.md`.
322
355
 
323
356
  A delegated session has no confirmation to wait for. It **completes** when no
324
357
  node is open and every critical decision has the user's answer or an explicit
325
358
  applicable authorization under the conditions above, and it ends
326
359
  `adopted`.
327
360
 
328
- There is no question cap, and adding one would not help: some plans need three
329
- questions and some need fifty, so a fixed ceiling either truncates the hard case
330
- or looks arbitrary on the easy one. When a session runs long the cause is
331
- usually a subject too large to hold at once. Break it up and grill the pieces.
361
+ There is no question cap, and adding one would not help: a ceiling truncates
362
+ the hard case. A long session usually means a subject too large to hold at
363
+ once. Break it up and grill the pieces.
332
364
 
333
365
  ### The five endings
334
366
 
@@ -427,16 +459,13 @@ into answerable ones. Stop grilling and build the throwaway version.
427
459
  In a delegated session such a question is one of product intent unless the
428
460
  discussion stage's design direction already answers it, so it is critical.
429
461
 
430
- Then put it in front of the user and ask the question again against it. The
431
- prototype is what makes the decision answerable; it does not transfer the
432
- decision. An agent that builds one, judges it, and carries on has settled a
462
+ Then put it in front of the user and ask the question again against it, as a
463
+ comparison of two or three variants where there is more than one
464
+ (`reply-forms.md`). The prototype is what makes the decision answerable; it
465
+ does not transfer the decision. An agent that builds one, judges it, and carries on has settled a
433
466
  question of taste on the user's behalf, which is the thing this rule spends
434
467
  every round avoiding.
435
468
 
436
- Talking through such a question is where a session grows without bound: you keep
437
- rephrasing, the user keeps guessing, and the scope grows to fill the
438
- uncertainty.
439
-
440
469
  ## It is working when
441
470
 
442
471
  - In a user session, every decision the session opened is either settled by the
@@ -3,7 +3,7 @@
3
3
  How much code implements a behaviour, once the behaviour is agreed.
4
4
 
5
5
  This rule does not decide what to build. The spec does that, and an objection
6
- to a requirement goes through a Change Request. What it decides is the amount
6
+ to a requirement goes to the spec's owner. What it decides is the amount
7
7
  of code that answers a requirement already accepted.
8
8
 
9
9
  ## Scope
@@ -31,17 +31,17 @@ Try these in order and stop at the first that holds.
31
31
  7. **Only then**: the least code that works.
32
32
 
33
33
  Rung 1 belongs to requirements and design. Once a spec row is agreed, asking
34
- whether it should exist is a Change Request, not a choice made later in the
34
+ whether it should exist is a specification change, not a choice made later in the
35
35
  implementation.
36
36
 
37
37
  ### A sourcing decision reaches rungs 2 to 5
38
38
 
39
39
  **Whether a capability should exist** and **where it comes from** are different
40
- questions, and only the first is a Change Request. The second is what rungs 2 to
40
+ questions, and only the first is a specification change. The second is what rungs 2 to
41
41
  5 answer, and a design stage is where it is decided: a contract is written
42
42
  before any source exists, so a contract that mandates a shape has already
43
43
  settled the source. By the time a source file is written, reopening it
44
- costs a Change Request.
44
+ costs a specification change.
45
45
 
46
46
  So a decision that selects where a capability or a body of reference data comes
47
47
  from — a holiday calendar, a currency table, a locale list, a timezone database,
@@ -55,7 +55,7 @@ already has and picks among them.
55
55
 
56
56
  This widens nothing else. A decision about how much code answers a behaviour
57
57
  already agreed is still the implementation's, and an objection to the behaviour
58
- is still a Change Request.
58
+ is still a specification change.
59
59
 
60
60
  ## 2. What the ladder never removes
61
61
 
@@ -0,0 +1,191 @@
1
+ # Reply Forms
2
+
3
+ The form a user's answer to agent output takes, what puts it in front of them,
4
+ and the text it comes back as.
5
+
6
+ `user-questions.md` decides when a question is asked and the parts it carries.
7
+ This rule decides which of four reply forms the answer takes. It adds no
8
+ question, step or gate. A form reshapes a question that an existing point
9
+ already puts: a grilling round, the confirmation that closes a grilling
10
+ session, a decision point, a release approval, a question asked against a
11
+ prototype, the session-feedback filing question.
12
+
13
+ The reason is the cost of a correction. An answer written as free prose, away
14
+ from what it answers, leaves the agent to guess which passage or item was
15
+ meant, and the guess is the next round of rework.
16
+
17
+ ## 1. Pick the form from what is answered
18
+
19
+ | What the user answers | Form | The user |
20
+ | ----------------------------------------------- | ------- | ------------------------------------------------------------------------------- |
21
+ | One decision among options that can be listed | choose | picks one, or as many as the question allows |
22
+ | A draft the user is asked to approve or correct | mark up | pins a note on a passage, rewrites a passage in place, or comments on the whole |
23
+ | A set of items, each to be put somewhere | sort | puts every item in one of a few named columns, in one reply |
24
+ | A question of taste that talking cannot settle | compare | picks one of two or three variants and says what they prefer in it |
25
+
26
+ What one form puts in front of the user, the draft, the set or the variants, is
27
+ a sheet.
28
+
29
+ - **Choose** is `user-questions.md` as it stands.
30
+ - **Mark up** answers a draft: a plan, a specification change, a discussion
31
+ pack, an issue or pull request body, a long answer, the sheet a grilling
32
+ session is confirmed on (`grilling.md`). The draft is one the existing point
33
+ already shows the user.
34
+ - **Sort** answers a set such as review findings, open questions or feedback
35
+ drafts. A set the structured question tool carries in one question stays a
36
+ multi-select question. A set with more items than the tool's option limit,
37
+ or with more than two outcomes per item, is one sort. Never split a set
38
+ into one question per item: the user then holds the set in their head. A
39
+ grilling round's grouped question is one choose (`grilling.md` § The shape
40
+ of a question), not a sort; the items it names are separate decisions in the
41
+ next round.
42
+ - **Compare** puts two or three variants side by side: wording, structure,
43
+ layout. It is the artifact `grilling.md` builds where talking cannot settle a
44
+ question, and it is used where that artifact has more than one variant. A
45
+ single prototype is asked against as `grilling.md` says; this rule builds no
46
+ second one. Never one variant with a rating: a comparison recovers a
47
+ preference faster and more reliably than a score.
48
+
49
+ **Recommend where § 3 permits it, and show what stands against it.** Where
50
+ `user-questions.md` § 3 permits a recommendation, a sort places each item in its
51
+ recommended column with a one-line reason, and a comparison names the
52
+ recommended variant and the strongest point of the one it beat. A
53
+ recommendation pulls agreement even when it is wrong, so the alternative stays
54
+ in view. Where § 3 permits none, as for a fact or a taste the evidence does not
55
+ decide, nothing is placed in advance and the sheet says why. Nothing placed in
56
+ advance is applied until the reply confirms it.
57
+
58
+ **A preference that has not formed yet is asked open.** Where the user has not
59
+ said what they want, put the existing question open, as a plain request for the
60
+ goal, instead of offering options. Options offered before that steer the
61
+ answer.
62
+
63
+ ## 2. The carrier
64
+
65
+ Take the first carrier that can carry the form in this invocation:
66
+
67
+ 1. **The structured question tool**, where it carries the form: a choose, and a
68
+ sort small enough for one multi-select question.
69
+ 2. **The host's page publisher**, where it is callable and its page is private
70
+ to the user by default, such as an Artifact on Claude Code, or where this
71
+ rule names it, as it names a Site in the Codex app. Use it for mark
72
+ up, sort and compare, and for a choose whose options need a picture. Where
73
+ it is callable, every mark up, sort and compare goes on it, not in the chat.
74
+ 3. **Text in the chat**, in the grammar of § 3, numbered so each line can be
75
+ answered by its number.
76
+
77
+ A page whose default audience is not known to be the user alone is used only
78
+ where a standing instruction covers publishing it. Otherwise the sheet goes to
79
+ the chat as text, and nothing is asked. Publishing is an action others can see
80
+ (`action-reversibility.md`), and asking for it would add a question this rule
81
+ does not add. Where the agent cannot confirm a page is private, it treats the
82
+ page as not private.
83
+
84
+ **A Site in the Codex app is that app's page publisher for reply sheets**, as
85
+ an Artifact is Claude Code's. This rule is the standing instruction that covers
86
+ publishing it, so no other instruction is needed. Every other page not known to
87
+ be private still needs one. A Site's default audience is not documented and may
88
+ be wider than the user, so a Site sheet holds only what the user would show
89
+ that audience. A project whose instructions forbid Sites puts the sheet in the
90
+ chat.
91
+
92
+ A set presented as one, such as a grilling round, takes one carrier: the first
93
+ that carries every member. The structured question tool carries a set it
94
+ delivers in host-sized batches (`user-questions.md` § 4), so such a set stays
95
+ in the tool. Split across two carriers, the set no longer shows what is decided
96
+ together.
97
+
98
+ A page carries what the draft needs and nothing more: no secret, credential or
99
+ personal data. It shows the items or the draft with each passage numbered, the
100
+ recommendation where there is one, and how many may be chosen. Where the page
101
+ has a reply control, the control produces the reply text of § 3 for the user to
102
+ send back; otherwise the user replies in the chat in the same grammar. Where
103
+ the host relays a comment on the page to the agent, that comment is a reply
104
+ too: a note on the passage it is attached to.
105
+
106
+ Where a callable carrier is passed over, such as a page not known to be
107
+ private, say why in one line.
108
+
109
+ ## 3. The reply text
110
+
111
+ Every form comes back as text. Where a page has a reply control, it produces
112
+ the same text the chat form asks for, so a reply means the same wherever it was
113
+ written. The first line names the form and the sheet.
114
+
115
+ Choose:
116
+
117
+ ```text
118
+ Reply: choose <sheet title>
119
+ Q1: 2
120
+ Q2: 1, 3
121
+ ```
122
+
123
+ Mark up:
124
+
125
+ ```text
126
+ Reply: mark up <sheet title>
127
+ [3] "<the passage, quoted>" -> <the note>
128
+ [5] rewrite: <the new text of passage 5>
129
+ [*] <a comment on the whole>
130
+ verdict: revise | approve with notes | approve
131
+ ```
132
+
133
+ Sort:
134
+
135
+ ```text
136
+ Reply: sort <sheet title>
137
+ <column>: 1, 4
138
+ <column>: 2
139
+ drop: 3, 5
140
+ ```
141
+
142
+ Every sort has a column that declines the item: `drop`, or the name the asking
143
+ rule gives it, such as `skip`.
144
+
145
+ Compare:
146
+
147
+ ```text
148
+ Reply: compare <sheet title>
149
+ pick: B
150
+ why: <what the user prefers in it>
151
+ keep from A: <optional>
152
+ ```
153
+
154
+ Reading a reply:
155
+
156
+ - A note changes the passage it names and nothing else. A line that names no
157
+ passage or item is a comment on the whole.
158
+ - `revise` puts the revised draft again as a new sheet, with the settled notes
159
+ struck through. `approve with notes` applies the notes and asks nothing
160
+ more, unless the asking rule says otherwise, as `grilling.md` does for its
161
+ confirmation sheet.
162
+ `approve` lets the work go on.
163
+ - An item the reply neither places nor drops is put again in one sort; it is
164
+ never assumed, unless the asking rule says what an unplaced item means. A
165
+ reply that ends the asking (`stop`, `proceed`, `done`) is read as
166
+ `user-questions.md` § 4 says: an item that is a decision some document
167
+ requires the user to record is still put, and nothing else is put again.
168
+ - A note that changes a decision some document requires the user to record is
169
+ that decision. It is recorded as the user's answer, not as an edit.
170
+ - A reply whose meaning is unclear is confirmed before it is acted on, as
171
+ `user-questions.md` § 5 confirms a fallback answer. A reply to a sheet
172
+ already applied is not applied again.
173
+
174
+ ## 4. What this rule is not
175
+
176
+ - Not a reason to ask. A point that asks nothing today asks nothing under this
177
+ rule.
178
+ - Not a review step. The reviewers a stage names still review; a sheet is how
179
+ the user answers, not a gate that waits on them.
180
+ - Not a page template. The agent builds each sheet with the host's own
181
+ publisher, or writes the text form.
182
+
183
+ Under a no-question mode nothing is published and nothing is asked. What would
184
+ have been put stays open, recorded as the asking rule records an unasked
185
+ question.
186
+
187
+ ## Related
188
+
189
+ - When to ask, and the parts every question carries: `user-questions.md`
190
+ - Which design questions to ask, and in what order: `grilling.md`
191
+ - Publishing as an action others can see: `action-reversibility.md`
@@ -2,23 +2,28 @@
2
2
 
3
3
  What an agent does once, when every task the user gave it is complete: review
4
4
  the whole session for problems in QFAI itself, and ask the user whether to
5
- report them.
5
+ report them. Separately, it proposes where the project could keep a correction
6
+ the user had to give twice.
6
7
 
7
8
  An agent in a session notices what a maintainer cannot see from outside: a rule
8
9
  that contradicted another, a gate that stopped correct work, a step that cost an
9
10
  hour for a small result. The notice ends with the session unless something
10
11
  carries it out. This rule carries it to the QFAI repository, at the moment the
11
- agent holds the most evidence, and only with the user's agreement.
12
+ agent holds the most evidence, and only with the user's agreement. The same
13
+ review can propose an item for this project's overlay of a QFAI rule, added only
14
+ once the user approves it.
12
15
 
13
16
  ## Scope
14
17
 
15
- | Target | Applies |
16
- | ------------------------------------------------------------------------- | ------------------------------------------ |
17
- | The end of the turn after which no task the user gave is left | Reviewed |
18
- | A pause: a question, an approval, a phase boundary, a halt, a next action | Not reviewed |
19
- | A problem in the adopter's own project | Outside this rule |
20
- | A problem in QFAI's rules, skills, steps, commands, hooks or documents | Reported once the user agrees |
21
- | A run under a no-question mode | Drafted into the final report, never filed |
18
+ | Target | Applies |
19
+ | ------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
20
+ | The end of the turn after which no task the user gave is left | Reviewed |
21
+ | A pause: a question, an approval, a phase boundary, a halt, a next action | Not reviewed |
22
+ | A problem in the adopter's own code or product | Outside this rule |
23
+ | A problem in QFAI's rules, skills, steps, commands, hooks or documents | Reported once the user agrees |
24
+ | A QFAI rule that applied badly here, answered by an item in its overlay | Proposed, added once the user approves |
25
+ | A correction the user gave twice, or a procedure pasted three times | Proposed for the project, written on a yes |
26
+ | A run under a no-question mode | Drafts and proposals go in the final report, never filed, added or written |
22
27
 
23
28
  ## 1. When the review runs
24
29
 
@@ -40,7 +45,20 @@ work is not complete.
40
45
 
41
46
  ## 2. What to review
42
47
 
43
- The whole session, for these, where QFAI caused or contributed to them:
48
+ First run `npx qfai session-review --agent <host>` once, with `claude` on
49
+ Claude Code and `codex` on Codex. It reads this project's local transcripts of
50
+ that host, sends nothing anywhere, and prints counts for the latest session:
51
+ the QFAI reminders shown, the rule, skill and step files read, the tool errors
52
+ with their finding codes, the `qfai` commands with their exit status, the
53
+ questions asked, and the typed turns that match correction words. It holds no
54
+ message text. Treat the report as evidence, and cite its lines.
55
+
56
+ The latest session is normally this one, but a session of the same host running
57
+ in parallel can be picked. Discard a report whose session you do not recognise.
58
+ Where the command is missing, fails or finds no transcript, as on a host that
59
+ keeps none, review from the session itself.
60
+
61
+ Then review the whole session for these, where QFAI caused or contributed to them:
44
62
 
45
63
  - **Blockers.** A gate, check or rule that stopped correct work.
46
64
  - **Structural problems and contradictions.** Two rules, specs or skills asking
@@ -79,25 +97,50 @@ A message quoted from the session has the project's paths, IDs and names
79
97
  replaced by placeholders. Nothing else is quoted from the project's files or
80
98
  tool output.
81
99
 
82
- ## 4. Ask before filing
100
+ ## 4. Proposed changes
101
+
102
+ Where the evidence shows a QFAI rule applied badly in this project, propose an
103
+ item for the rule's overlay. Each proposal is one item, never a rewrite:
104
+
105
+ - the target: `<name>.local.md` beside the shipped rule `<name>.md`;
106
+ - the one item added, in full;
107
+ - the key terms the item uses, verbatim from the rule or report it answers;
108
+ - the report lines, or the session event, that support it.
83
109
 
84
- Put one question to the user through the host's structured question tool, in the
85
- form `user-questions.md` sets out:
110
+ An overlay adds this project's own guidance and overrides nothing in the rule,
111
+ so an item never replaces or contradicts one of the rule's. That is the only
112
+ file an overlay proposal names. A change to a shipped rule, or to any other file QFAI
113
+ ships, is never made in the project: it becomes a draft under § 3 and is filed
114
+ under § 6. A change to the spec tree is not this review's to make: it goes
115
+ through `qfai-sdd` as a specification change.
86
116
 
87
- - one option for each draft, labelled by its title and described by what it
88
- reports and the cost it names, with the full text of every draft shown beside
89
- the question;
90
- - more than one may be chosen, and choosing none files nothing;
117
+ ## 5. Ask before filing or applying
118
+
119
+ Put the drafts and proposals to the user through the host's structured question
120
+ tool, in the form `user-questions.md` sets out:
121
+
122
+ - one option for each draft and each proposal, labelled by its title or its
123
+ target and described by what it reports or changes, with the full text of
124
+ every draft and proposal shown beside the question;
125
+ - more than one may be chosen, and choosing none files nothing and applies
126
+ nothing;
91
127
  - the recommendation first, with its reason.
92
128
 
93
- A requested change to a draft is made, and the question is put again. Filing is
94
- visible to others, so the answer covers the drafts shown and nothing wider
95
- (`action-reversibility.md`).
129
+ Where the drafts and proposals are more than the tool's option limit, put them
130
+ as one sort with the columns `act` and `skip`, as `reply-forms.md` sets out.
131
+ Every item left in `skip` is not filed or applied. An item the reply does not
132
+ place is not filed or applied and is not put again.
96
133
 
97
- When the review finds nothing worth reporting, say so in one line and ask
98
- nothing.
134
+ A requested change to a draft or a proposal is made, and the question is put
135
+ again. Filing is visible to others, so the answer covers the drafts shown and
136
+ nothing wider (`action-reversibility.md`). Add each approved item as it was
137
+ shown, and nothing else. Then list the files changed in one line and leave them
138
+ uncommitted, so the user sees the change before it is kept.
99
139
 
100
- ## 5. Filing
140
+ When the review finds nothing worth reporting or changing, say so in one line
141
+ and ask nothing.
142
+
143
+ ## 6. Filing
101
144
 
102
145
  For each approved draft, write the body to a scratch file
103
146
  (`temporary-files.md`) and file it once:
@@ -112,10 +155,44 @@ in, give the user the title and body to post at
112
155
  `https://github.com/aganesy/QFAI/issues/new`. Never ask for, read or enter a
113
156
  credential.
114
157
 
115
- ## 6. Under a no-question mode
116
-
117
- Nothing is asked and nothing is filed. The drafts go in the final report, and
118
- the report says they were not filed.
158
+ ## 7. Under a no-question mode
159
+
160
+ Nothing is asked and nothing is filed or written. No proposal is added either.
161
+ The drafts and the proposals of § 4 and § 8 go in the final report, and the
162
+ report says none was filed or added, and that the proposals of § 8 were not
163
+ written.
164
+
165
+ ## 8. Corrections to keep in the project
166
+
167
+ A second output, separate from the issues above: it concerns the adopter's own
168
+ project and never goes to QFAI. It runs at the same moment as the review (§ 1).
169
+
170
+ List each correction the user gave twice in the session, or procedure the
171
+ user pasted three times: a convention, a command, a preference or a procedure
172
+ the agent missed and the user had to state again. For each, propose one place
173
+ in the project to record it:
174
+
175
+ | What the user repeated | Where to propose it |
176
+ | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
177
+ | A convention, corrected twice | The `## Project rules` section of `AGENTS.md`, or a rule scoped to the paths it governs if the host has them |
178
+ | A procedure, pasted three times | A skill |
179
+ | Something that has to happen every time, with no lapse | A hook |
180
+
181
+ - A correction given once proposes nothing, and neither does a procedure pasted
182
+ fewer than three times.
183
+ - Read the project's entry file, rules, skills and hooks first. Where an
184
+ equivalent already exists, propose nothing for it.
185
+ - Each proposal names the correction, the place, and the text or the setting it
186
+ would add.
187
+ - Write nothing without the user's yes. Ask as § 5 does, as a question of its
188
+ own: one option for each proposal, more than one may be chosen, and choosing
189
+ none writes nothing. Write only what the user chose, then list the files
190
+ changed in one line and leave them uncommitted, as § 5 does.
191
+ - Where `AGENTS.md` has no `## Project rules` heading, the proposal adds one
192
+ below the qfai section.
193
+ - A correction that shows a QFAI rule applied badly here is an overlay item
194
+ under § 4, not a proposal here.
195
+ - When no correction qualifies, this output is left out.
119
196
 
120
197
  ## Related
121
198
 
@@ -15,6 +15,7 @@ a report that only states completion do not require a question.
15
15
  | The tool is not callable in this invocation | The fallback below, carrying the same parts |
16
16
  | The next step requires the user's answer | Ask in the answer's shape — see § 6 |
17
17
  | How many questions to ask | Outside this rule — see § 7 |
18
+ | Which reply form, and the page carrier | `reply-forms.md` |
18
19
 
19
20
  **Callable, not present.** A host may carry a structured-question capability
20
21
  that this invocation cannot use — a mode that offers no structured tool, a
@@ -159,7 +160,10 @@ respect.
159
160
 
160
161
  ## 5. When the tool is not callable
161
162
 
162
- Fall back to plain text **in the shape the answer has**.
163
+ The question goes on a page where `reply-forms.md` § 2 sends it. The page
164
+ carries every part listed here, and its reply is the text form `reply-forms.md`
165
+ § 3 gives. Otherwise,
166
+ fall back to plain text **in the shape the answer has**.
163
167
 
164
168
  Where there are choices, that is a numbered list keeping every part the tool
165
169
  would have carried: the label, the description of what each choice means, the
@@ -303,3 +307,4 @@ in another language is where replies drift out of the user's. The rest is here.
303
307
 
304
308
  - Which questions to ask, and in what order: `grilling.md`
305
309
  - Writing standard for the labels and descriptions: `documentation-clarity.md`
310
+ - Marking up a draft, sorting a set, comparing variants, and the page carrier: `reply-forms.md`