qfai 2.1.1 → 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 (134) hide show
  1. package/README.md +56 -36
  2. package/assets/defaults/agent-routing/qfai-triage.yml +9 -0
  3. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  4. package/assets/init/.claude/settings.json +27 -9
  5. package/assets/init/.codex/hooks.json +20 -8
  6. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  7. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  8. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  9. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  10. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  11. package/assets/init/.qfai/assistant/rule/drift-protocol.md +58 -2
  12. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +6 -4
  13. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  14. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +15 -25
  15. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +8 -8
  16. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  17. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -3
  18. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +3 -7
  19. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  20. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +1 -6
  21. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  22. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +9 -3
  23. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  24. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +46 -0
  25. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +3 -0
  26. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +3 -3
  27. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +12 -6
  28. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +1 -265
  29. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  30. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +4 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +2 -3
  32. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +17 -1
  33. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +30 -17
  34. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  35. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +47 -24
  36. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +218 -11
  37. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +4 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +14 -0
  39. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +4 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -0
  41. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +23 -5
  42. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +8 -0
  43. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -4
  44. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +132 -4
  45. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +14 -2
  46. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +114 -0
  47. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -29
  48. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +38 -1
  49. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +3 -0
  51. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +29 -19
  52. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +5 -4
  53. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  54. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +72 -7
  55. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +35 -21
  56. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  57. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  58. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  59. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  60. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  61. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  62. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  63. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +0 -4
  64. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +98 -8
  65. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +3 -2
  66. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +1 -0
  67. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  68. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +1 -3
  69. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  70. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  71. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +4 -1
  72. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  73. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  74. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +3 -3
  75. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  76. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +4 -3
  77. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  78. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  79. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +6 -5
  80. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +1 -1
  81. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  82. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +39 -5
  83. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  84. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  85. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  86. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  87. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +1 -3
  88. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  89. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  90. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  91. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +30 -8
  92. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +5 -4
  93. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  94. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  95. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  96. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  97. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  98. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  99. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  100. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  101. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  102. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +1 -0
  103. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +37 -9
  104. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  105. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +7 -16
  106. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  107. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +6 -4
  108. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +121 -30
  109. package/assets/init/root/.agents/rules/ai-readable-markdown.md +2 -2
  110. package/assets/init/root/.agents/rules/api-budget.md +187 -8
  111. package/assets/init/root/.agents/rules/documentation-clarity.md +162 -33
  112. package/assets/init/root/.agents/rules/minimal-implementation.md +3 -3
  113. package/assets/init/root/.agents/rules/reminders.json +27 -14
  114. package/assets/init/root/.agents/rules/session-feedback.md +136 -0
  115. package/assets/init/root/.agents/rules/temporary-files.md +33 -0
  116. package/assets/init/root/.agents/rules/user-questions.md +48 -37
  117. package/assets/init/root/.github/workflows/qfai-docs.yml +1 -1
  118. package/assets/init/root/AGENTS.md +23 -22
  119. package/assets/sandbox-templates/default-deny.yaml +9 -3
  120. package/assets/schemas/workflow/extraction.schema.json +85 -5
  121. package/assets/uix-rev/comparison-review.md +1 -1
  122. package/assets/uix-rev/contracts-review.md +1 -2
  123. package/dist/cli/index.cjs +6697 -8810
  124. package/dist/cli/index.cjs.map +1 -1
  125. package/dist/cli/index.mjs +6036 -8152
  126. package/dist/cli/index.mjs.map +1 -1
  127. package/dist/index.cjs +4947 -7746
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.cts +18 -658
  130. package/dist/index.d.ts +18 -658
  131. package/dist/index.mjs +4866 -7640
  132. package/dist/index.mjs.map +1 -1
  133. package/package.json +4 -6
  134. package/assets/init/root/CLAUDE.md +0 -46
@@ -43,6 +43,154 @@ asking it once costs what asking about a single item costs.
43
43
  Three branches polled separately spend three times what the answer needs, and
44
44
  the multiplier grows with the work rather than staying put.
45
45
 
46
+ ### A first snapshot of two pull requests
47
+
48
+ When git and a REST listing cannot answer the combined CI and review question,
49
+ use aliases and a common fragment. Supply the repository owner, name and two
50
+ pull-request numbers as variables. This query reads the first pages only.
51
+
52
+ ```graphql
53
+ query PullRequestSnapshot($owner: String!, $name: String!, $firstPR: Int!, $secondPR: Int!) {
54
+ repository(owner: $owner, name: $name) {
55
+ first: pullRequest(number: $firstPR) {
56
+ ...PullRequestState
57
+ }
58
+ second: pullRequest(number: $secondPR) {
59
+ ...PullRequestState
60
+ }
61
+ }
62
+ }
63
+
64
+ fragment PullRequestState on PullRequest {
65
+ id
66
+ number
67
+ headRefOid
68
+ state
69
+ mergeable
70
+ commits(last: 1) {
71
+ nodes {
72
+ commit {
73
+ id
74
+ oid
75
+ statusCheckRollup {
76
+ id
77
+ state
78
+ contexts(first: 50, after: null) {
79
+ nodes {
80
+ __typename
81
+ ... on CheckRun {
82
+ id
83
+ name
84
+ status
85
+ conclusion
86
+ detailsUrl
87
+ completedAt
88
+ }
89
+ ... on StatusContext {
90
+ id
91
+ context
92
+ state
93
+ targetUrl
94
+ }
95
+ }
96
+ pageInfo {
97
+ hasNextPage
98
+ endCursor
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ pageInfo {
105
+ hasPreviousPage
106
+ startCursor
107
+ }
108
+ }
109
+ reviewThreads(first: 50, after: null) {
110
+ nodes {
111
+ id
112
+ isResolved
113
+ isOutdated
114
+ comments(first: 20, after: null) {
115
+ nodes {
116
+ id
117
+ body
118
+ author {
119
+ login
120
+ }
121
+ createdAt
122
+ updatedAt
123
+ url
124
+ }
125
+ pageInfo {
126
+ hasNextPage
127
+ endCursor
128
+ }
129
+ }
130
+ }
131
+ pageInfo {
132
+ hasNextPage
133
+ endCursor
134
+ }
135
+ }
136
+ reviews(first: 50, after: null) {
137
+ nodes {
138
+ id
139
+ state
140
+ body
141
+ author {
142
+ login
143
+ }
144
+ submittedAt
145
+ commit {
146
+ oid
147
+ }
148
+ url
149
+ }
150
+ pageInfo {
151
+ hasNextPage
152
+ endCursor
153
+ }
154
+ }
155
+ comments(first: 50, after: null) {
156
+ nodes {
157
+ id
158
+ body
159
+ author {
160
+ login
161
+ }
162
+ createdAt
163
+ updatedAt
164
+ url
165
+ }
166
+ pageInfo {
167
+ hasNextPage
168
+ endCursor
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ - Keep a separate cursor for each PR's contexts, threads, reviews and comments,
175
+ and for each thread's comments. While `hasNextPage` is true, fetch that
176
+ connection with its own `endCursor` as `after`, retaining earlier pages.
177
+ Batch independent next-page requests with distinct aliases and variables;
178
+ never reuse one connection's cursor for another.
179
+ - `commits(last: 1)` selects the head evidence, not the full commit history.
180
+ Its commit `oid` must equal that PR's `headRefOid`. Earlier commits indicated
181
+ by `hasPreviousPage` need not be fetched for this head check.
182
+ - Require every page of the status and review connections before claiming
183
+ coverage. API errors, null PRs or required evidence, missing heads, or an OID
184
+ mismatch leave the snapshot incomplete. A null rollup does not prove CI passed.
185
+ If the head changes during pagination, discard that head's coverage and
186
+ collect a new snapshot. Apply the project's completion and merge rules only
187
+ to complete evidence for the current head.
188
+
189
+ GitHub's [pull-request fields](https://docs.github.com/en/graphql/reference/pulls),
190
+ [commit status fields](https://docs.github.com/en/graphql/reference/commits) and
191
+ [pagination guide](https://docs.github.com/en/graphql/guides/using-pagination-in-the-graphql-api)
192
+ define the query's fields and cursors.
193
+
46
194
  ## 3. Save a payload once and read it locally
47
195
 
48
196
  A log, a diff or a listing that will be searched more than once is written to
@@ -60,17 +208,48 @@ already said.
60
208
  Where the subject's duration is unknown, ask once, wait, and widen the gap as
61
209
  the wait grows.
62
210
 
211
+ ### One watcher for the task
212
+
213
+ The root agent names one API watcher for recurring hosted-state checks. The
214
+ root and all its descendants together have at most one such watcher. Other
215
+ workers read its saved payloads and request fresh snapshots from it. Save the
216
+ capture time, covered PRs and heads, pagination state and response headers with
217
+ each payload so workers can judge whether it answers their question.
218
+
219
+ Coordinate targets and timing with other known tasks using the same account;
220
+ reuse their watcher where it can cover the combined set. This does not reserve
221
+ the account or guarantee exclusive access against unknown sessions. It limits
222
+ API polling, not workers doing local work or making necessary non-polling calls.
223
+
224
+ These are operating instructions. The reminder does not elect a watcher or
225
+ enforce the limit.
226
+
63
227
  ## 5. `rate_limit` is not the budget
64
228
 
65
- A dedicated rate-limit endpoint can report a stale or wrong figure. One has
66
- answered `0` calls used against a token that a real endpoint reported, minutes
67
- later, as most of the way through its allowance. An agent that trusts the
68
- endpoint reads reassurance and keeps spending.
229
+ Read the budget from the response to a call that was going to be made anyway,
230
+ never a dedicated `rate_limit` probe. Record that response's resource, remaining count
231
+ and reset time. On GitHub these are `x-ratelimit-resource`,
232
+ `x-ratelimit-remaining` and `x-ratelimit-reset`; also retain `Retry-After` when
233
+ present. REST and GraphQL have separate primary allowances. Missing headers
234
+ leave the budget unknown; a saved count is not a reservation for the next call.
235
+
236
+ ### Recover from an actual refusal
237
+
238
+ When a real response refuses a request because of a rate limit, stop calls to
239
+ the affected resource and tell the watcher and known account-sharing tasks.
240
+ A successful HTTP status with a rate-limit error in the body is also a refusal.
241
+ For a secondary limit, pause affected requests across REST and GraphQL for the
242
+ same account. Changing tokens or API surfaces is not recovery.
243
+ Wait for `Retry-After` and any applicable reset time. For a secondary limit
244
+ with neither delay nor an exhausted primary allowance, wait at least one minute.
69
245
 
70
- The instrument is the response to a call that was going to be made anyway.
71
- Every response carries the remaining count, the reset time and the name of the
72
- allowance it was drawn from — and that last one is what says which allowance a
73
- refusal came from, where REST and GraphQL are counted separately.
246
+ After the wait, make one real request already needed for the work. Resume that
247
+ resource only when the request succeeds and its own headers show available
248
+ budget. If it is refused again or the headers are missing, keep it stopped;
249
+ do not run a retry loop or a `rate_limit` probe. Continue work that needs no
250
+ call to that resource. GitHub's
251
+ [rate-limit guidance](https://docs.github.com/en/graphql/overview/rate-limits-and-query-limits-for-the-graphql-api)
252
+ describes the refusal signals and wait headers.
74
253
 
75
254
  ## The command, where there is one
76
255
 
@@ -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
 
@@ -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.
@@ -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. Reply in the user's working language (.qfai/assistant/rule/communication.md), however much of what you have read this turn, such as tool output and agent reports, is in another. 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. 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."
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
  }