qfai 2.1.0 → 2.1.2

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 (184) hide show
  1. package/README.md +327 -55
  2. package/assets/defaults/agent-routing/qfai-triage.yml +9 -0
  3. package/assets/defaults/workflows/change-tooling.yml +0 -4
  4. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  5. package/assets/init/.claude/settings.json +27 -9
  6. package/assets/init/.codex/hooks.json +20 -8
  7. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  8. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +14 -1
  9. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  10. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  11. package/assets/init/.qfai/assistant/agent/qa-gatekeeper.md +29 -0
  12. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  13. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  14. package/assets/init/.qfai/assistant/rule/constitution.md +5 -4
  15. package/assets/init/.qfai/assistant/rule/drift-protocol.md +72 -5
  16. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +72 -0
  17. package/assets/init/.qfai/assistant/rule/references/context-summary.md +30 -0
  18. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +42 -0
  19. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +23 -0
  20. package/assets/init/.qfai/assistant/rule/references/host-backstops.md +60 -0
  21. package/assets/init/.qfai/assistant/rule/references/placeholder-scan.md +25 -0
  22. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +41 -0
  23. package/assets/init/.qfai/assistant/rule/references/reviewer-remit.md +35 -0
  24. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  25. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +39 -162
  26. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +14 -145
  27. package/assets/init/.qfai/assistant/rule/stage-cost.md +1 -1
  28. package/assets/init/.qfai/assistant/rule/test-layers.md +42 -0
  29. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +11 -45
  31. package/assets/init/.qfai/assistant/skill/qfai-configure/references/principles.md +25 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +1 -1
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +12 -9
  34. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  35. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/platform_baselines.md +11 -0
  36. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/review_audit_playbook.md +11 -0
  37. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +13 -42
  38. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  39. package/assets/init/.qfai/assistant/skill/qfai-grill/SKILL.md +1 -1
  40. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +16 -88
  41. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +58 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +42 -0
  43. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +17 -4
  44. package/assets/init/.qfai/assistant/skill/qfai-implement/references/credential-reuse.md +9 -0
  45. package/assets/init/.qfai/assistant/skill/qfai-implement/references/cross-spec-ownership.md +41 -0
  46. package/assets/init/.qfai/assistant/skill/qfai-implement/references/oracle-strength.md +6 -1
  47. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  48. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +47 -1
  49. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +4 -3
  50. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +4 -4
  51. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +16 -10
  52. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +10 -260
  53. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  54. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +5 -4
  55. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/design-md-spec.md +14 -5
  56. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +10 -0
  57. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +1 -1
  58. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +3 -4
  59. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +12 -5
  60. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +33 -4
  61. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +34 -36
  62. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  63. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +67 -24
  64. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +246 -5
  65. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +29 -5
  66. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +43 -0
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +5 -4
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +10 -1
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +22 -9
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +41 -6
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +11 -5
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-brand-catalog.md +17 -2
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +10 -2
  74. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +34 -9
  75. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +4 -4
  76. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +2 -2
  77. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +177 -7
  78. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +29 -5
  79. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +130 -1
  80. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -30
  81. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +39 -2
  82. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/db-contract.sample.sql +2 -2
  83. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  84. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/cli/cli-NNNN-title.md +2 -2
  85. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -1
  86. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +7 -0
  87. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +30 -20
  88. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +6 -5
  89. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  90. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +92 -13
  91. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +37 -31
  92. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  93. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  94. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  95. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  96. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  97. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  98. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  99. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +17 -7
  100. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +126 -13
  101. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +3 -2
  102. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +1 -0
  103. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  104. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +12 -4
  105. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  106. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  107. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -1
  108. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  109. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  110. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +3 -3
  111. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  112. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +4 -3
  113. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  114. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  115. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +3 -3
  116. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +9 -6
  117. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +1 -1
  118. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  119. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +42 -6
  120. package/assets/init/.qfai/assistant/step/implement-test-fix/STEP.md +2 -0
  121. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  122. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  123. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  124. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  125. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +1 -3
  126. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  127. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +4 -0
  128. package/assets/init/.qfai/assistant/step/sdd-gate/STEP.md +4 -0
  129. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  130. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +37 -11
  131. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +5 -4
  132. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  133. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  134. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  135. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  136. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  137. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  138. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  139. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  140. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  141. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +9 -5
  142. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +39 -6
  143. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  144. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +10 -2
  145. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  146. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +7 -5
  147. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +136 -28
  148. package/assets/init/.qfai/waivers.yml +1 -1
  149. package/assets/init/root/.agents/rules/ai-readable-markdown.md +98 -0
  150. package/assets/init/root/.agents/rules/api-budget.md +191 -13
  151. package/assets/init/root/.agents/rules/documentation-clarity.md +192 -35
  152. package/assets/init/root/.agents/rules/grilling.md +4 -4
  153. package/assets/init/root/.agents/rules/interface-clarity.md +5 -5
  154. package/assets/init/root/.agents/rules/minimal-implementation.md +11 -3
  155. package/assets/init/root/.agents/rules/reminders.json +27 -14
  156. package/assets/init/root/.agents/rules/session-feedback.md +136 -0
  157. package/assets/init/root/.agents/rules/temporary-files.md +47 -5
  158. package/assets/init/root/.agents/rules/untrusted-content.md +3 -3
  159. package/assets/init/root/.agents/rules/user-questions.md +74 -36
  160. package/assets/init/root/.gitattributes +9 -0
  161. package/assets/init/root/.github/workflows/qfai-docs.yml +44 -12
  162. package/assets/init/root/.github/workflows/qfai-tests.yml +58 -15
  163. package/assets/init/root/.github/workflows/qfai-validate.yml +49 -42
  164. package/assets/init/root/AGENTS.md +23 -21
  165. package/assets/mdschema/story/03_contract/tech.mdschema.yml +7 -3
  166. package/assets/sandbox-templates/default-deny.yaml +9 -5
  167. package/assets/schemas/workflow/extraction.schema.json +85 -5
  168. package/assets/schemas/workflow/plan.schema.json +9 -2
  169. package/assets/scripts/check-mdschema.mjs +172 -5
  170. package/assets/uix-rev/comparison-review.md +1 -1
  171. package/assets/uix-rev/contracts-review.md +1 -2
  172. package/dist/cli/index.cjs +6499 -7688
  173. package/dist/cli/index.cjs.map +1 -1
  174. package/dist/cli/index.mjs +6449 -7641
  175. package/dist/cli/index.mjs.map +1 -1
  176. package/dist/index.cjs +5548 -7823
  177. package/dist/index.cjs.map +1 -1
  178. package/dist/index.d.cts +40 -666
  179. package/dist/index.d.ts +40 -666
  180. package/dist/index.mjs +5397 -7648
  181. package/dist/index.mjs.map +1 -1
  182. package/docs/MIGRATION-2.0.0.md +1 -1
  183. package/package.json +5 -7
  184. package/assets/init/root/CLAUDE.md +0 -45
@@ -1,25 +1,36 @@
1
1
  # Documentation Clarity
2
2
 
3
3
  The writing standard for every AI coding agent in this repository. It covers
4
- pull requests, issues, source-code comments and Markdown files.
4
+ pull requests, issues, source-code comments, Markdown files, and the reports
5
+ and replies an agent writes.
5
6
 
6
7
  Write for a reader who knows neither the background of the change nor the
7
- habits of this team. Keep only what that reader can follow.
8
+ habits of this team. One test decides every clause below: if deleting a
9
+ sentence leaves that reader no worse off, delete it.
10
+
11
+ The clauses describe patterns of structure and meaning, not word lists. They
12
+ hold in any language: the examples are English, and in another language the
13
+ same pattern is rewritten in that language's own words.
8
14
 
9
15
  ## Scope
10
16
 
11
- | Surface | When it applies |
12
- | --------------------------- | ----------------------------- |
13
- | Pull request title and body | On create and on update |
14
- | Issue title and body | On create and on update |
15
- | Comments in source code | Within the diff of the change |
16
- | Markdown files | Within the diff of the change |
17
+ Each surface takes the clauses shown. The clauses run in the order of writing.
18
+
19
+ | Surface | When it applies | Clauses |
20
+ | --------------------------- | ----------------------------- | --------- |
21
+ | Pull request title and body | On create and on update | 2 to 9 |
22
+ | Issue title and body | On create and on update | 2 to 9 |
23
+ | Comments in source code | Within the diff of the change | 1 to 6, 9 |
24
+ | Markdown files | Within the diff of the change | 1 to 7, 9 |
25
+ | Reports and replies | When written | 3 to 9 |
17
26
 
18
27
  Leave everything outside the diff alone. Reformatting unrelated files is a
19
28
  separate change.
20
29
 
21
30
  ## 1. No local identifiers
22
31
 
32
+ A reader outside this repository cannot open an internal reference.
33
+
23
34
  Never write these into source code or Markdown files:
24
35
 
25
36
  - issue and pull-request numbers (`#123`, `GH-123`)
@@ -29,55 +40,200 @@ Never write these into source code or Markdown files:
29
40
  When a reader needs the background, write the background itself in ordinary
30
41
  words instead of pointing at a number.
31
42
 
32
- Pull request and issue bodies are outside this clause. Numbers and links belong
33
- there, and in commit messages and the changelog.
43
+ ### Spec-tree IDs
44
+
45
+ An ID the project's own spec tree defines (a business flow, story, acceptance
46
+ criterion, example, business rule, contract or decision) names a document the
47
+ reader can open in the repository. It is not a local identifier where that
48
+ document is the audience or the target:
49
+
50
+ - a document inside the spec tree;
51
+ - a comment or test annotation in code or tests that points at the contract or
52
+ example the code carries out.
53
+
54
+ It is one wherever the reader has no access to the tree: a setup guide, a
55
+ README or any other document written for operators, and every file the project
56
+ ships (`distributed-surface.md`). Describe the rule in words there.
57
+
58
+ ### Names the reader sees
59
+
60
+ A name the reader meets in the product is not one that only this project
61
+ understands. These may appear in a document written for that reader:
62
+
63
+ - a screen label or button name, exactly as the product shows it;
64
+ - an item name in a sheet or form the document tells the reader to fill in;
65
+ - a product term the reader meets on screen.
66
+
67
+ Where the reader cannot already know a term, define it once at its first use.
68
+ Use one spelling throughout.
69
+
70
+ Pull request and issue bodies are outside this clause (see Scope). Numbers and
71
+ links belong there, and in commit messages and the changelog.
34
72
 
35
73
  ## 2. No account of how the work went
36
74
 
37
- What happened while the change was being designed or written stays out of the
38
- result:
75
+ Ordinary specifications and change descriptions state the current behaviour
76
+ and why. They omit design and implementation history, including:
39
77
 
40
78
  - "started as X, changed to Y"
41
79
  - "adjusted after review"
42
80
  - "temporary until Z lands"
43
81
 
44
- State the current behaviour and the reason it is that way. The history is
45
- already in the git log and the pull request; do not write it twice.
82
+ The git log and pull request already hold this history.
83
+
84
+ Only when the user expressly requests an incident, event or work record,
85
+ include the necessary account of what happened. State the observed events,
86
+ evidence, uncertainty, current impact and next action. Separate observations
87
+ from interpretation.
46
88
 
47
- ## 3. Cut
89
+ ## 3. Settle the message before writing
90
+
91
+ Before the first sentence, answer three questions: who reads this, what they
92
+ will do with it, and what the one thing is that they must take away. If the
93
+ last cannot be said in one sentence, material is missing. Gather it before
94
+ writing, and do not hide the gap in vague wording.
95
+
96
+ - Conclusion first. The title or the opening says the result. No preamble.
97
+ - One job per paragraph, stated in its opening sentence, and one new element at
98
+ a time. A second example says how it differs from the first.
99
+ - A connective stays only where it names the relation between its two
100
+ neighbours.
101
+ - Argue in one direction and conclude once. Do not end on a concession or a
102
+ recap.
103
+ - A heading names the concrete subject or question. A bare label such as
104
+ "Overview" or "Details" says nothing and is cut, except a heading that a
105
+ schema or template fixes.
106
+ - Depth follows importance: room where a decision depends on it, one line
107
+ elsewhere.
108
+ - End with the decision or next action the text leads to, when there is one.
109
+ A short document needs no summary section.
110
+
111
+ ## 4. Cut
112
+
113
+ Cut what the reader does not need.
48
114
 
49
115
  - Delete anything self-evident.
50
116
  - Merge repeated statements into one.
51
117
  - Shorten wordy phrasing.
52
-
53
- The test: if deleting a sentence leaves the reader no worse off, delete it.
54
-
55
- ## 4. Plain language
118
+ - Cut an identifier the reader will not meet again, such as a function name
119
+ mentioned once.
120
+ - Cut a table, figure or code block the text never uses, and say what each one
121
+ that stays shows.
122
+
123
+ ### Patterns that add length and no information
124
+
125
+ | Pattern | Shape | Instead |
126
+ | ----------------------- | ---------------------------------------------------- | --------------------------------------------- |
127
+ | Announcement | "The key point is", "as follows", "three reasons" | Say the point, or give the list |
128
+ | Recap | A closing paragraph that repeats the body | Delete it, or say what follows |
129
+ | Empty intensifier | "Very important", "crucial", "comprehensive" | A number, a condition, or nothing |
130
+ | Padding connective | "Furthermore" and "moreover" with no relation behind | Delete, or name the relation |
131
+ | Self-answered question | A question asked only so the next sentence answers | State the answer |
132
+ | Set filled to three | Three items because three feels complete | List what exists |
133
+ | Repeated template | Three sentences or paragraphs in a row of one shape | Merge them, or give each its own shape |
134
+ | Contrast for rhythm | "Not A but B" with no belief or mistake to correct | State the claim |
135
+ | Effect for its own sake | A one-line paragraph or dramatic closer for effect | Keep only at a real turning point |
136
+ | Decoration | Emoji, rule lines, ornamental dashes | Delete, except a line the repository requires |
137
+
138
+ ## 5. Plain language
139
+
140
+ Use the word the reader already has, and say what happens and who does it.
56
141
 
57
142
  - Use ordinary vocabulary. Avoid coined terms and in-group phrasing.
58
143
  - State the point directly, not through a metaphor or a flourish. Write "a
59
144
  parameter worth varying", not "a dial worth turning". A metaphor carries
60
145
  associations the writer did not choose, and the reader has to translate it
61
146
  back.
62
- - One claim per sentence. Keep sentences short.
63
- - Break lines so no line is hard to scan.
64
-
65
- ## 5. Make it readable at a glance
147
+ - Read a figurative or inflated verb ("dive into", "tackle head-on",
148
+ "leverage", "dissolve") literally. If it is not literally true, replace it
149
+ with the act.
150
+ - Name who acts. Software does not know, want or decide: say what the program
151
+ does, or who chose. Where the reader needs to know who performed an act, do
152
+ not leave that out.
153
+ - Use concrete nouns. Name the file, the number, the date or the version
154
+ instead of "some", "many", "various", "the tool" or "the system".
155
+ - One word per concept, defined before first use, with the function before the
156
+ name. Use the field's standard term, and do not stretch jargon into a
157
+ metaphor.
158
+ - One claim per sentence. Keep sentences short. A sentence that nests more than
159
+ two conditions or negations, or buries three coordinate items, is split, and
160
+ the items become a list.
161
+
162
+ ## 6. Say how sure you are, and on what basis
163
+
164
+ The reader acts on the certainty a sentence shows, so show the real one.
165
+
166
+ - Mark a claim the reader would otherwise take as verified: say whether it is
167
+ a fact, an inference or an opinion. A fact names its source: a file, a
168
+ command and its output, a link.
169
+ - Hedge only a real uncertainty, and say what is unconfirmed and how to confirm
170
+ it. A stack of hedges ("may possibly tend to") is deleted.
171
+ - A causal claim carries a one-sentence mechanism. An event with several causes
172
+ is not reduced to one, and an example must support the whole claim, not part
173
+ of it.
174
+ - Never turn "under investigation" into a result, a plan into finished work, or
175
+ program behaviour into somebody's decision.
176
+
177
+ ## 7. Make it readable at a glance
178
+
179
+ Layout carries the structure the sentences would otherwise have to state.
66
180
 
67
181
  - Parallel items become a bullet list.
68
182
  - Three or more paired values become a table.
69
183
  - Ordered steps become a numbered list.
184
+ - A chain of cause and effect stays in prose. A list drops the "because"
185
+ between items.
186
+ - Bold marks the one thing a skimmer must not miss, once or twice per section.
187
+ Bold on many phrases makes none stand out.
188
+ - Break lines so no line is hard to scan.
70
189
 
71
- ## 6. Re-read what you wrote
72
-
73
- Read every line you changed and check two things:
74
-
75
- 1. Is any phrasing still hard to follow?
76
- 2. Does any sentence read as a literal translation?
77
-
78
- An agent that reasons in one language and writes in another leaves translation
79
- artefacts behind. This happens in every language pair. Rewrite the sentence
80
- the way someone writing natively in that language would put it.
190
+ ## 8. Reports and replies
191
+
192
+ A report to the user is a document: a status update, a review result or a
193
+ final summary. § 3 applies, so the opening is the outcome (done, partly
194
+ done, blocked or failed) and the ending is what the reader must decide or do,
195
+ when something is owed. A report also needs these:
196
+
197
+ - Separate what was verified, with the command and its result, from what was
198
+ not run or not checked. Never write "verified" for something unrun.
199
+ - List what changed by its effect, not every step taken. Name work that was not
200
+ requested, and work that remains, as such.
201
+ - State a failure with its evidence. Do not soften it with a hedge or bury it
202
+ below good news.
203
+
204
+ ## 9. Re-read what you wrote
205
+
206
+ Read every line you changed once for each question that applies to its
207
+ surface (see Scope).
208
+
209
+ | Question | Clause |
210
+ | ------------------------------------------------------------------------------------ | ------ |
211
+ | Is there a number, ticket or private name the reader cannot open? | 1 |
212
+ | Does any design or implementation history fall outside clause 2's exception? | 2 |
213
+ | Does the opening carry the result, and does each paragraph do one job? | 3 |
214
+ | Is anything left that clause 4 cuts? | 4 |
215
+ | Is any word figurative, vague or missing its actor? | 5 |
216
+ | Does each claim show the certainty it has, with its basis? | 6 |
217
+ | Does the layout show the structure? | 7 |
218
+ | Does a report open with its outcome and separate what was checked from what was not? | 8 |
219
+
220
+ When the user expressly requested an incident, event or work record, apply
221
+ clause 2's exception before cutting the account of what happened.
222
+
223
+ Last, check for a sentence that reads as a literal translation. An agent that
224
+ reasons in one language and writes in another leaves translation artefacts
225
+ behind, in every language pair. Rewrite the sentence the way someone writing
226
+ natively in that language would put it.
227
+
228
+ A pattern is a candidate, not a verdict. Keep a phrase that is literally true
229
+ and that the reader needs, and rewrite one that only matches the shape.
230
+
231
+ After a rewrite, compare it with the text it replaced. Nothing is added or
232
+ lost: no condition, cause, actor or number is added, no constraint, warning or
233
+ mandatory step is dropped or weakened, the certainty is unchanged, and every
234
+ reference still points at the same thing. Read again until a pass finds
235
+ nothing new. A finding that keeps coming back means the paragraph is wrong in
236
+ its structure: rewrite the paragraph.
81
237
 
82
238
  ## Automatic reminder
83
239
 
@@ -92,8 +248,9 @@ standard at the two moments it is easiest to forget:
92
248
  Each hook prints one message from `.agents/rules/reminders.json`, with no
93
249
  network, and a missing file prints nothing. Claude Code runs `node` directly,
94
250
  with no shell. Codex runs it as one command line, the same under every shell,
95
- once the project's hooks are trusted, and reminds after a patch that adds or changes a Markdown file. Delete
96
- the entries from both files to turn the reminder off; the rule still applies.
251
+ once the project's hooks are trusted, and reminds after a patch that adds or changes a
252
+ Markdown file. Delete the entries from both files to turn the reminder off; the
253
+ rule still applies.
97
254
 
98
255
  The `gh` command line is out of scope. A shell-argument condition also matches
99
256
  compound commands that have nothing to do with GitHub, which would put the
@@ -225,7 +225,7 @@ fact, say what depends on it, and leave the answer to them.
225
225
  **A value with no candidates goes through the tool's free-text path.**
226
226
  `user-questions.md` § 2 names that path for exactly this shape. Where the round
227
227
  falls back to plain text the value is put as a plain request instead — for one
228
- of the three reasons above, never because the answer is a value. Reaching past a
228
+ of the three reasons above, never because the answer is a value. Not using a
229
229
  free-text path the tool has drops the structure for nothing. Where the
230
230
  candidates are listable the question is a choice, which the classifier above
231
231
  already settles.
@@ -354,8 +354,8 @@ lookup could have reached.
354
354
 
355
355
  Where a document requires the field to hold something, write the defaulted value
356
356
  and label it an assumption beside the open question. What is forbidden is the
357
- assumption on its own: unread, it is a decision nobody took, wearing the face of
358
- one somebody did.
357
+ assumption on its own: unread, it is a decision nobody took, recorded as if
358
+ somebody had.
359
359
 
360
360
  **A fact declared undefaultable stops the run.** There is no value to write
361
361
  down: the agent does not hold it, a guessed one is the corruption the tree warns
@@ -378,7 +378,7 @@ decision. An agent that builds one, judges it, and carries on has settled a
378
378
  question of taste on the user's behalf, which is the thing this rule spends
379
379
  every round avoiding.
380
380
 
381
- Talking through such a question is where a session balloons: you keep
381
+ Talking through such a question is where a session grows without bound: you keep
382
382
  rephrasing, the user keeps guessing, and the scope grows to fill the
383
383
  uncertainty.
384
384
 
@@ -30,9 +30,9 @@ takes its label from the user's word for the thing, never from the parameter it
30
30
  fills.
31
31
 
32
32
  Out: internal identifiers, model and table names, request shapes, retry counts,
33
- flags, and every knob a library underneath exposes because it exposes it.
33
+ flags, and every setting a library underneath exposes because it exposes it.
34
34
 
35
- A setting earns a control when someone needs to change it, not when it exists.
35
+ A setting gets a control when someone needs to change it, not when it exists.
36
36
 
37
37
  ## 2. Do not explain the interface
38
38
 
@@ -73,8 +73,8 @@ the user is worse off. If not, it goes.
73
73
  - The pattern the platform already has, in the place users look for it.
74
74
  - One word per concept — the user's word — everywhere it appears.
75
75
 
76
- A novel interaction has to beat the familiar one by enough to pay for being
77
- learned. Most do not.
76
+ A novel interaction has to beat the familiar one by more than the cost of
77
+ learning it. Most do not.
78
78
 
79
79
  ## 5. Show the structure
80
80
 
@@ -97,7 +97,7 @@ Cutting stops here. None of these is excess at any size.
97
97
 
98
98
  - **The label.** WCAG 3.3.2 requires a label for every form input, and a
99
99
  placeholder standing in for one is a documented failure. The label names the
100
- control; an explanation apologises for it. This rule deletes the second and
100
+ control; an explanation makes up for a control that does not say so. This rule deletes the second and
101
101
  protects the first.
102
102
  - Accessible names, roles and states, and a focus order that follows the reading
103
103
  order.
@@ -62,9 +62,9 @@ is still a Change Request.
62
62
  The ladder trims code, not obligations. These stay whatever rung you stop at.
63
63
 
64
64
  - Required traceability annotations.
65
- The execution ledger and Article V links also stay: BF → US → AC → EX →
66
- Tests → Code → Verification evidence. A BR lives in its enforcing contract
67
- and cites the relevant EX.
65
+ The Article V links also stay: BF → US → AC → EX → Tests → Code →
66
+ Verification evidence. A BR lives in its enforcing contract and cites the
67
+ relevant EX.
68
68
  - Repository quality gates and their verification evidence.
69
69
  - Validation of input crossing a trust boundary.
70
70
  - Error handling that prevents data loss.
@@ -156,6 +156,14 @@ a case that cannot happen.
156
156
  An addition someone does want is its own change, or an expansion declared under
157
157
  Article VII of `.qfai/assistant/rule/constitution.md`.
158
158
 
159
+ - **A fix nobody asked for**, such as a pre-existing bug or a performance
160
+ concern, is reported as a follow-up. A fix the requested behaviour cannot work
161
+ without stays in. The change's report names it, and it needs no expansion
162
+ declared under Article VII.
163
+ - **An ambiguous request**, where the work goes ahead on an assumption, is built
164
+ only for the reading the wording and the surrounding code most directly support.
165
+ State the assumption. Whether to ask instead is `grilling.md`'s to decide.
166
+
159
167
  ## 5. What this rule is not
160
168
 
161
169
  - Not a licence to skip a requirement. The spec is the authority.
@@ -2,14 +2,16 @@
2
2
  "structured-question": {
3
3
  "hookSpecificOutput": {
4
4
  "hookEventName": "UserPromptSubmit",
5
- "additionalContext": "QFAI user questions (.agents/rules/user-questions.md). Every question you put to the user this turn goes through the host's structured question tool where it is callable, and through that rule's fallback where it is not — carrying the same parts either way. No question is light enough to skip it: a yes-or-no, a confirmation and a \"just checking\" are each a question. A turn that leaves the next step to the user ends with such a question, listing the next actions with the recommended one first, never with a status report or an offer in prose. Read the rule rather than working from this line."
6
- }
5
+ "additionalContext": "QFAI user questions (.agents/rules/user-questions.md). Put every question through the host's structured question tool where callable, and through that rule's fallback where it is not, with the same parts. No question is light enough to skip it. Ask only when the next step needs the user's answer. Background waiting and completion-only reports need no question. State the current state, awaited evidence or result and the resume condition; promise no unsupported automatic restart. Dismissal or silence is no answer or permission. Existing delegation can cover a routine choice; it cannot supply a hard-required fact or uncovered approval, override cancellation or bypass an explicit tool block. Requested free-text values resume the waiting step; independent instructions need a new plan; split mixed replies and infer no option approval. Reply in the user's working language (.qfai/assistant/rule/communication.md). Read the rule."
6
+ },
7
+ "briefContext": "QFAI user questions: read .agents/rules/user-questions.md; ask in the answer's shape only when an answer is needed; waiting and completion reports need none; reply in the user's working language."
7
8
  },
8
9
  "free-text-entry": {
9
10
  "hookSpecificOutput": {
10
11
  "hookEventName": "UserPromptSubmit",
11
- "additionalContext": "QFAI free-text entry (the `qfai-run` skill). When the user's message asks for a change, a fix, an investigation of the codebase or a question about the project and names no skill, invoke the `qfai-run` skill for it before any other work. A message that names a skill goes to that skill. A question that one command or one file read answers needs no run: answer it directly. If `qfai-run` cannot start, stop and say so; do not answer without the workflow. `qfai-run` itself tells a reply to a run in progress from a new request. Read the skill rather than working from this line."
12
- }
12
+ "additionalContext": "QFAI free-text entry (the `qfai-run` skill). When the user's message asks for a change, a fix, an investigation of the codebase or a question about the project and names no skill, invoke the `qfai-run` skill for it before any other work. A message that names a skill goes to that skill. A question that one command or one file read answers needs no run: answer it directly. If `qfai-run` cannot start, stop and say so; do not answer without the workflow. Plan new requests; a pending answer or requested operation result resumes the current step without a new invocation. An answer after request-info has closed follows its declared branch. An ambiguous reply implies no success, fact or approval. Read the skill rather than working from this line. In a git worktree, read `.claude/skills/qfai-run/SKILL.md` under the current directory, since the host may have loaded another checkout's copy of it."
13
+ },
14
+ "briefContext": "For new requests, use qfai-run to plan; pending answers or requested operation results resume the current step."
13
15
  },
14
16
  "qfai-not-installed": {
15
17
  "hookSpecificOutput": {
@@ -20,49 +22,60 @@
20
22
  "documentation-clarity-before-post": {
21
23
  "hookSpecificOutput": {
22
24
  "hookEventName": "PreToolUse",
23
- "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). Before this title or body ships: no issue or PR numbers, ticket IDs or team-local jargon in source and docs; no account of how the work went, only the current behaviour and why; cut self-evident, repeated and wordy text; ordinary words, one claim per sentence, short lines; bullet lists and tables for parallel items; then re-read every line and rewrite anything that reads as a literal translation."
25
+ "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). PR and issue bodies may contain numbers and links. No issue or PR numbers, ticket IDs or team-local jargon in source or ordinary Markdown; keep the rule's existing exceptions. Ordinary specifications and change descriptions omit design and implementation history. Only when the user expressly requests an incident, event or work record, include necessary observed events, evidence, uncertainty, current impact and next action. Put the conclusion first. Cut self-evident, repeated or wordy text, announcements, recaps and empty intensifiers. Use ordinary words, name who acts, one claim per sentence, short lines, and lists or tables for parallel items. Also mark what is unverified. Re-read every changed line and rewrite literal translations or anything that matches a pattern in the rule."
24
26
  }
25
27
  },
26
28
  "grilling-design-artifact": {
27
29
  "hookSpecificOutput": {
28
30
  "hookEventName": "PreToolUse",
29
31
  "additionalContext": "QFAI grilling (.agents/rules/grilling.md). Before this: is a decision about to be fixed that the request needs and the repository cannot settle? Outside the discussion stage, settle it between agents and take the griller's recommendation; ask the user only a critical decision — one that contradicts a spec, a contract or a recorded decision, one whose effect cannot be taken back, or product intent nothing written states. Do not ask about, or add, what the request did not need. Read the rule rather than working from this line."
30
- }
32
+ },
33
+ "briefContext": "QFAI grilling: read .agents/rules/grilling.md before fixing a required decision; consult agents and bring only critical decisions to the user."
31
34
  },
32
35
  "grilling-delegation": {
33
36
  "hookSpecificOutput": {
34
37
  "hookEventName": "PreToolUse",
35
38
  "additionalContext": "QFAI grilling (.agents/rules/grilling.md). Before this: is a decision about to be fixed that the request needs and the repository cannot settle? Outside the discussion stage, settle it between agents and take the griller's recommendation; ask the user only a critical decision — one that contradicts a spec, a contract or a recorded decision, one whose effect cannot be taken back, or product intent nothing written states. Do not ask about, or add, what the request did not need. Read the rule rather than working from this line."
36
- }
39
+ },
40
+ "briefContext": "QFAI grilling: read .agents/rules/grilling.md before fixing a required decision; consult agents and bring only critical decisions to the user."
37
41
  },
38
42
  "grilling-plan": {
39
43
  "hookSpecificOutput": {
40
44
  "hookEventName": "PreToolUse",
41
45
  "additionalContext": "QFAI grilling (.agents/rules/grilling.md). Before this: is a decision about to be fixed that the request needs and the repository cannot settle? Outside the discussion stage, settle it between agents and take the griller's recommendation; ask the user only a critical decision — one that contradicts a spec, a contract or a recorded decision, one whose effect cannot be taken back, or product intent nothing written states. Do not ask about, or add, what the request did not need. Read the rule rather than working from this line."
42
- }
46
+ },
47
+ "briefContext": "QFAI grilling: read .agents/rules/grilling.md before fixing a required decision; consult agents and bring only critical decisions to the user."
43
48
  },
44
49
  "documentation-clarity-after-write": {
45
50
  "hookSpecificOutput": {
46
51
  "hookEventName": "PostToolUse",
47
- "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). For the Markdown just written, inside this change only: no issue or PR numbers, ticket IDs or team-local jargon; no account of how the work went, only the current behaviour and why; cut self-evident, repeated and wordy text; ordinary words, one claim per sentence, short lines; bullet lists and tables for parallel items; then re-read every line and rewrite anything that reads as a literal translation."
48
- }
52
+ "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). For the changed source and ordinary Markdown: no issue or PR numbers, ticket IDs or team-local jargon; keep the rule's existing exceptions. Ordinary specifications and change descriptions omit design and implementation history. Only when the user expressly requests an incident, event or work record, include necessary observed events, evidence, uncertainty, current impact and next action. Put the conclusion first. Cut self-evident, repeated or wordy text, announcements, recaps and empty intensifiers. Use ordinary words, name who acts, one claim per sentence, short lines, and lists or tables for parallel items. Also mark what is unverified. Re-read every changed line and rewrite literal translations or anything that matches a pattern in the rule."
53
+ },
54
+ "briefContext": "QFAI documentation clarity: read .agents/rules/documentation-clarity.md for every changed line, keeping its exceptions and marking what is unverified."
49
55
  },
50
56
  "documentation-clarity-after-edit": {
51
57
  "hookSpecificOutput": {
52
58
  "hookEventName": "PostToolUse",
53
- "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). For the Markdown just edited, inside this change only: no issue or PR numbers, ticket IDs or team-local jargon; no account of how the work went, only the current behaviour and why; cut self-evident, repeated and wordy text; ordinary words, one claim per sentence, short lines; bullet lists and tables for parallel items; then re-read every line and rewrite anything that reads as a literal translation."
54
- }
59
+ "additionalContext": "QFAI documentation clarity (.agents/rules/documentation-clarity.md). For the changed source and ordinary Markdown: no issue or PR numbers, ticket IDs or team-local jargon; keep the rule's existing exceptions. Ordinary specifications and change descriptions omit design and implementation history. Only when the user expressly requests an incident, event or work record, include necessary observed events, evidence, uncertainty, current impact and next action. Put the conclusion first. Cut self-evident, repeated or wordy text, announcements, recaps and empty intensifiers. Use ordinary words, name who acts, one claim per sentence, short lines, and lists or tables for parallel items. Also mark what is unverified. Re-read every changed line and rewrite literal translations or anything that matches a pattern in the rule."
60
+ },
61
+ "briefContext": "QFAI documentation clarity: read .agents/rules/documentation-clarity.md for every changed line, keeping its exceptions and marking what is unverified."
55
62
  },
56
63
  "minimal-implementation": {
57
64
  "hookSpecificOutput": {
58
65
  "hookEventName": "PostToolUse",
59
66
  "additionalContext": "QFAI minimal implementation (.agents/rules/minimal-implementation.md). A source file just changed, which is this reminder's trigger and not the rule's scope: could it not exist at all, is it already in this codebase, or does the standard library, the platform or an already-installed dependency do it? The same rungs run at a design stage that decides where a capability or a body of data comes from. Otherwise the least code that works. Mark a deliberate shortcut with both its ceiling and the condition that lifts it. The ladder never removes what § 2 of that rule lists. For a change to a screen or to terminal output, .agents/rules/interface-clarity.md governs what may appear."
60
- }
67
+ },
68
+ "briefContext": "QFAI minimal implementation: read .agents/rules/minimal-implementation.md, including its mandatory floor in § 2, and .agents/rules/interface-clarity.md before deciding what to implement."
61
69
  },
62
70
  "api-budget": {
63
71
  "hookSpecificOutput": {
64
72
  "hookEventName": "PreToolUse",
65
73
  "additionalContext": "QFAI API budget (.agents/rules/api-budget.md). Before this call: can git answer it instead? Then REST, then GraphQL — the forge's own pull-request and issue subcommands take the GraphQL path, a separate allowance counted in points. One call for the whole set, not one per branch. Save a payload once and search the file; a second grep is not a second download. Poll no faster than the thing being polled changes. A rate-limit endpoint misreports the budget: read the remaining count off this response's own headers. The allowance belongs to the account, and every session and sub-agent draws on it at once. Read the rule rather than working from this line."
66
- }
74
+ },
75
+ "briefContext": "QFAI API budget: read .agents/rules/api-budget.md; use git before REST before GraphQL and reuse saved results."
76
+ },
77
+ "session-feedback": {
78
+ "decision": "block",
79
+ "reason": "QFAI session feedback (.agents/rules/session-feedback.md). A turn is ending. Decide first, from the whole session: is every task the user gave you complete, and is nothing waiting on the user: no question, approval or choice? If not, or if you already ran this review after the user's latest instruction, reply with one short line and stop. Otherwise read the rule and follow it: review the session for problems in QFAI itself (its rules, skills, steps, commands, hooks and documents, and what using them cost), and draft one issue for each, with none of the project's names, source, secrets or personal data. If nothing is worth reporting, say so in one line. If something is, ask the user through the structured question tool whether to file, showing each draft, and file to the QFAI repository only the drafts they approve. Under a no-question mode ask nothing and file nothing: put the drafts in your final report."
67
80
  }
68
81
  }
@@ -0,0 +1,136 @@
1
+ # Session Feedback
2
+
3
+ What an agent does once, when every task the user gave it is complete: review
4
+ the whole session for problems in QFAI itself, and ask the user whether to
5
+ report them.
6
+
7
+ An agent in a session notices what a maintainer cannot see from outside: a rule
8
+ that contradicted another, a gate that stopped correct work, a step that cost an
9
+ hour for a small result. The notice ends with the session unless something
10
+ 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
+
13
+ ## Scope
14
+
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 |
22
+
23
+ ## 1. When the review runs
24
+
25
+ Only when both hold, judged from the whole session:
26
+
27
+ 1. Every task the user gave is complete, in every stage the plan chose.
28
+ 2. Nothing waits on the user: no question, approval or choice is open.
29
+
30
+ A turn that ends with a question, a plan awaiting approval or a list of next
31
+ actions is a pause. So is the end of one stage of several. If the user's next
32
+ answer would start more work, the work is not complete.
33
+
34
+ The `Stop` hook puts the question at the end of a turn, because no hook can see
35
+ whether the user's work is done. The agent answers it from the session. When the
36
+ work is not complete, or the review already ran after the user's latest
37
+ instruction, the agent replies with one short line and stops. In doubt, the work
38
+ is not complete.
39
+
40
+ > SIMPLIFIED: the hook fires at every end of turn that does not end in a
41
+ > question mark, a statement-style pause included, and the agent declines it
42
+ > when the work is not complete, which costs one short extra turn and the
43
+ > message each time.
44
+ > Lift when: the host reports whether the user's work is complete.
45
+
46
+ ## 2. What to review
47
+
48
+ The whole session, for these, where QFAI caused or contributed to them:
49
+
50
+ - **Blockers.** A gate, check or rule that stopped correct work.
51
+ - **Structural problems and contradictions.** Two rules, specs or skills asking
52
+ for incompatible things, or text that points at nothing.
53
+ - **Lost efficiency.** Repeated steps, waiting, and rework that a rule or
54
+ command caused.
55
+ - **Tokens against output.** Large reads, repeated loads and long ceremony for a
56
+ small result.
57
+ - **Poor value.** A mechanism whose cost for this work exceeded what it gave.
58
+ - **Over-work.** Work beyond the request because a rule or step required it.
59
+ - **Quality that missed the user's wish.** Output the user had to correct or
60
+ reject, and the QFAI guidance that led there.
61
+
62
+ A finding names its evidence: the command, finding code, message or shipped file.
63
+ A feeling without evidence is not a finding. A figure is given only when the
64
+ session measured it, and an estimate says so.
65
+
66
+ ## 3. What a draft holds
67
+
68
+ One draft for each problem, never a log of the session. Each holds:
69
+
70
+ - a title that states the problem in one line;
71
+ - what happened, with the QFAI command, finding code or shipped file named;
72
+ - the cost, in time, tokens or rework;
73
+ - what would have helped, as a suggestion.
74
+
75
+ Write it for a maintainer who has not seen the session, in English, whatever
76
+ language the session used. `documentation-clarity.md` sets the writing standard.
77
+
78
+ A draft carries none of these: the name of the project or its organisation, a
79
+ repository address, source code, a path of the project's own, a secret, personal
80
+ data, or the user's words beyond what the problem needs. A path under what QFAI
81
+ ships is fine. Generalise the rest.
82
+
83
+ A message quoted from the session has the project's paths, IDs and names
84
+ replaced by placeholders. Nothing else is quoted from the project's files or
85
+ tool output.
86
+
87
+ ## 4. Ask before filing
88
+
89
+ Put one question to the user through the host's structured question tool, in the
90
+ form `user-questions.md` sets out:
91
+
92
+ - one option for each draft, labelled by its title and described by what it
93
+ reports and the cost it names, with the full text of every draft shown beside
94
+ the question;
95
+ - more than one may be chosen, and choosing none files nothing;
96
+ - the recommendation first, with its reason.
97
+
98
+ A requested change to a draft is made, and the question is put again. Filing is
99
+ visible to others, so the answer covers the drafts shown and nothing wider
100
+ (`action-reversibility.md`).
101
+
102
+ When the review finds nothing worth reporting, say so in one line and ask
103
+ nothing.
104
+
105
+ ## 5. Filing
106
+
107
+ For each approved draft, write the body to a scratch file
108
+ (`temporary-files.md`) and file it once:
109
+
110
+ ```sh
111
+ gh issue create --repo aganesy/QFAI --title '<title>' --body-file <file>
112
+ ```
113
+
114
+ The title is plain words: no backtick, `$`, or quote in it, so the shell
115
+ expands nothing. Report each issue's address. Where `gh` is missing or not signed
116
+ in, give the user the title and body to post at
117
+ `https://github.com/aganesy/QFAI/issues/new`. Never ask for, read or enter a
118
+ credential.
119
+
120
+ ## 6. Under a no-question mode
121
+
122
+ Nothing is asked and nothing is filed. The drafts go in the final report, and
123
+ the report says they were not filed.
124
+
125
+ ## Related
126
+
127
+ - The form of the question: `user-questions.md`
128
+ - Why filing needs an answer: `action-reversibility.md`
129
+ - The writing standard for a draft: `documentation-clarity.md`
130
+ - Where the scratch file goes: `temporary-files.md`
131
+
132
+ ## Scope of this file
133
+
134
+ This is the master copy for every AI coding agent in this repository.
135
+ Tool-specific instruction files point here instead of restating it. Edit this
136
+ file when the rule changes.