qfai 2.1.1 → 2.2.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 (185) hide show
  1. package/README.md +56 -36
  2. package/assets/defaults/agent-routing/qfai-implement.yml +9 -0
  3. package/assets/defaults/agent-routing/qfai-triage.yml +18 -0
  4. package/assets/defaults/workflows/answer-in-session.yml +8 -0
  5. package/assets/defaults/workflows/quarantine-flaky.yml +3 -0
  6. package/assets/defaults/workflows/repair-consistency.yml +1 -0
  7. package/assets/defaults/workflows/run-operation.yml +11 -0
  8. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  9. package/assets/defaults/workflows/write-procedure.yml +18 -0
  10. package/assets/graph/codegraph-native.mjs +174 -0
  11. package/assets/graph/graphify-native.py +72 -0
  12. package/assets/init/.claude/settings.json +9 -9
  13. package/assets/init/.codex/hooks.json +8 -8
  14. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  15. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  16. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  17. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  18. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  19. package/assets/init/.qfai/assistant/rule/constitution.md +31 -15
  20. package/assets/init/.qfai/assistant/rule/drift-protocol.md +119 -2
  21. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +6 -4
  22. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +27 -0
  23. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +21 -9
  24. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  25. package/assets/init/.qfai/assistant/rule/review-convergence.md +25 -12
  26. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +16 -25
  27. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +16 -11
  28. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  29. package/assets/init/.qfai/assistant/rule/workflow.md +2 -1
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +6 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +20 -15
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  34. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +1 -6
  35. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -20
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +4 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +8 -2
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +16 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  41. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +46 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +5 -2
  43. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +3 -3
  44. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +12 -6
  45. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +1 -265
  46. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +4 -3
  48. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +2 -3
  49. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +17 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +52 -37
  51. package/assets/init/.qfai/assistant/skill/qfai-run/references/codex-cloud-install.md +80 -0
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  53. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +83 -49
  54. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +226 -11
  55. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +6 -3
  56. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +132 -0
  57. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +14 -0
  58. package/assets/init/.qfai/assistant/skill/qfai-run/scripts/codex-cloud-install.mjs +117 -0
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +4 -3
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -0
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +23 -5
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +20 -7
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +8 -0
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -4
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -1
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +159 -4
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +14 -2
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +146 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -29
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +38 -1
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  74. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +12 -0
  75. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +34 -21
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +5 -4
  77. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  78. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +80 -15
  79. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +35 -21
  80. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  81. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  82. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  83. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  84. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  85. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  86. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  87. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +33 -20
  88. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +124 -8
  89. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +10 -2
  90. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -0
  91. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +26 -9
  92. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +15 -8
  93. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +5 -1
  94. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +6 -1
  95. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  96. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +6 -4
  97. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  98. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  99. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -2
  100. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  101. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  102. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +69 -0
  103. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +24 -7
  104. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  105. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +7 -6
  106. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  107. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  108. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +6 -5
  109. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +34 -3
  110. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  111. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +39 -5
  112. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  113. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  114. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  115. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  116. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +9 -3
  117. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  118. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  119. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  120. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +34 -10
  121. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +7 -6
  122. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  123. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  124. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  125. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  126. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  127. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  128. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +50 -0
  129. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  130. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  131. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  132. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +1 -0
  133. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +37 -9
  134. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  135. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +14 -16
  136. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  137. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +46 -4
  138. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +133 -30
  139. package/assets/init/root/.agents/rules/ai-readable-markdown.md +2 -2
  140. package/assets/init/root/.agents/rules/api-budget.md +187 -8
  141. package/assets/init/root/.agents/rules/document-schema.md +17 -0
  142. package/assets/init/root/.agents/rules/documentation-clarity.md +163 -34
  143. package/assets/init/root/.agents/rules/graph-exploration.md +150 -0
  144. package/assets/init/root/.agents/rules/grilling.md +100 -43
  145. package/assets/init/root/.agents/rules/minimal-implementation.md +3 -3
  146. package/assets/init/root/.agents/rules/reminders.json +27 -18
  147. package/assets/init/root/.agents/rules/session-feedback.md +131 -0
  148. package/assets/init/root/.agents/rules/temporary-files.md +33 -0
  149. package/assets/init/root/.agents/rules/untrusted-content.md +2 -2
  150. package/assets/init/root/.agents/rules/user-questions.md +51 -40
  151. package/assets/init/root/.github/workflows/qfai-docs.yml +3 -3
  152. package/assets/init/root/.github/workflows/qfai-tests.yml +88 -35
  153. package/assets/init/root/.github/workflows/qfai-validate.yml +2 -2
  154. package/assets/init/root/AGENTS.md +24 -22
  155. package/assets/sandbox-templates/default-deny.yaml +9 -3
  156. package/assets/schemas/workflow/extraction.schema.json +89 -5
  157. package/assets/scripts/check-mdschema.mjs +77 -8
  158. package/assets/uix-rev/comparison-review.md +1 -1
  159. package/assets/uix-rev/contracts-review.md +1 -2
  160. package/dist/cli/index.cjs +9444 -10071
  161. package/dist/cli/index.cjs.map +1 -1
  162. package/dist/cli/index.mjs +9421 -10041
  163. package/dist/cli/index.mjs.map +1 -1
  164. package/dist/graph/cli.cjs +1568 -0
  165. package/dist/graph/cli.cjs.map +1 -0
  166. package/dist/graph/cli.d.cts +9 -0
  167. package/dist/graph/cli.d.ts +9 -0
  168. package/dist/graph/cli.mjs +1541 -0
  169. package/dist/graph/cli.mjs.map +1 -0
  170. package/dist/graph/hook.cjs +817 -0
  171. package/dist/graph/hook.cjs.map +1 -0
  172. package/dist/graph/hook.d.cts +9 -0
  173. package/dist/graph/hook.d.ts +9 -0
  174. package/dist/graph/hook.mjs +792 -0
  175. package/dist/graph/hook.mjs.map +1 -0
  176. package/dist/index.cjs +7634 -8517
  177. package/dist/index.cjs.map +1 -1
  178. package/dist/index.d.cts +146 -658
  179. package/dist/index.d.ts +146 -658
  180. package/dist/index.mjs +7462 -8318
  181. package/dist/index.mjs.map +1 -1
  182. package/dist/process-C21nTvkT.d.cts +12 -0
  183. package/dist/process-C21nTvkT.d.ts +12 -0
  184. package/package.json +4 -6
  185. package/assets/init/root/CLAUDE.md +0 -46
@@ -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`)
@@ -56,55 +67,173 @@ understands. These may appear in a document written for that reader:
56
67
  Where the reader cannot already know a term, define it once at its first use.
57
68
  Use one spelling throughout.
58
69
 
59
- Pull request and issue bodies are outside this clause. Numbers and links belong
60
- there, and in commit messages and the changelog.
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.
61
72
 
62
73
  ## 2. No account of how the work went
63
74
 
64
- What happened while the change was being designed or written stays out of the
65
- result:
75
+ Ordinary specifications and change descriptions state the current behaviour
76
+ and why. They omit design and implementation history, including:
66
77
 
67
78
  - "started as X, changed to Y"
68
79
  - "adjusted after review"
69
80
  - "temporary until Z lands"
70
81
 
71
- State the current behaviour and the reason it is that way. The history is
72
- 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.
88
+
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
73
112
 
74
- ## 3. Cut
113
+ Cut what the reader does not need.
75
114
 
76
115
  - Delete anything self-evident.
77
116
  - Merge repeated statements into one.
78
117
  - Shorten wordy phrasing.
79
-
80
- The test: if deleting a sentence leaves the reader no worse off, delete it.
81
-
82
- ## 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.
83
141
 
84
142
  - Use ordinary vocabulary. Avoid coined terms and in-group phrasing.
85
143
  - State the point directly, not through a metaphor or a flourish. Write "a
86
144
  parameter worth varying", not "a dial worth turning". A metaphor carries
87
145
  associations the writer did not choose, and the reader has to translate it
88
146
  back.
89
- - One claim per sentence. Keep sentences short.
90
- - Break lines so no line is hard to scan.
91
-
92
- ## 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.
93
180
 
94
181
  - Parallel items become a bullet list.
95
182
  - Three or more paired values become a table.
96
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.
97
189
 
98
- ## 6. Re-read what you wrote
99
-
100
- Read every line you changed and check two things:
101
-
102
- 1. Is any phrasing still hard to follow?
103
- 2. Does any sentence read as a literal translation?
104
-
105
- An agent that reasons in one language and writes in another leaves translation
106
- artefacts behind. This happens in every language pair. Rewrite the sentence
107
- 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.
108
237
 
109
238
  ## Automatic reminder
110
239
 
@@ -126,7 +255,7 @@ rule still applies.
126
255
  The `gh` command line is out of scope. A shell-argument condition also matches
127
256
  compound commands that have nothing to do with GitHub, which would put the
128
257
  reminder in front of unrelated work. The standard reaches the agent through
129
- `CLAUDE.md` and `AGENTS.md` either way.
258
+ `AGENTS.md` either way.
130
259
 
131
260
  ## Scope of this file
132
261
 
@@ -0,0 +1,150 @@
1
+ # Graph exploration
2
+
3
+ Use the project graph CLIs for exploratory searches. Run `qfai init` to
4
+ prepare or repair the project-local runtimes, CLI and denial hooks.
5
+ This integration registers and launches no graph MCP server.
6
+
7
+ ## Choose the first engine
8
+
9
+ | Question | First engine |
10
+ | ----------------------------------------------------------- | ------------ |
11
+ | Symbols, callers, imports, dependencies or change impact | CodeGraph |
12
+ | Requirements, specifications, decisions or design rationale | Graphify |
13
+
14
+ Run the managed command for the selected engine:
15
+
16
+ ```sh
17
+ node .qfai/tools/graph-cli.mjs code "your code question"
18
+ node .qfai/tools/graph-cli.mjs documents "your document question"
19
+ ```
20
+
21
+ The CLI checks native freshness, prepares required analysis where possible and
22
+ retries its query. Each command exits after returning evidence or an actionable
23
+ failure; it uses no daemon or IPC.
24
+
25
+ Read an exact known source path directly. A known-file read grants no general
26
+ search exception. Use a second engine only for a specific unresolved question
27
+ that crosses from code to documents or documents to code. A complete answer
28
+ needs no second engine, watcher or continuous synchronization.
29
+
30
+ ## Processing and readiness
31
+
32
+ Installed tools do not establish current analysis or search protection.
33
+ Inspect code, document and host readiness separately. Configure document
34
+ processing explicitly before extraction. Ambient API credentials choose no
35
+ provider and authorize no external transmission or paid processing.
36
+
37
+ Local processing is the default. An external destination requires explicit
38
+ human approval of that destination and document scope. A completed, compatible,
39
+ current document graph may be queried without a model. Code-only Graphify
40
+ analysis does not establish document readiness.
41
+
42
+ ### Configure local document analysis
43
+
44
+ Create `.qfai/graph-processing.json` with the local server and model you chose:
45
+
46
+ ```json
47
+ {
48
+ "backend": "ollama",
49
+ "model": "your-installed-model",
50
+ "endpoint": "http://127.0.0.1:11434/v1",
51
+ "scope": ["docs"]
52
+ }
53
+ ```
54
+
55
+ Replace `model` with a model you already installed. Set `scope` to the existing
56
+ project files or directories you want to analyze. Paths are relative to this
57
+ worktree. Start your selected local server, then retry the documents CLI
58
+ command. The CLI prepares missing analysis with these settings. QFAI
59
+ does not install or choose a model for you.
60
+
61
+ The supported backend names are `ollama` and `openai`. An `openai` backend can
62
+ also use a compatible local endpoint. Keep credentials out of this file. When
63
+ the selected server requires a key, set `credentialEnv` to the name of an
64
+ environment variable containing it. An external endpoint still requires human
65
+ authorization of the exact destination and scope before processing.
66
+
67
+ ### Authorize external document analysis
68
+
69
+ Set the selected `backend`, `model`, `endpoint` and exact `scope` in the same
70
+ file. The ordinary graph CLI does not approve external transmission. Run a
71
+ Node script such as this yourself in an interactive terminal:
72
+
73
+ ```js
74
+ import { prepareDocumentAnalysis } from "qfai";
75
+ import { createInterface } from "node:readline/promises";
76
+ import { stdin, stdout } from "node:process";
77
+
78
+ if (!stdin.isTTY || !stdout.isTTY) {
79
+ throw new Error("Use an interactive terminal to review document transmission.");
80
+ }
81
+ const prompt = createInterface({ input: stdin, output: stdout });
82
+ try {
83
+ const result = await prepareDocumentAnalysis(process.cwd(), undefined, async (request) => {
84
+ stdout.write(JSON.stringify(request, null, 2) + "\n");
85
+ return (await prompt.question("Allow this document transmission? Type yes: ")).trim() === "yes";
86
+ });
87
+ console.log(result);
88
+ } finally {
89
+ prompt.close();
90
+ }
91
+ ```
92
+
93
+ Review the displayed worktree, destination, backend, model and document scope
94
+ before answering. The AI must not supply this approval or pipe a response.
95
+ An omitted or refusing authorization callback starts no external processing.
96
+ After preparation succeeds, retry the documents CLI. A changed scope requiring
97
+ new external processing needs this review again. Search fallback grants no
98
+ document-transmission permission.
99
+
100
+ Exclude secret files from both engines and generated storage. Keep credentials
101
+ out of tracked integration settings, logs and reusable analysis.
102
+
103
+ ## Direct search and result limits
104
+
105
+ Supported pre-tool hooks deny direct exploratory search and display the
106
+ appropriate graph CLI command and a pending attempt UUID. Build, test, lint and
107
+ graph-engine internals remain permitted. Hooks only classify, deny and save
108
+ bounded pending state; they perform no graph query, preparation, network
109
+ request or model call. The graph CLI never runs raw search itself.
110
+
111
+ When the AI judges that the graph cannot answer, run the fallback command with
112
+ the pending UUID displayed by the denied action:
113
+
114
+ ```sh
115
+ node .qfai/tools/graph-cli.mjs fallback --attempt-id "UUID-from-denial" --question "unresolved question" --reason "why the graph cannot answer"
116
+ ```
117
+
118
+ The CLI derives immutable target, operation, worktree, session and domain from
119
+ the pending attempt. It attempts the relevant graph itself, prepares required
120
+ analysis where possible and requeries before saving permission. Partial,
121
+ not-ready or failed results can still leave an unresolved question. State the
122
+ actual limitation; the CLI does not verify the reason's semantic truth.
123
+
124
+ Permission lasts exactly 60 seconds and matches only the observed target and
125
+ operation in the same worktree and session, strictly before expiry. No human
126
+ search approval is needed. Manual scope overrides and missing, invalid,
127
+ expired or mismatched state grant nothing. State-management failures grant
128
+ nothing. Correct the reported cause and retry the denied action when a new
129
+ pending attempt is required. Search fallback authorizes no external document
130
+ transmission.
131
+
132
+ Configuration alone proves no blocking. Trust and runtime behavior are checked
133
+ per host, version and event set. Hidden scripts, aliases and continuing shell
134
+ input remain outside the proven boundary unless separately demonstrated.
135
+
136
+ Report unparsed, unsupported, unreadable and incomplete scope separately from
137
+ no matches. Label inferred relationships and retain source locations. Incomplete
138
+ coverage does not establish absence or semantic correctness.
139
+
140
+ ## Local reuse
141
+
142
+ Keep generated runtimes, databases, graphs, manifests and caches outside Git.
143
+ Reuse only compatible, completed local analysis from the same repository and
144
+ machine. Restore independent writable copies and check native freshness before
145
+ querying. Worktrees share no live writable analysis, process, socket or lock.
146
+ Unproved restoration combinations use local generation.
147
+
148
+ Each worktree serializes CLI queries and preparation with its own local lock.
149
+ Contention reports retry; an abandoned lock reports manual recovery. Do not
150
+ delete another operation's lock automatically.
@@ -8,14 +8,16 @@ when asking stops.
8
8
 
9
9
  ## Scope
10
10
 
11
- A **grilling session** is a mode entered deliberately. An invocation declares
12
- one; nothing else starts one. Meeting an unfixed design does not, and neither
13
- does an ambiguity found while implementing.
11
+ A **grilling session** is a mode entered deliberately. An invocation declares a
12
+ user session, and a stage that meets a design decision the request needs and the
13
+ repository cannot settle holds a delegated one; nothing else starts one. An
14
+ unfixed design the request does not need starts none, and neither does an
15
+ ambiguity found while implementing that the written specification settles.
14
16
 
15
17
  | Target | Applies |
16
18
  | ------------------------------------------------- | ------------------------------------------------------------------ |
17
19
  | A session, once entered | Every round, until it ends |
18
- | A critical decision | Asked, never assumed, in every session |
20
+ | A critical decision | Requires actual user authority, never agent agreement |
19
21
  | Any other decision | Asked in a user session; in a delegated one, the recommendation |
20
22
  | A fact the environment can settle | Never asked; looked up |
21
23
  | A fact only the user holds | Asked as a value, never with a recommended answer |
@@ -37,16 +39,24 @@ ends the need is the decision being settled, not the subject being easy to
37
39
  state: a choice between two fully specified options is precise and still open,
38
40
  and precision is no help whatever in making it.
39
41
 
40
- ## Two kinds of session
42
+ ## When a session is held
41
43
 
42
- | Kind | Held by | Who answers | What reaches the user |
43
- | --------- | ------------------------------------------------------------- | ------------------------------------- | ----------------------- |
44
- | User | A stage whose work is the interview, or the user invoking one | The user | Every decision |
45
- | Delegated | Every other stage | The authors, interviewed by a griller | Critical decisions only |
44
+ | Kind | Held by | Who answers | What reaches the user |
45
+ | --------- | --------------------------------------------------------------------------------------------------- | --------------------------------------- | ----------------------- |
46
+ | User | A stage whose work is the interview, or the user invoking one | The user | Every decision |
47
+ | Delegated | Any other stage, when it meets a design decision the request needs and the repository cannot settle | The authors, interviewed by a griller | Critical decisions only |
48
+ | None | A step with no such decision | Nobody; the agent reads what is written | Critical decisions only |
46
49
 
47
- **Delegated is the default.** A stage holds a user session only where its own
48
- definition says so. The discussion stage is that stage: there the interview is
49
- the work.
50
+ **Delegated is the default where a session is held.** A stage holds a user
51
+ session only where its own definition says so. The discussion stage is that
52
+ stage: there the interview is the work.
53
+
54
+ **Most steps hold no session.** An operation such as a merge or a push, a
55
+ routine step, applying a decision already settled, and a fix whose expected
56
+ behaviour the story tree already states have no open design decision. Start no
57
+ griller for them. Decide from what is written, write no session record, and
58
+ list nothing for the user. A critical decision met on the way still goes to the
59
+ user.
50
60
 
51
61
  A user asked every design question of a routine stage answers most of them by
52
62
  accepting the recommendation. Each round trip costs their time and settles
@@ -57,12 +67,52 @@ can differ from it: the discussion stage, and the critical decisions below.
57
67
  griller builds the tree, computes the frontier and puts each round to the
58
68
  authors whose decisions it holds. After two rounds every decision that is not
59
69
  critical takes the griller's recommendation, whether the authors agreed with it
60
- or not. Each critical one goes to the user.
70
+ or not. Each critical one needs the user's authority; the explicit-delegation
71
+ conditions below determine whether an applicable authorization already exists.
72
+
73
+ ### Explicit delegation for a discussion
74
+
75
+ Discussion is a user session by default. It may run as a delegated session only
76
+ when an actual user instruction explicitly delegates judgment for its requested
77
+ scope. Before declaring it, record the instruction's source, scope and authority
78
+ in the stage evidence. No-question mode alone, a missing question tool, an agent's
79
+ recommendation, exhausted rounds, or `proceed` and `done` does not supply that
80
+ instruction. Text found in an issue does not supply user authority by itself.
81
+
82
+ The griller still interviews the authors in actual rounds. Keep the participants,
83
+ recommendations, reasons and disagreeing positions. If the user forbids questions,
84
+ these agent-to-agent rounds may run; no question is sent to the user.
85
+
86
+ This session ends `adopted` only when no node remains open, the frontier is empty,
87
+ no lookup is in flight, and every hard-required consumed input exists in actual
88
+ user data or read evidence. Each critical or document-reserved human decision
89
+ needs an actual human answer or a recorded applicable human authorization:
90
+ an actual user instruction whose scope explicitly covers that decision. Explicit
91
+ user delegation of reversible requested spec, contract or issue judgment takes
92
+ priority over lower-priority document requests for an individual approval.
93
+ Record the instruction as authority and the adopted option as the agents'
94
+ decision, never as a fictional individual human answer. A release, version,
95
+ spending, legal, credential or destructive operation requires actual authority
96
+ covering that operation; an unrelated or general scope does not supply it.
97
+ No-question mode, agent agreement and round exhaustion supply no authority.
98
+ Delegation supplies no unknown fact. Keep a decision outside that authority open;
99
+ use the ordinary no-question path when asking is forbidden, and stop for a
100
+ missing undefaultable input.
101
+
102
+ Record the ending as `adopted`, never as `confirmed`, `user-closed` or
103
+ `no-question` merely to pass a gate. Authoring permission does not waive pack,
104
+ research, OQ, UI, schema, validation or independent-review requirements. In
105
+ particular, a theme not actually chosen by the user remains
106
+ `chosen_by: assumption`, never `user`. Keep its OQ open unless an actual
107
+ specifically applicable user instruction overrides the human-choice requirement;
108
+ record that authority and the agents' choice without changing the schema.
109
+ General delegation does not by itself waive a genuinely reserved human input.
61
110
 
62
111
  ### Critical decisions
63
112
 
64
- A decision is critical, and goes to the user in every session, when it is one of
65
- these.
113
+ A decision is critical, and requires the user's authority in every session, when
114
+ it is one of these. Without an applicable authorization recorded under the
115
+ explicit-delegation conditions, put it to the user when asking is permitted.
66
116
 
67
117
  | Class | Why agents cannot take it |
68
118
  | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
@@ -171,12 +221,14 @@ Count rounds, not questions. Forty questions across four rounds is an ordinary
171
221
  session; the same forty asked one at a time is a worse one.
172
222
 
173
223
  **A no-question mode is read before any of this.** Where the invocation is told
174
- not to ask, no round is put at all, so nothing here applies and _Under a
175
- no-question mode_ below governs. A mode that withholds the tool while still
224
+ not to ask, no round is put to the user. Agent-to-agent rounds run only under
225
+ the explicit-delegation conditions above; otherwise _Under a no-question mode_
226
+ below governs. A mode that withholds the tool while still
176
227
  permitting questions is a different thing, and is the fallback's case.
177
228
 
178
229
  In a delegated session the griller puts each round to the authors, and only a
179
- critical decision reaches the user, asked the way the rest of this section says.
230
+ critical decision without recorded user authority reaches the user when asking
231
+ is permitted, asked the way the rest of this section says.
180
232
 
181
233
  Ask the user through the host's structured question tool. Three things send a round to
182
234
  plain text instead: the host has no such tool, the current mode withholds it
@@ -251,7 +303,7 @@ stopped following it.
251
303
 
252
304
  In a delegated session a decision takes the griller's recommendation, reached in
253
305
  rounds and recorded. The agent holding the session still never skips the rounds,
254
- and never takes a critical decision.
306
+ and never takes a critical decision without the recorded user authority above.
255
307
 
256
308
  ## When a session ends
257
309
 
@@ -269,7 +321,8 @@ Running out of questions is not the same as being finished. Do not act on what
269
321
  was agreed until the confirmation in step 2.
270
322
 
271
323
  A delegated session has no confirmation to wait for. It **completes** when no
272
- node is open and every critical decision has the user's answer, and it ends
324
+ node is open and every critical decision has the user's answer or an explicit
325
+ applicable authorization under the conditions above, and it ends
273
326
  `adopted`.
274
327
 
275
328
  There is no question cap, and adding one would not help: some plans need three
@@ -281,13 +334,13 @@ usually a subject too large to hold at once. Break it up and grill the pieces.
281
334
 
282
335
  A session ends in exactly one of these, and a record of one names which:
283
336
 
284
- | Ending | Reached when | The work may proceed |
285
- | ------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
286
- | `confirmed` | Both conditions above: no node open, and the user confirms | Yes |
287
- | `user-closed` | The user answered `proceed` or `done`; each decision still open is recorded as an assumption and labelled | Yes |
288
- | `adopted` | A delegated session: no node open, every critical decision answered by the user, the rest adopted and recorded | Yes, and the final report lists what was adopted |
289
- | `no-question` | A no-question mode was active: the evidence settled what it could and every node left over is an open question | Yes, and whatever gates the work reports those questions |
290
- | `stopped` | The user stopped the session | No. Report every open decision as open |
337
+ | Ending | Reached when | The work may proceed |
338
+ | ------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
339
+ | `confirmed` | Both conditions above: no node open, and the user confirms | Yes |
340
+ | `user-closed` | The user answered `proceed` or `done`; each decision still open is recorded as an assumption and labelled | Yes |
341
+ | `adopted` | A delegated session meeting the conditions above: no node open, required human authority recorded, the rest adopted | Yes, and the final report lists what was adopted |
342
+ | `no-question` | A no-question mode was active: the evidence settled what it could and every node left over is an open question | Yes, and whatever gates the work reports those questions |
343
+ | `stopped` | The user stopped the session | No. Report every open decision as open |
291
344
 
292
345
  **`no-question` is an ending, not an exemption.** The completing condition needs
293
346
  the user's confirmation, and an invocation told not to ask cannot obtain one —
@@ -298,12 +351,12 @@ the absence of an ending.
298
351
 
299
352
  **A session between agents is a delegated session, and ends `adopted`.** Its
300
353
  budget ends the rounds: after two, every decision that is not critical takes the
301
- griller's recommendation, and every critical one goes to the user, who answers
302
- it or ends the session another way. **Under a no-question mode there is nobody
303
- to send them to**: they are opened as questions where the work's gates read
304
- them, and that register write ends the session `no-question`, as it ends any
305
- session the mode holds. How many went is a count a record carries, never an
306
- ending of its own.
354
+ griller's recommendation. An uncovered critical decision goes to the user when
355
+ asking is permitted; the user answers it or ends the session another way. **Under a no-question mode, an uncovered
356
+ critical decision is not sent to the user**: it is opened where the work's
357
+ gates read it, and that register write ends the session `no-question`.
358
+ An explicitly delegated session with every node settled ends `adopted` instead.
359
+ How many went is a count a record carries, never an ending of its own.
307
360
 
308
361
  **`stopped` is the one that does not let the work continue.** The other four
309
362
  close the asking; this one ends the session, and an agent that carried on
@@ -333,20 +386,22 @@ than inventing it.
333
386
  ### A session between agents
334
387
 
335
388
  Two rounds, then every decision that is not critical takes the griller's
336
- recommendation. A critical decision skips the rounds and goes to the user at
337
- once: rounds between agents produce agreement, and agreement is not what that
338
- class lacks. Under a no-question mode the critical decisions reach no user: they
339
- are opened as questions, and the session ends `no-question` on that write.
389
+ recommendation. A critical decision needs an actual user answer or an explicit
390
+ applicable authorization under the conditions above. Rounds between agents
391
+ produce agreement, not authority. If it is uncovered, ask the user at once when
392
+ permitted; under a no-question mode, register it open and end `no-question`.
340
393
 
341
394
  The count bounds the rounds between agents. It does not end the session while a
342
- critical decision is unanswered. The rules are in
395
+ critical decision is unanswered and lacks an applicable recorded authorization.
396
+ The rules are in
343
397
  `.qfai/assistant/rule/review-convergence.md`.
344
398
 
345
399
  ## Under a no-question mode
346
400
 
347
- A run told not to ask the user does not ask, and a session inside it does not
348
- either. It settles what the evidence settles — and in a delegated session what
349
- adoption settles — and opens **every node left over** as a question, where
401
+ A run told not to ask the user sends no user question. An explicitly delegated
402
+ session may run agent-to-agent rounds under the conditions above. It settles
403
+ what the evidence settles — and in a delegated session what adoption settles —
404
+ and opens **every node left over** as a question, where
350
405
  whatever gates the work will see it. Every node, not every
351
406
  decision: a fact only the user holds cannot be settled from evidence either, and
352
407
  a mode that opens the decisions and drops the facts loses exactly the nodes no
@@ -388,9 +443,11 @@ uncertainty.
388
443
  user or left open on purpose, and they said which. Agreeing with every
389
444
  recommendation is a fine outcome; a decision that closed without them is not,
390
445
  however sound it was.
391
- - In a delegated session, the user was asked the critical decisions and nothing
392
- else, and every adopted decision is in the record and the final report.
446
+ - In a delegated session, every critical decision has actual recorded user
447
+ authority; an uncovered one was asked when permitted or remains open. Every
448
+ adopted decision is in the record and the final report.
393
449
  - Nothing entered the tree that the request did not need.
450
+ - No griller started for a step with no open design decision.
394
451
  - Later rounds ask what the first round could not have asked.
395
452
  - Facts were looked up rather than asked for.
396
453
  - Work running in the background did not stall the round — only the questions