@mmerterden/multi-agent-pipeline 23.3.0 → 23.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +25 -6
  3. package/README.tr.md +26 -7
  4. package/docs/adr/0008-installer-modularization-and-secret-leak-defense.md +1 -1
  5. package/docs/adr/0010-own-code-graph.md +299 -8
  6. package/docs/architecture.md +3 -3
  7. package/docs/ecosystem.md +10 -10
  8. package/docs/engineering.md +4 -4
  9. package/docs/facts.json +8 -8
  10. package/docs/features.md +5 -5
  11. package/docs/performance.md +17 -17
  12. package/install/_dev-only-files.mjs +9 -0
  13. package/install/claude.mjs +28 -2
  14. package/install/templates/claude-hooks.json +32 -1
  15. package/manifest.json +223 -155
  16. package/package.json +11 -3
  17. package/pipeline/commands/multi-agent/SKILL.md +1 -1
  18. package/pipeline/commands/multi-agent/design-check/SKILL.md +2 -2
  19. package/pipeline/commands/multi-agent/diff-explain/SKILL.md +3 -3
  20. package/pipeline/commands/multi-agent/graph/SKILL.md +57 -24
  21. package/pipeline/commands/multi-agent/pair/SKILL.md +92 -0
  22. package/pipeline/commands/multi-agent/prune-prompts/SKILL.md +1 -1
  23. package/pipeline/commands/multi-agent/search/SKILL.md +7 -1
  24. package/pipeline/commands/multi-agent/status/SKILL.md +4 -0
  25. package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
  26. package/pipeline/contract/CHANGELOG.md +49 -0
  27. package/pipeline/contract/build.mjs +13 -1
  28. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  29. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  30. package/pipeline/contract/fixtures/runs-awaiting-question.json +4 -1
  31. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  32. package/pipeline/contract/fixtures/runs-failed.json +4 -1
  33. package/pipeline/contract/fixtures/runs-old-schema.json +3 -0
  34. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +4 -1
  35. package/pipeline/contract/fixtures/runs-pr-opened.json +4 -1
  36. package/pipeline/contract/fixtures/runs-running.json +4 -1
  37. package/pipeline/contract/manifest.json +28 -15
  38. package/pipeline/contract/types/index.d.ts +55 -3
  39. package/pipeline/lib/detach-self.mjs +95 -0
  40. package/pipeline/lib/public-mcp-servers.mjs +33 -0
  41. package/pipeline/lib/rotated-log.mjs +93 -0
  42. package/pipeline/lib/tls-trust.mjs +29 -0
  43. package/pipeline/lib/usage-lifecycle.mjs +9 -11
  44. package/pipeline/lib/usage-names.generated.mjs +614 -0
  45. package/pipeline/lib/usage-run-key.mjs +235 -0
  46. package/pipeline/lib/usage-vocab.mjs +210 -0
  47. package/pipeline/multi-agent-refs/analysis/intake.md +2 -2
  48. package/pipeline/multi-agent-refs/analysis/render.md +1 -1
  49. package/pipeline/multi-agent-refs/channels/generator.md +4 -5
  50. package/pipeline/multi-agent-refs/cross-cli-contract.md +3 -3
  51. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +1 -1
  52. package/pipeline/multi-agent-refs/features/code-graph.md +146 -11
  53. package/pipeline/multi-agent-refs/features/code-intelligence.md +16 -14
  54. package/pipeline/multi-agent-refs/features/dev-critic.md +7 -7
  55. package/pipeline/multi-agent-refs/features/model-fallback.md +6 -4
  56. package/pipeline/multi-agent-refs/features/remote-control.md +252 -0
  57. package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
  58. package/pipeline/multi-agent-refs/features/review-file-set.md +3 -3
  59. package/pipeline/multi-agent-refs/features/review-multi-repo.md +1 -1
  60. package/pipeline/multi-agent-refs/features/session-brief.md +42 -0
  61. package/pipeline/multi-agent-refs/features/skill-conformance.md +3 -3
  62. package/pipeline/multi-agent-refs/features/usage-reporting.md +252 -24
  63. package/pipeline/multi-agent-refs/help/en.md +3 -2
  64. package/pipeline/multi-agent-refs/help/tr.md +3 -2
  65. package/pipeline/multi-agent-refs/knowledge.md +1 -1
  66. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +1 -1
  67. package/pipeline/multi-agent-refs/phases/operations.md +2 -2
  68. package/pipeline/multi-agent-refs/phases/phase-0-init.md +13 -12
  69. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
  70. package/pipeline/multi-agent-refs/phases/phase-3-review.md +2 -0
  71. package/pipeline/multi-agent-refs/phases/phase-5-report.md +1 -1
  72. package/pipeline/multi-agent-refs/platform-parity.md +2 -2
  73. package/pipeline/multi-agent-refs/wiki-capture.md +3 -17
  74. package/pipeline/office/index.html +1207 -233
  75. package/pipeline/office/toolkit.json +1 -1
  76. package/pipeline/rules/outside-the-pipeline.md +1 -1
  77. package/pipeline/schemas/activity.schema.json +23 -0
  78. package/pipeline/schemas/agent-state.schema.json +6 -1
  79. package/pipeline/schemas/code-graph-calls.schema.json +254 -0
  80. package/pipeline/schemas/code-graph-docs.schema.json +223 -0
  81. package/pipeline/schemas/code-graph-infra.schema.json +227 -0
  82. package/pipeline/schemas/code-graph.schema.json +2 -2
  83. package/pipeline/schemas/examples/design-check-config.json +27 -0
  84. package/pipeline/schemas/learning-curve.schema.json +67 -0
  85. package/pipeline/schemas/office-jobs.json +69 -2
  86. package/pipeline/schemas/office-jobs.schema.json +8 -1
  87. package/pipeline/schemas/phases.json +5 -0
  88. package/pipeline/schemas/phases.schema.json +8 -0
  89. package/pipeline/schemas/prefs.schema.json +46 -12
  90. package/pipeline/schemas/runs-index.schema.json +17 -0
  91. package/pipeline/schemas/toolkit-path-params.json +84 -8
  92. package/pipeline/scripts/README.md +1 -0
  93. package/pipeline/scripts/_code-graph.mjs +184 -103
  94. package/pipeline/scripts/_contract-core.mjs +1 -1
  95. package/pipeline/scripts/_contract-routes-office.mjs +21 -0
  96. package/pipeline/scripts/_diff-impact.mjs +21 -2
  97. package/pipeline/scripts/_graph-sidecars.mjs +372 -0
  98. package/pipeline/scripts/_http-post.mjs +103 -115
  99. package/pipeline/scripts/_safe-read.mjs +57 -0
  100. package/pipeline/scripts/_skill-practices.mjs +26 -0
  101. package/pipeline/scripts/_strip-code.mjs +380 -0
  102. package/pipeline/scripts/activity-snapshot.mjs +13 -1
  103. package/pipeline/scripts/aggregate-metrics.mjs +3 -5
  104. package/pipeline/scripts/call-graph/index.mjs +78 -0
  105. package/pipeline/scripts/call-graph/lang/cpp.mjs +308 -0
  106. package/pipeline/scripts/call-graph/lang/csharp.mjs +130 -0
  107. package/pipeline/scripts/call-graph/lang/go.mjs +303 -0
  108. package/pipeline/scripts/call-graph/lang/java.mjs +370 -0
  109. package/pipeline/scripts/call-graph/lang/kotlin.mjs +397 -0
  110. package/pipeline/scripts/call-graph/lang/python.mjs +399 -0
  111. package/pipeline/scripts/call-graph/lang/rust.mjs +345 -0
  112. package/pipeline/scripts/call-graph/lang/shared.mjs +230 -0
  113. package/pipeline/scripts/call-graph/lang/swift.mjs +432 -0
  114. package/pipeline/scripts/call-graph/lang/typescript.mjs +692 -0
  115. package/pipeline/scripts/call-graph/lex.mjs +396 -0
  116. package/pipeline/scripts/call-graph/platform.mjs +86 -0
  117. package/pipeline/scripts/call-graph/profiles.mjs +89 -0
  118. package/pipeline/scripts/call-graph/resolve.mjs +1125 -0
  119. package/pipeline/scripts/call-graph/scan.mjs +267 -0
  120. package/pipeline/scripts/code-graph-rules/android.json +7 -2
  121. package/pipeline/scripts/code-graph-rules/cpp.json +99 -0
  122. package/pipeline/scripts/code-graph-rules/csharp.json +102 -0
  123. package/pipeline/scripts/code-graph-rules/go.json +2 -1
  124. package/pipeline/scripts/code-graph-rules/ios.json +3 -1
  125. package/pipeline/scripts/code-graph-rules/java.json +76 -0
  126. package/pipeline/scripts/code-graph-rules/node.json +7 -2
  127. package/pipeline/scripts/code-graph-rules/python.json +6 -2
  128. package/pipeline/scripts/code-graph-rules/rust.json +105 -0
  129. package/pipeline/scripts/contract-server.mjs +1 -0
  130. package/pipeline/scripts/feedback-send.mjs +26 -26
  131. package/pipeline/scripts/gate-ledger.mjs +2 -1
  132. package/pipeline/scripts/gen-usage-names.mjs +124 -0
  133. package/pipeline/scripts/graph-affected.mjs +109 -20
  134. package/pipeline/scripts/graph-build.mjs +95 -15
  135. package/pipeline/scripts/graph-export.mjs +272 -0
  136. package/pipeline/scripts/graph-hint.mjs +15 -2
  137. package/pipeline/scripts/graph-query.mjs +305 -26
  138. package/pipeline/scripts/graph-report.mjs +187 -1
  139. package/pipeline/scripts/health-report.mjs +3 -4
  140. package/pipeline/scripts/infra/docs.mjs +317 -0
  141. package/pipeline/scripts/infra/extract.mjs +998 -0
  142. package/pipeline/scripts/infra/graph.mjs +245 -0
  143. package/pipeline/scripts/infra/yaml-lite.mjs +311 -0
  144. package/pipeline/scripts/job-launch.mjs +67 -2
  145. package/pipeline/scripts/learning-curve.mjs +288 -178
  146. package/pipeline/scripts/log-metric.sh +10 -1
  147. package/pipeline/scripts/note-agent-event.mjs +3 -4
  148. package/pipeline/scripts/note-command-use.mjs +333 -0
  149. package/pipeline/scripts/note-command-use.sh +126 -0
  150. package/pipeline/scripts/note-mcp-call.sh +89 -0
  151. package/pipeline/scripts/note-mcp-failure.mjs +272 -1
  152. package/pipeline/scripts/note-session.sh +62 -3
  153. package/pipeline/scripts/note-skill-use.mjs +58 -2
  154. package/pipeline/scripts/office-build.mjs +115 -1
  155. package/pipeline/scripts/office-memory.mjs +14 -5
  156. package/pipeline/scripts/pair.mjs +333 -0
  157. package/pipeline/scripts/pre-push-check.sh +1 -1
  158. package/pipeline/scripts/remote/cbor.mjs +128 -0
  159. package/pipeline/scripts/remote/contract.mjs +98 -0
  160. package/pipeline/scripts/remote/handler.mjs +317 -0
  161. package/pipeline/scripts/remote/handles.mjs +57 -0
  162. package/pipeline/scripts/remote/lifecycle.mjs +186 -0
  163. package/pipeline/scripts/remote/listener.mjs +204 -0
  164. package/pipeline/scripts/remote/lockout.mjs +103 -0
  165. package/pipeline/scripts/remote/nonces.mjs +61 -0
  166. package/pipeline/scripts/remote/pairing.mjs +519 -0
  167. package/pipeline/scripts/remote/qr-encode.mjs +459 -0
  168. package/pipeline/scripts/remote/store.mjs +188 -0
  169. package/pipeline/scripts/remote/transport.mjs +211 -0
  170. package/pipeline/scripts/remote/verbs.json +70 -0
  171. package/pipeline/scripts/remote/verbs.mjs +217 -0
  172. package/pipeline/scripts/remote/webauthn.mjs +169 -0
  173. package/pipeline/scripts/remote/wire.mjs +364 -0
  174. package/pipeline/scripts/remote-listener.mjs +83 -0
  175. package/pipeline/scripts/route-learn.mjs +4 -4
  176. package/pipeline/scripts/run-kill.mjs +1 -1
  177. package/pipeline/scripts/run-write.mjs +13 -2
  178. package/pipeline/scripts/runs-index.mjs +30 -3
  179. package/pipeline/scripts/search-logs.sh +9 -0
  180. package/pipeline/scripts/session-brief.mjs +458 -0
  181. package/pipeline/scripts/session-brief.sh +130 -0
  182. package/pipeline/scripts/test-gap-rules/cpp.json +25 -0
  183. package/pipeline/scripts/test-gap-rules/csharp.json +20 -0
  184. package/pipeline/scripts/test-gap-rules/java.json +20 -0
  185. package/pipeline/scripts/test-gap-rules/rust.json +14 -0
  186. package/pipeline/scripts/token-budget-report.mjs +3 -2
  187. package/pipeline/scripts/uninstall.mjs +29 -0
  188. package/pipeline/scripts/usage-access.mjs +16 -31
  189. package/pipeline/scripts/usage-health.mjs +31 -62
  190. package/pipeline/scripts/usage-register-beacon.mjs +11 -22
  191. package/pipeline/scripts/usage-register.mjs +39 -29
  192. package/pipeline/scripts/usage-report.mjs +579 -178
  193. package/pipeline/scripts/validate-code-graph.mjs +361 -111
  194. package/pipeline/scripts/write-state.mjs +39 -0
  195. package/pipeline/skills/.skill-manifest.json +21 -17
  196. package/pipeline/skills/.skills-index.json +13 -2
  197. package/pipeline/skills/shared/README.md +5 -4
  198. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +1 -1
  199. package/pipeline/skills/shared/core/multi-agent-diff-explain/SKILL.md +3 -3
  200. package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +55 -21
  201. package/pipeline/skills/shared/core/multi-agent-pair/SKILL.md +41 -0
  202. package/pipeline/skills/shared/core/multi-agent-prune-prompts/SKILL.md +1 -1
  203. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
  204. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +2 -3
  205. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +2 -2
  206. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +2 -2
  207. package/pipeline/skills/shared/external/app-store-review/SKILL.md +11 -4
  208. package/pipeline/skills/shared/external/build-settings-audit/SKILL.md +1 -1
  209. package/pipeline/skills/shared/external/build-time-benchmark/SKILL.md +5 -5
  210. package/pipeline/skills/shared/external/build-time-fixes/SKILL.md +5 -5
  211. package/pipeline/skills/shared/external/build-time-optimizer/SKILL.md +6 -6
  212. package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +1 -0
  213. package/pipeline/skills/shared/external/ios-coding-standard/references/STANDARD.md +2 -2
  214. package/pipeline/skills/shared/external/ios-haptics/references/core-haptics.md +1 -1
  215. package/pipeline/skills/shared/external/localization-reuse-map/references/publish-and-snapshot.md +1 -1
  216. package/pipeline/skills/shared/external/package-build-audit/SKILL.md +3 -3
  217. package/pipeline/skills/shared/external/reverse-engineer-own-app/SKILL.md +2 -3
  218. package/pipeline/skills/shared/external/swift-compile-hotspots/SKILL.md +2 -2
  219. package/pipeline/skills/shared/external/weatherkit/SKILL.md +5 -6
  220. package/pipeline/skills/skills-index.md +3 -2
  221. package/docs/FIGMA_PIPELINE.md +0 -137
  222. package/pipeline/lib/identifier-scan.mjs +0 -156
  223. package/pipeline/scripts/publish-staged.mjs +0 -324
  224. package/pipeline/skills/shared/external/ios-coding-standard/scripts/check_structure.py +0 -765
package/docs/ecosystem.md CHANGED
@@ -5,9 +5,9 @@ separately, wired together at install time and at run time:
5
5
 
6
6
  | Repo | What it owns | Ships as |
7
7
  |---|---|---|
8
- | **`multi-agent-pipeline`** (this repo) | Orchestration: the <!-- fact:phaseCount -->6<!-- /fact -->-phase flow, the <!-- fact:commandCount -->79<!-- /fact --> slash commands, quality gates, review/triage, cross-CLI parity | npm package (`@mmerterden/multi-agent-pipeline`), installs itself onto Claude Code / Copilot CLI / Codex CLI |
8
+ | **`multi-agent-pipeline`** (this repo) | Orchestration: the <!-- fact:phaseCount -->6<!-- /fact -->-phase flow, the <!-- fact:commandCount -->80<!-- /fact --> slash commands, quality gates, review/triage, cross-CLI parity | npm package (`@mmerterden/multi-agent-pipeline`), installs itself onto Claude Code / Copilot CLI / Codex CLI |
9
9
  | **`multi-agent-plugins`** | Stack knowledge: per-platform component/lifecycle skills (iOS, Android, Frontend, Backend) + shared knowledge | Claude Code marketplace, 6 independently-versioned plugins |
10
- | **`multi-agent-mcp`** | The pipeline's hands on devices and browsers: <!-- fact:toolCount -->251<!-- /fact --> MCP tools across <!-- fact:toolFamilyCount -->25<!-- /fact --> families (simulator/emulator control, end-to-end locators and assertions, memory, crash diagnostics, accessibility audit, store compliance and listing lint, web automation and scraping, Figma-vs-mock design audit with contrast checks, code intelligence, a code graph, a learnings ledger, wallet passes, an agent-DSL batch runner, a full-text context index with text-to-image rendering, provider-backed and community research, opt-in social reading, verified hand-off of simple text tasks to free models, video key frames and transcripts, offline security scoring with evidence checks, SARIF export and MCP config launch-selector audits, read-only access to related repositories at their latest branch, travel document fixtures, a voice channel, App Store Connect and Play Console APIs, virtual iPhones, offline facts about builds you own) | npm package, registered as a standard stdio MCP server on every host |
10
+ | **`multi-agent-mcp`** | The pipeline's hands on devices and browsers: <!-- fact:toolCount -->259<!-- /fact --> MCP tools across <!-- fact:toolFamilyCount -->25<!-- /fact --> families (simulator/emulator control, end-to-end locators and assertions, memory, crash diagnostics, accessibility audit, store compliance and listing lint, web automation and scraping, Figma-vs-mock design audit with contrast checks, code intelligence, a code graph, a learnings ledger, wallet passes, an agent-DSL batch runner, a full-text context index with text-to-image rendering, provider-backed and community research, opt-in social reading, verified hand-off of simple text tasks to free models, video key frames and transcripts, offline security scoring with evidence checks, SARIF export and MCP config launch-selector audits, read-only access to related repositories at their latest branch, travel document fixtures, a voice channel, App Store Connect and Play Console APIs, virtual iPhones, offline facts about builds you own) | npm package, registered as a standard stdio MCP server on every host |
11
11
 
12
12
  None of the three depends on the others at the code level. They compose through two
13
13
  narrow contracts: the **Skill tool** (pipeline → plugin, at Phase 2) and the **MCP
@@ -19,7 +19,7 @@ Either can be swapped or removed without touching the other two's source.
19
19
  graph LR
20
20
  subgraph PIPE ["multi-agent-pipeline (orchestrator)"]
21
21
  direction TB
22
- PHASES["6 phases · 79 commands"]
22
+ PHASES["6 phases · 80 commands"]
23
23
  GATES["deterministic gates + review triage"]
24
24
  end
25
25
 
@@ -70,8 +70,8 @@ only those:
70
70
  graph TD
71
71
  CC["Claude Code<br/>~/.claude/commands/multi-agent/<br/>(source of truth)"]
72
72
 
73
- CC -->|"Step 2: copy + reformat<br/>79 sub-command skills"| COP["Copilot CLI<br/>~/.copilot/skills/"]
74
- CC -->|"Step 2b: transform<br/>(install.js --codex)"| COD["Codex CLI<br/>1 router skill + 79 refs<br/>+ 11 agent TOML"]
73
+ CC -->|"Step 2: copy + reformat<br/>80 sub-command skills"| COP["Copilot CLI<br/>~/.copilot/skills/"]
74
+ CC -->|"Step 2b: transform<br/>(install.js --codex)"| COD["Codex CLI<br/>1 router skill + 80 refs<br/>+ 11 agent TOML"]
75
75
  CC -->|"Step 3: genericize<br/>(strip personal data)"| REPO["multi-agent-pipeline repo<br/>pipeline/"]
76
76
  CC -->|"Step 4: version + feature sync"| WEB["Website<br/>projects.ts / i18n.tsx"]
77
77
 
@@ -162,7 +162,7 @@ measurements behind this table):
162
162
 
163
163
  | | Claude Code | Copilot CLI | Codex CLI |
164
164
  |---|---|---|---|
165
- | **Pipeline commands** | <!-- fact:commandCount -->79<!-- /fact --> slash-command skills, native | <!-- fact:commandCount -->79<!-- /fact --> sub-command skills, `multi-agent-{cmd}` naming, copied in | 1 router skill (`multi-agent`) + <!-- fact:commandCount -->79<!-- /fact --> command specs as reference files - Codex silently truncates its skills block past a few dozen entries, so sub-commands are not peer skills here |
165
+ | **Pipeline commands** | <!-- fact:commandCount -->80<!-- /fact --> slash-command skills, native | <!-- fact:commandCount -->80<!-- /fact --> sub-command skills, `multi-agent-{cmd}` naming, copied in | 1 router skill (`multi-agent`) + <!-- fact:commandCount -->80<!-- /fact --> command specs as reference files - Codex silently truncates its skills block past a few dozen entries, so sub-commands are not peer skills here |
166
166
  | **Stack plugins** | Marketplace plugin, loaded natively, resolved by `.claude/settings.json` enabled-list | Enabled plugin's authored skills copied flat into `~/.copilot/skills/`; `knowledge/` **not** re-copied (already delivered via `shared/external`) | Copied as reference files under `~/.codex/multi-agent-refs/skills/`, plugin-prefixed on name clash (e.g. `architecture` → `ai-ios-toolkit-architecture`) |
167
167
  | **Component dispatch (Phase 3)** | Marketplace plugin's `create-component`/`create-screen` skill via the Skill tool | No plugin loader - the enabled stack plugin's authored skills (incl. `create-component`) are copied flat into `~/.copilot/skills/` at install time (the old frozen `figma-*` copies are pruned, they were never a fallback) | Not part of the enforced parity axis; classification + state-shape must match, skill *inventory* does not |
168
168
  | **multi-agent-mcp** | `claude mcp add multi-agent -- npx -y @mmerterden/multi-agent-mcp` | `copilot mcp add multi-agent -- npx -y @mmerterden/multi-agent-mcp` | `codex mcp add multi-agent -- npx -y @mmerterden/multi-agent-mcp` (skipped with a warning if `codex` isn't on `PATH`) |
@@ -239,8 +239,8 @@ Detail: [`unattended-security.md`](../pipeline/multi-agent-refs/features/unatten
239
239
 
240
240
  ### multi-agent-mcp's tools, by category
241
241
 
242
- <!-- fact:toolCount -->251<!-- /fact --> tools in <!-- fact:toolFamilyCount -->25<!-- /fact --> families, counted from the server's own `tools/list` response
243
- at toolkit <!-- fact:toolkitVersion -->4.2.0<!-- /fact --> rather than from a README. Three families are defined in
242
+ <!-- fact:toolCount -->259<!-- /fact --> tools in <!-- fact:toolFamilyCount -->25<!-- /fact --> families, counted from the server's own `tools/list` response
243
+ at toolkit <!-- fact:toolkitVersion -->4.3.0<!-- /fact --> rather than from a README. Three families are defined in
244
244
  modules the main file only spreads in, so a count taken from the source reads
245
245
  low; the response is the only place the whole surface appears at once. A
246
246
  family is the prefix every tool name carries.
@@ -257,8 +257,8 @@ skill or a command such as `multi-agent:review`. Both qualified forms
257
257
  let `lint-mcp-refs.mjs` check that the tool exists.
258
258
 
259
259
  The families can be narrowed per host: `MCP_TOOLKIT_CAPS` serves only the named
260
- ones, and unset serves all <!-- fact:toolCount -->251<!-- /fact -->. A frontend repo that sets `web,code,context`
261
- sees 50 tools instead of <!-- fact:toolCount -->251<!-- /fact -->, which matters because every registered server's
260
+ ones, and unset serves all <!-- fact:toolCount -->259<!-- /fact -->. A frontend repo that sets `web,code,context`
261
+ sees 50 tools instead of <!-- fact:toolCount -->259<!-- /fact -->, which matters because every registered server's
262
262
  tool list is charged against the context window on every turn.
263
263
 
264
264
  Per-family tool counts are `toolCategories` in [`facts.json`](facts.json), taken from the
@@ -6,10 +6,10 @@ The pipeline's output quality comes less from any single model call and more fro
6
6
 
7
7
  Every loop in the pipeline has a deterministic exit condition and a hard iteration cap. Nothing "keeps trying".
8
8
 
9
- - **TDD micro-loop** (Phase 3): red -> green -> refactor per task; build-fix retries capped at 3 attempts.
10
- - **Dev-critic loop** (Phase 3.5, opt-in): generator vs critic on deterministic criteria; max 2 iterations, round 3 escalates to the user.
11
- - **Review-fix macro-loop** (Phase 3 <-> 4): only triage-accepted blocking findings re-enter development; max 3 iterations, then hard-kill and escalate.
12
- - **Disagreement round** (Phase 4, opt-in): when reviewers split, exactly one rebuttal round - never more.
9
+ - **TDD micro-loop** (Phase 2): red -> green -> refactor per task; build-fix retries capped at 3 attempts.
10
+ - **Dev-critic loop** (Phase 2.5, opt-in): generator vs critic on deterministic criteria; max 2 iterations, round 3 escalates to the user.
11
+ - **Review-fix macro-loop** (Phase 2 <-> 3): only triage-accepted blocking findings re-enter development; max 3 iterations, then hard-kill and escalate.
12
+ - **Disagreement round** (Phase 3, opt-in): when reviewers split, exactly one rebuttal round - never more.
13
13
  - **Global rule**: any retry loop stops after 3 attempts and asks the user. No exceptions, no infinite loops.
14
14
 
15
15
  ## Evidence over claims
package/docs/facts.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by pipeline/scripts/gen-facts.mjs. Do not hand-edit: the site reads this, and a number edited here instead of at its source is the drift this file removes.",
3
- "generatedAt": "2026-11-10",
4
- "version": "23.3.0",
3
+ "generatedAt": "2026-11-11",
4
+ "version": "23.4.0",
5
5
  "phaseSchema": 2,
6
6
  "phases": [
7
7
  {
@@ -36,26 +36,26 @@
36
36
  "analysis": [0, 1, 2, 3, 4, 5]
37
37
  },
38
38
  "reworkCap": 3,
39
- "commandCount": 79,
39
+ "commandCount": 80,
40
40
  "skillCount": 173,
41
- "skillCountAll": 255,
41
+ "skillCountAll": 256,
42
42
  "agentCount": 11,
43
43
  "hosts": ["Claude Code", "Codex CLI", "Copilot CLI"],
44
- "toolCount": 251,
44
+ "toolCount": 259,
45
45
  "toolCategories": {
46
46
  "ios": 42,
47
47
  "web": 38,
48
48
  "android": 35,
49
49
  "store": 35,
50
+ "binary": 12,
50
51
  "vphone": 10,
51
52
  "media": 9,
52
53
  "code": 8,
53
54
  "design": 8,
54
55
  "graph": 8,
55
- "thesis": 7,
56
+ "thesis": 8,
56
57
  "repo": 6,
57
58
  "voice": 6,
58
- "binary": 5,
59
59
  "security": 5,
60
60
  "ui": 5,
61
61
  "context": 4,
@@ -70,5 +70,5 @@
70
70
  "test": 1
71
71
  },
72
72
  "pluginSkillCount": 269,
73
- "toolkitVersion": "4.2.0"
73
+ "toolkitVersion": "4.3.0"
74
74
  }
package/docs/features.md CHANGED
@@ -54,7 +54,7 @@ The install is not only useful while `/multi-agent` is running. `rules/outside-t
54
54
 
55
55
  - **Onboarded service credentials.** Resolve the logical name through `credential-store.sh` and read the issue, page or log. Writes route through the pipeline commands, which carry the rules that make them safe - issues are never auto-closed, PR bodies use `Ref:`, outward prose goes through the humanizer.
56
56
  - **The stack skills enabled for this repo.** Each toolkit's own `index` skill routes. The pipeline reads the effective `enabledPlugins` rather than keeping a stack table, so a seventh toolkit needs no code change.
57
- - **The `multi-agent` MCP.** <!-- fact:toolCount -->251<!-- /fact --> tools, most of them for a running app.
57
+ - **The `multi-agent` MCP.** <!-- fact:toolCount -->259<!-- /fact --> tools, most of them for a running app.
58
58
 
59
59
  Uninstall preserves the whole layer - tokens, the reader that opens them, the mapping that names them, the MCP registration. It is 1.5 kB of always-loaded text; the detail lives in a ref that loads on demand, and a gate keeps both under a ceiling because every byte there is paid by every session.
60
60
 
@@ -207,16 +207,16 @@ Cheap, objective checks run BEFORE any AI token is spent:
207
207
 
208
208
  If any gate fails, fix first. Don't waste AI tokens reviewing broken code.
209
209
 
210
- ### Analysis Document Review (Phase 2.2 + 2.3)
210
+ ### Analysis Document Review (Phase 3.2 + 3.3)
211
211
 
212
- `/multi-agent:analysis` does not publish behind a structural validator alone. Phase 2.2 runs the same
212
+ `/multi-agent:analysis` does not publish behind a structural validator alone. Phase 3.2 runs the same
213
213
  reviewer set and triage a code diff gets, on the draft, before the destination is even chosen. Its first question is what the run skipped -
214
214
  an input declared missing that nothing searched for, an open question about evidence nobody read, a gap
215
215
  with no owner, a scope call made without asking. A blocking finding returns to synthesis with dispatch
216
216
  closed; it never becomes an open question, because "the document is wrong" is not something to ask the
217
217
  reader.
218
218
 
219
- Phase 2.3 then sorts what is left: reachable evidence is searched (never asked about), decisions the
219
+ Phase 3.3 then sorts what is left: reachable evidence is searched (never asked about), decisions the
220
220
  user owns are asked with `AskUserQuestion`, and only genuinely external gaps enter the document as
221
221
  `AS-NN` rows with an owner. A gap carrying neither a `searched, not found` nor an `asked, external`
222
222
  stamp fails the dispatch gate. Autopilot runs both phases; only the asking degrades, into rows stamped
@@ -365,7 +365,7 @@ Commands (`commands.mjs --json`) and run questions (`launch-request.mjs question
365
365
  - **Read-Size Gate** (opt-in, `prefs.global.bulkRead.mode`): a `PreToolUse` hook inspects `Read` and the shell commands that read a file whole. In `observe` it only logs what it would have caught - the baseline you measure before routing anything. In `enforce` a file over `minLines` (default 350) is blocked and delegated to a haiku-rung worker (`bulk-read.sh`), which returns a line-numbered summary so the follow-up is a bounded `Read(offset:limit:)` instead of the whole file; the full text is parked under `.multi-agent/refs/`. The development phase and any file the run has already touched are exempt, because Claude Code's `Edit` requires its own `Read` first.
366
366
  - **Free models for simple work** (opt-in, `/multi-agent:route-on --free`): large-file reads, log and document summaries, field extraction, labels and translation or commit-body drafts go to the multi-agent-mcp's free-model chain (`llm_delegate`) first. Every answer is verified against its source and discarded when it does not hold, Claude takes over whenever none passes, and decisions, plans, code and reviews never leave Claude. By default only providers that do not train on prompts receive text. `route-status` reports what was answered free and the tokens kept off Claude; `doctor --probe` checks each provider key. Contract: `multi-agent-refs/features/free-models.md`.
367
367
  - **Capture Hooks** (`SessionEnd`, `PreCompact`, `SessionStart`): durable writes do not wait for Phase 5, the phase a run is least likely to reach. `SessionEnd` flushes a run that never got there; `PreCompact` flushes before an auto-compaction summarizes a long phase mid-flight, which is the same loss one level down; `SessionStart` prints at most two lines about an unfinished run. None calls a model, none reads a payload, and all exit 0 on every path - a hook that fails a session over bookkeeping is worse than the bookkeeping.
368
- - **Operational Reporting** (`prefs.global.usageLog`): coarse run metadata - task id and type, current phase, run status (in progress, completed, halted, parked), phase durations, whether a PR opened, token counts - sent at every phase transition and at completion, halt and park, and never prompts, code, diffs or absolute paths (task title and PR URL only when `includeTitle` / `includePrUrl` are set). Runs are reported under the GitHub account on the machine that can read the pipeline repository, found with no question asked through gh, the git credential helper or an SSH key (`usage-identity.mjs`, cached in `usageLog.login` / `loginMethod`, `--refresh` to re-check); with no such account nothing is sent. The per-machine token is REQUESTED from the endpoint by `usage-register.mjs` (setup, update, and the Phase 0 exit gate as a backstop), is write-only, and lives in the OS credential store; prefs hold only the entry name and the switch. `usageLog.optOut: true` blocks registration permanently and is checked before the network call. Registration proves the login with that account's gh or credential-helper token, or with an SSH signature over a server challenge. The server issues a token only to the repository owner or a collaborator, pins the login to it, and shows only those accounts' records on the panel. An unreachable endpoint leaves reporting off with one line and exit 0 - a run is never failed over bookkeeping.
368
+ - **Operational Reporting** (`prefs.global.usageLog`): coarse run metadata - a keyed digest of the run id and of the repository, task type, current phase, run status (in progress, completed, halted, parked), phase durations, whether a PR opened, token counts, how many times each shipped `/multi-agent` command was typed (the name and a count, never the arguments or the prompt) - sent at every phase transition and at completion, halt and park, and never prompts, code, diffs or absolute paths (a summary of the task title - word count, ticket shape, language - and the PR URL of github.com, gitlab.com, bitbucket.org or dev.azure.com only when `includeTitle` / `includePrUrl` are set). Runs are reported under the GitHub account on the machine that can read the pipeline repository, found with no question asked through gh, the git credential helper or an SSH key (`usage-identity.mjs`, cached in `usageLog.login` / `loginMethod`, `--refresh` to re-check); with no such account nothing is sent. The per-machine token is REQUESTED from the endpoint by `usage-register.mjs` (setup, update, and the Phase 0 exit gate as a backstop), is write-only, and lives in the OS credential store; prefs hold only the entry name and the switch. `usageLog.optOut: true` blocks registration permanently and is checked before the network call. Registration proves the login with that account's gh or credential-helper token, or with an SSH signature over a server challenge. The server issues a token only to the repository owner or a collaborator, pins the login to it, and shows only those accounts' records on the panel. An unreachable endpoint leaves reporting off with one line and exit 0 - a run is never failed over bookkeeping.
369
369
  - **Post-Edit Syntax Gate** (opt-in, `prefs.global.editSyntaxGate.enabled`): after a file edit, `edit-syntax-gate.sh` parses the file within 2 s (`swiftc -parse`, `node --check`, `py_compile` into a temp dir, JSON, `bash -n`; Kotlin skipped) and hands a syntax error to the model as hook context. It never blocks and stays silent when a parser is missing or slow. Registered on Claude Code and Codex: Claude Code `PostToolUse` on `Edit|Write|MultiEdit` (`claude-hooks.json`), Codex `PostToolUse` on `apply_patch`, checking every file the patch adds, updates or moves to (`codex-hooks.json`, merged into `~/.codex/hooks.json`, run once trusted in Codex's `/hooks`). `/multi-agent:setup` Step 8 offers it; on Codex it calls `host-hooks.mjs install`, and uninstall takes it back. Copilot CLI gets no registration: as of 1.0.45 it loads `~/.copilot/hooks/*.json` but discards a `postToolUse` hook's output and applies no matcher, so the gate would spawn on every tool call and the model would never see its message. Source for the Codex contract: the Codex hooks guide plus `codex-rs` (`hooks/src/engine`, `core/src/tools/handlers/apply_patch.rs`).
370
370
  - **Build Queue**: All `xcodebuild` calls acquire a lock. Each worktree uses own `-derivedDataPath`. Stale locks auto-clean after 15 min. Non-Xcode builds don't need the lock.
371
371
  - **Context Management**: `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=65` - compaction at 65% usage (prevents degradation in <!-- fact:phaseCount -->6<!-- /fact -->-phase sessions).
@@ -48,28 +48,28 @@ _Source: ~/.claude/logs/multi-agent/metrics.jsonl · Events: 421 (0 parse errors
48
48
 
49
49
  ## Reviews
50
50
 
51
- | Metric | Value |
52
- |--------|-------|
53
- | Completed | 28 |
54
- | Cycles per task (avg) | 1.3 |
55
- | Cycles per task (p95) | 2 |
51
+ | Metric | Value |
52
+ | --------------------- | ----- |
53
+ | Completed | 28 |
54
+ | Cycles per task (avg) | 1.3 |
55
+ | Cycles per task (p95) | 2 |
56
56
 
57
57
  ## Triage Classification
58
58
 
59
- | Category | Count | Rate |
60
- |----------|-------|------|
61
- | Raw findings | 167 | - |
62
- | Accepted | 41 | 0.25 |
63
- | Deferred | 19 | - |
64
- | Rejected | 107 | 0.64 |
59
+ | Category | Count | Rate |
60
+ | ------------ | ----- | ---- |
61
+ | Raw findings | 167 | - |
62
+ | Accepted | 41 | 0.25 |
63
+ | Deferred | 19 | - |
64
+ | Rejected | 107 | 0.64 |
65
65
 
66
66
  ## Cost Per Model
67
67
 
68
- | Model | Calls | Duration (ms) | Tokens In | Tokens Out |
69
- |-------|-------|---------------|-----------|------------|
70
- | `claude-fable-5` | 124 | 612430 | 380221 | 92114 |
71
- | `claude-sonnet-4-6` | 89 | 412318 | 201445 | 58903 |
72
- | `gpt-5.4` | 88 | 398214 | 194302 | 55128 |
68
+ | Model | Calls | Duration (ms) | Tokens In | Tokens Out |
69
+ | ------------------- | ----- | ------------- | --------- | ---------- |
70
+ | `claude-fable-5-2` | 124 | 612430 | 380221 | 92114 |
71
+ | `claude-sonnet-5-5` | 89 | 412318 | 201445 | 58903 |
72
+ | `gpt-5.4` | 88 | 398214 | 194302 | 55128 |
73
73
  ```
74
74
 
75
75
  ## Interpreting Review-Cycle Metrics
@@ -110,4 +110,4 @@ template in `phase-5-report.md`.
110
110
 
111
111
  Remove or rename `~/.claude/logs/multi-agent/metrics.jsonl`. The pipeline
112
112
  will not error - `log-metric.sh` fails silently if the file isn't writable.
113
- Nothing is sent off-device.
113
+ This file is never sent off-device. Operational reporting is a separate, coarser record described in `pipeline/multi-agent-refs/features/usage-reporting.md`.
@@ -65,6 +65,8 @@ const DEV_ONLY_TOOLING = Object.freeze([
65
65
  "lint-skills.mjs",
66
66
  "lint-personas.mjs", // imports install/_codex-agents.mjs, which never ships to scripts/
67
67
  "lint-mcp-refs.mjs",
68
+ "lint-unused-exports.mjs", // reads the repo's own source tree; an install has none
69
+ "lint-phase-labels.mjs", // checks the repo's own docs against phases.json; an install has neither
68
70
  "_toolkit-coverage.mjs", // imported only by lint-mcp-refs.mjs, which never ships
69
71
  "check-md-links.mjs",
70
72
  "check-rewrite-overlap.mjs", // compares a rewrite against a source only a maintainer has
@@ -73,7 +75,9 @@ const DEV_ONLY_TOOLING = Object.freeze([
73
75
  "_png-phash.mjs", // imported only by upstream-overlap-gate.mjs, which never ships
74
76
  "gen-free-llm-skill.mjs", // reads the sibling toolkit checkout; an install has none
75
77
  "gen-toolkit-path-params.mjs", // reads the sibling toolkit checkout; an install has none
78
+ "gen-access-check.mjs", // rewrites the repo's own command files; an install has no pipeline/commands source
76
79
  "gen-fact-marks.mjs", // renders the counts in the repo's own docs; an install has no docs/
80
+ "gen-office-command-matrix.mjs", // reads office-src, which an install does not carry
77
81
  "gen-ref-toc.mjs", // regenerates the repo's own reference tree; an install has no pipeline/
78
82
  "ref-filler-audit.mjs", // audits the repo's own instruction docs; an install has no pipeline/
79
83
  "validate-schemas.mjs", // validates the repo's own schema files, needs ajv
@@ -84,6 +88,10 @@ const DEV_ONLY_TOOLING = Object.freeze([
84
88
  // manifest.json into the tarball. It shells `npm pack` against that root,
85
89
  // which in an install is $HOME - so an installed copy could only ever fail.
86
90
  "make-manifest.mjs",
91
+ // Maintainer release step (docs/ecosystem.md): publishes from a clean checkout.
92
+ "publish-staged.mjs",
93
+ // Imported by smoke-personal-data.sh, which never ships.
94
+ "identifier-scan.mjs",
87
95
  ]);
88
96
 
89
97
  /** Eval harnesses (`eval-*.mjs`) read `pipeline/eval/**`, which never ships. */
@@ -94,6 +102,7 @@ export const DEV_ONLY_SCRIPTS = Object.freeze([
94
102
  "smoke-figma-config-schema.sh",
95
103
  "smoke-personal-data.sh", // scanner contains the patterns it detects
96
104
  "smoke-install-leak-gate.sh", // same - scanner shadows the install pipeline
105
+ "_leak-denylist.sh", // loader for the private deny-list the two scanners above read
97
106
  "validate-prefs.mjs", // needs ajv (devDependency); end users have no node_modules here
98
107
  "fixtures", // smoke test fixtures live in the repo only, never ship to users
99
108
  // --- reason 2: maintainer CI ---
@@ -759,12 +759,15 @@ export function quotePipelineHookCommands(hooks) {
759
759
  * The run-scoped hooks the installer registers beside the two gates above:
760
760
  * run-stop-guard.sh (Stop), task-mirror.sh (TaskCreate / TaskUpdate),
761
761
  * answer-check.sh (AskUserQuestion, in every session: it only adds context),
762
- * file-context.sh (after a Read, and before a Read, Grep or Glob), pr-write-guard.sh (asks before a pr-threads.mjs apply writes to GitHub, denies it unattended), run-scope-guard.sh (Figma MCP tools, file edits, Figma over HTTP, direct run-state writes in Bash or WebFetch, and subagent spawns against the cost budget), note-skill-use.sh (after a Skill call, ok or failed) and note-mcp-failure.sh (after a failed MCP tool call). The run hooks are silent outside a pipeline run (file-context also runs everywhere when prefs.global.fileContext.enabled is true) and fail open, so
762
+ * file-context.sh (after a Read, and before a Read, Grep or Glob), pr-write-guard.sh (asks before a pr-threads.mjs apply writes to GitHub, denies it unattended), run-scope-guard.sh (Figma MCP tools, file edits, Figma over HTTP, direct run-state writes in Bash or WebFetch, and subagent spawns against the cost budget), note-skill-use.sh (after a Skill call, ok or failed) and note-mcp-failure.sh (after a failed MCP tool call) and session-brief.sh (at session start: prints a cached ledger index and graph line; inert until prefs.global.sessionBrief.enabled is true). The run hooks are silent outside a pipeline run (file-context also runs everywhere when prefs.global.fileContext.enabled is true) and fail open, so
763
763
  * registering them by default changes nothing until a run is active. note-skill-use.sh runs in every
764
764
  * session, records only the skill name, outcome, time, host and repo folder name into the local
765
765
  * skill-usage log, and is off with prefs.global.skillUsage.enabled false. note-mcp-failure.sh
766
766
  * records only the server, tool, time and a closed error class into the local MCP failure log,
767
- * probes nothing, and is off with prefs.global.mcpFailures.enabled false. Both are off with
767
+ * probes nothing, and is off with prefs.global.mcpFailures.enabled false. note-mcp-call.sh (after
768
+ * a successful MCP call, registered async) appends one line, the session id and the tool name,
769
+ * for the usage record; it starts no node process and does nothing unless
770
+ * prefs.global.usageLog.enabled is true. Both are off with
768
771
  * prefs.global.usageLog.optOut true. The same entries are in install/templates/claude-hooks.json.
769
772
  */
770
773
  export const RUN_HOOKS = [
@@ -844,6 +847,21 @@ export const RUN_HOOKS = [
844
847
  timeout: 5,
845
848
  statusMessage: "Counting the skill call...",
846
849
  },
850
+ {
851
+ event: "PostToolUse",
852
+ matcher: "mcp__.*",
853
+ script: "note-mcp-call.sh",
854
+ async: true,
855
+ timeout: 5,
856
+ statusMessage: "Counting the MCP call...",
857
+ },
858
+ {
859
+ event: "UserPromptSubmit",
860
+ script: "note-command-use.sh",
861
+ async: true,
862
+ timeout: 5,
863
+ statusMessage: "Counting the command...",
864
+ },
847
865
  {
848
866
  event: "PostToolUseFailure",
849
867
  matcher: "Skill",
@@ -858,6 +876,13 @@ export const RUN_HOOKS = [
858
876
  timeout: 5,
859
877
  statusMessage: "Counting the failed MCP call...",
860
878
  },
879
+ {
880
+ event: "SessionStart",
881
+ matcher: "startup|resume|clear|compact",
882
+ script: "session-brief.sh",
883
+ timeout: 5,
884
+ statusMessage: "Loading the session brief...",
885
+ },
861
886
  ];
862
887
 
863
888
  /**
@@ -904,6 +929,7 @@ export function ensureHook(hooks, r) {
904
929
  const hook = {
905
930
  type: "command",
906
931
  command: pipelineHookCommand(r.script),
932
+ ...(r.async === true ? { async: true } : {}),
907
933
  timeout: r.timeout,
908
934
  statusMessage: r.statusMessage,
909
935
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "_readme": "Recommended Claude Code hooks for multi-agent-pipeline. `install` registers the pre-commit and agent-guard gates, the run-scoped run-stop-guard / run-scope-guard hooks, the task-mirror hook, the file-context hook, the skill-usage hook and the MCP failure hook itself (install/claude.mjs configureSettings, RUN_HOOKS); /multi-agent:setup offers to merge the rest of this block. Merge the `hooks` object into your ~/.claude/settings.json to make these deterministic PreToolUse gates real (exit 2 blocks the tool call). A PreToolUse matcher is a regex over the TOOL NAME, so each gate registers on a tool name and reads the command from its stdin payload. Three PreToolUse gates ship here: (1) pre-commit-check.sh on Bash, which acts only on a `git commit` and blocks a secret in the staged diff; (2) agent-guard.sh on Bash, on Edit|Write|NotebookEdit, and on WebFetch plus every multi-agent MCP tool (WebFetch|mcp__multi-agent__.*). Always, it blocks AI/assistant attribution in a commit message and a force-push, delete or mirror push to a protected branch (main/master/develop), including one inside a subshell or a `bash -c` / `eval` line. With MULTI_AGENT_UNATTENDED=1 in the hook's environment it also applies the unattended policy: no push, PR or tracker write, no Keychain read, no fetch outside the host allowlist (curl, WebFetch, the toolkit's web tools, agent_run_steps and open_url), no package install, and no write into a protected path (features/unattended-security.md); (3) check-read-size.sh on Read|Bash, which inspects Read plus the shell commands that read a file whole (cat/head/tail/sed), returns immediately for everything else, and routes an oversized read to a cheap worker instead of the caller's own rung; it is inert until `prefs.global.bulkRead.mode` is set to observe or enforce. Failure behaviour: pre-commit-check.sh and check-read-size.sh fail open on an internal error. agent-guard.sh fails open when attended, so a guard bug cannot break a legitimate tool call, and fails closed under MULTI_AGENT_UNATTENDED=1, where nobody is there to notice a gap. None of the three executes the inspected command, and none needs run-specific arguments. The other deterministic gates (evidence, consensus, intent, learnings) take run-specific arguments and are phase-enforced by the pipeline instead. Three capture hooks ship alongside them and block nothing: (4) SessionEnd runs capture-flush.sh --if-stale, which writes a run's triage findings and durable learnings into the per-repo stores when the run ended before Phase 5, where those writes otherwise happen; the same hook runs note-session.sh, which records the mechanical shape of a session outside the pipeline (tools used, commands that failed, calls the user refused). (4b) SubagentStop and PostToolUseFailure run note-agent-event.sh, which appends one row to the same session notes as the event happens: a subagent's type, id, the bound run's task id and its last message cut to 200 characters (secret-scanned; a hit stores the row without the message), or a failed tool's name and its command's first program word, never an argument or error text. (5) PreCompact runs capture-flush.sh without --if-stale: a compaction summarizes the conversation mid-phase, so it is the moment unflushed findings are at risk, and both writes are idempotent, so a finished run costs two no-op writes. The staleness test exists only so a session exit does not re-flush a run that already finished. (6) SessionStart runs capture-resume.sh, which prints at most two lines: an unfinished run and how to resume it, and a stale pipeline-observation queue. No capture hook calls a model or reads a payload - note-session.sh keeps a command's first word and an exit code, never an argument or any output - and all exit 0 on every path, because a hook that fails a session over bookkeeping costs more than the bookkeeping. A GitHub write gate ships too: (2a) pr-write-guard.sh on Bash answers `ask`, naming the PR and the operation, when the command runs `pr-threads.mjs apply` (directly, through a variable, inside `bash -c`, after `env` or as `node <path>`), so /multi-agent:address-review cannot reply, resolve or push without the person approving that one write at the host; with MULTI_AGENT_UNATTENDED=1 it answers `deny`. Every other Bash call gets no output, and it exits 0 on every path. A run-scoped PreToolUse gate ships too: (2b) run-scope-guard.sh on every Figma MCP tool (mcp__.*[Ff]igma.*) denies a Figma call above phases.json thresholds.mcpAllowedThroughPhase for the run bound to the session, unless the run is in analysis mode, and records each allowed call into telemetry.mcpCalls[]; on Edit|Write|NotebookEdit the same script warns, attended only, when the target is outside the bound run's worktree (additionalContext for the model, systemMessage for the user; the call proceeds). On Agent|Task, with prefs.global.costBudget.enabled true, it asks before a subagent starts while the bound run's estimated spend is over the ceiling (denies with onExceed halt) and adds a note for the model from the warn threshold. On Bash|WebFetch|AskUserQuestion it denies a question from a bound autopilot run, a Figma read over HTTP (figma.com or api.figma.com) under the same phase rule, and, in any session, a direct write to agent-state.json or tracker-state.json (Edit/Write, a shell redirect or tee), since write-state.mjs is their only writer; the shell wrapper starts node only when the payload mentions Figma or a state file. Outside a run it is silent, and it fails open. One PostToolUse hook ships as well and blocks nothing: (7) edit-syntax-gate.sh on Edit|Write|MultiEdit parses the file the edit just wrote (swiftc -parse, node --check, py_compile into a temp dir, JSON.parse, bash -n; Kotlin skipped) under a 2 s deadline and, when it no longer parses, hands the model the error as PostToolUse additionalContext; it exits 0 on every path, stays silent when a parser is missing or slow, and is inert until `prefs.global.editSyntaxGate.enabled` is true. A second PostToolUse hook blocks nothing either: (7b) task-mirror.sh on TaskCreate|TaskUpdate mirrors the native task list into the tracker of the run bound to the session (phase-tracker.sh task, tracker-contract.md, \"Mirroring the host's task list\"), skipping phase tiles, so the office panel shows the same list; silent outside a run, exit 0 on every path. A third blocks nothing: (7c) file-context.sh on Read (PostToolUse, and PreToolUse on Read|Grep|Glob) hands the model, once per file per session, what the repo's memory says about the file it reads or searches (ledger facts whose scope covers it, its latest review findings, its open known limits from debt-ledger.mjs) as additionalContext inside an <untrusted-data> block, after the secret scan and fitted to the host's 10,000-character hook output limit; a Grep with a path, or a Glob whose literal directory is inside the repo, is mapped to at most five files the stores know, and a whole-repo search gets nothing; inside a run bound to the session by default, everywhere with prefs.global.fileContext.enabled true, never with it false; exit 0 on every path. A fourth blocks nothing: (7d) answer-check.sh on AskUserQuestion names, as PostToolUse additionalContext, every question the user submitted without a choice, so an empty answer is asked again instead of resolved to the Recommended option; it runs in every session, since it only adds context, and exits 0 on every path. A fifth blocks nothing: (7e) graph-hint.sh on Grep|Glob (PreToolUse) adds, once per session, one line pointing at `/multi-agent:graph ask` and mcp__multi-agent__graph_query when the call searches the whole repo for a bare identifier and a current code graph (graphFreshness: build commit is HEAD, no indexed file changed) exists for the repo; silent with prefs.global.codeGraph.enabled false; exit 0 on every path. A sixth blocks nothing: (7f) note-skill-use.sh on Skill (PostToolUse and PostToolUseFailure) appends one row to the local <log root>/skill-usage.jsonl: the skill name (kept only when it matches a strict charset and length and carries no credential pattern, else the call is dropped), ok or error, the time, the host and the repo folder name (null outside a git repository and for a repository in prefs.global.memory.excludeProjects), never the arguments, the prompt or any output; past 1 MiB the log moves to skill-usage.jsonl.1; off with prefs.global.skillUsage.enabled false or prefs.global.usageLog.optOut true; it reads stdin for at most 1.5 s and exits 0 on every path. skill-usage.mjs summary and prune-candidates read it. A seventh blocks nothing: (7g) note-mcp-failure.sh on mcp__.* (PostToolUseFailure) appends one row to the local <log root>/mcp-failures.jsonl: the server and tool from the tool name (dropped unless both match a strict charset and length and carry no credential pattern), the time and a closed error class (the host's interrupt flag first, then a refusal by the user or the permission layer, then a JSON-RPC code in the error text, then a message opening with invalid or validation, then an HTTP status, then fixed patterns), never the arguments, the output or the error text itself; it probes nothing, is written by the same code as the skill-usage log, so it has the same 1 MiB cap and .1 generation, rotates under its own mcp-failures.jsonl.lock, never follows a symlink at the log path, is off with prefs.global.mcpFailures.enabled false or prefs.global.usageLog.optOut true, and exits 0 on every path; doctor's mcp-failures check reads it. One Stop hook ships as well: (8) run-stop-guard.sh answers {\"decision\":\"block\"} when the session driving an active pipeline run (bound through agent-state.json sessionId or hostSessionId, never by a worktree match) tries to stop while the run is in_progress below its mode's last phase with no haltReason or waitingFor; the reason says to finish the current phase, record the wait, or record a halt. A turn that ends on a question to the user, a session with background tasks or crons, and prefs.global.stopGuard.enabled false are never held, and run-stop-guard.sh is not registered on SubagentStop: a subagent's stop is the dispatching session's business. After three consecutive blocks it records the halt itself (status paused, haltReason <phase>:stop-guard), which write-state clears when the run advances a phase. It never blocks outside a run and fails open, with a line in <log root>/hook-failures.log, on any error. These registrations are Claude Code's; README \"Hooks per host\" lists which have no equivalent elsewhere. On Codex only the syntax gate is offered, from codex-hooks.json through host-hooks.mjs; Copilot CLI gets none, since as of 1.0.45 it discards postToolUse output; the other gates are Claude Code only. multi-agent:setup offers to merge this block.",
2
+ "_readme": "Recommended Claude Code hooks for multi-agent-pipeline. `install` registers the pre-commit and agent-guard gates, the run-scoped run-stop-guard / run-scope-guard hooks, the task-mirror hook, the file-context hook, the skill-usage hook and the MCP failure hook itself (install/claude.mjs configureSettings, RUN_HOOKS); /multi-agent:setup offers to merge the rest of this block. Merge the `hooks` object into your ~/.claude/settings.json to make these deterministic PreToolUse gates real (exit 2 blocks the tool call). A PreToolUse matcher is a regex over the TOOL NAME, so each gate registers on a tool name and reads the command from its stdin payload. Three PreToolUse gates ship here: (1) pre-commit-check.sh on Bash, which acts only on a `git commit` and blocks a secret in the staged diff; (2) agent-guard.sh on Bash, on Edit|Write|NotebookEdit, and on WebFetch plus every multi-agent MCP tool (WebFetch|mcp__multi-agent__.*). Always, it blocks AI/assistant attribution in a commit message and a force-push, delete or mirror push to a protected branch (main/master/develop), including one inside a subshell or a `bash -c` / `eval` line. With MULTI_AGENT_UNATTENDED=1 in the hook's environment it also applies the unattended policy: no push, PR or tracker write, no Keychain read, no fetch outside the host allowlist (curl, WebFetch, the toolkit's web tools, agent_run_steps and open_url), no package install, and no write into a protected path (features/unattended-security.md); (3) check-read-size.sh on Read|Bash, which inspects Read plus the shell commands that read a file whole (cat/head/tail/sed), returns immediately for everything else, and routes an oversized read to a cheap worker instead of the caller's own rung; it is inert until `prefs.global.bulkRead.mode` is set to observe or enforce. Failure behaviour: pre-commit-check.sh and check-read-size.sh fail open on an internal error. agent-guard.sh fails open when attended, so a guard bug cannot break a legitimate tool call, and fails closed under MULTI_AGENT_UNATTENDED=1, where nobody is there to notice a gap. None of the three executes the inspected command, and none needs run-specific arguments. The other deterministic gates (evidence, consensus, intent, learnings) take run-specific arguments and are phase-enforced by the pipeline instead. Three capture hooks ship alongside them and block nothing: (4) SessionEnd runs capture-flush.sh --if-stale, which writes a run's triage findings and durable learnings into the per-repo stores when the run ended before Phase 5, where those writes otherwise happen; the same hook runs note-session.sh, which records the mechanical shape of a session outside the pipeline (tools used, commands that failed, calls the user refused). (4b) SubagentStop and PostToolUseFailure run note-agent-event.sh, which appends one row to the same session notes as the event happens: a subagent's type, id, the bound run's task id and its last message cut to 200 characters (secret-scanned; a hit stores the row without the message), or a failed tool's name and its command's first program word, never an argument or error text. (5) PreCompact runs capture-flush.sh without --if-stale: a compaction summarizes the conversation mid-phase, so it is the moment unflushed findings are at risk, and both writes are idempotent, so a finished run costs two no-op writes. The staleness test exists only so a session exit does not re-flush a run that already finished. (6) SessionStart runs capture-resume.sh, which prints at most two lines: an unfinished run and how to resume it, and a stale pipeline-observation queue. (6b) session-brief.sh runs on the same event and is opt-in: it prints nothing until prefs.global.sessionBrief.enabled is true. Enabled, it prints, from a cache that a detached process rebuilds, a block of at most prefs.global.sessionBrief.maxChars characters (default 2400, about 350 tokens): the repository's learnings ledger as an index of pointers (inside an <untrusted-data> block, after the secret scan) and one line about its code graph, plus the skill indexes of the enabled toolkits; the working notes are a separate setting, discipline, also off. A repository with no ledger entries and no code graph gets nothing. It starts no node process on a warm cache, is silent in unattended and pipeline contexts and outside a git repository, writes its cache 0600 under ~/.claude/memory/multi-agent/_session-brief/, and exits 0 on every path. No capture hook calls a model or reads a payload - note-session.sh keeps a command's first word and an exit code, never an argument or any output - and all exit 0 on every path, because a hook that fails a session over bookkeeping costs more than the bookkeeping. A GitHub write gate ships too: (2a) pr-write-guard.sh on Bash answers `ask`, naming the PR and the operation, when the command runs `pr-threads.mjs apply` (directly, through a variable, inside `bash -c`, after `env` or as `node <path>`), so /multi-agent:address-review cannot reply, resolve or push without the person approving that one write at the host; with MULTI_AGENT_UNATTENDED=1 it answers `deny`. Every other Bash call gets no output, and it exits 0 on every path. A run-scoped PreToolUse gate ships too: (2b) run-scope-guard.sh on every Figma MCP tool (mcp__.*[Ff]igma.*) denies a Figma call above phases.json thresholds.mcpAllowedThroughPhase for the run bound to the session, unless the run is in analysis mode, and records each allowed call into telemetry.mcpCalls[]; on Edit|Write|NotebookEdit the same script warns, attended only, when the target is outside the bound run's worktree (additionalContext for the model, systemMessage for the user; the call proceeds). On Agent|Task, with prefs.global.costBudget.enabled true, it asks before a subagent starts while the bound run's estimated spend is over the ceiling (denies with onExceed halt) and adds a note for the model from the warn threshold. On Bash|WebFetch|AskUserQuestion it denies a question from a bound autopilot run, a Figma read over HTTP (figma.com or api.figma.com) under the same phase rule, and, in any session, a direct write to agent-state.json or tracker-state.json (Edit/Write, a shell redirect or tee), since write-state.mjs is their only writer; the shell wrapper starts node only when the payload mentions Figma or a state file. Outside a run it is silent, and it fails open. One PostToolUse hook ships as well and blocks nothing: (7) edit-syntax-gate.sh on Edit|Write|MultiEdit parses the file the edit just wrote (swiftc -parse, node --check, py_compile into a temp dir, JSON.parse, bash -n; Kotlin skipped) under a 2 s deadline and, when it no longer parses, hands the model the error as PostToolUse additionalContext; it exits 0 on every path, stays silent when a parser is missing or slow, and is inert until `prefs.global.editSyntaxGate.enabled` is true. A second PostToolUse hook blocks nothing either: (7b) task-mirror.sh on TaskCreate|TaskUpdate mirrors the native task list into the tracker of the run bound to the session (phase-tracker.sh task, tracker-contract.md, \"Mirroring the host's task list\"), skipping phase tiles, so the office panel shows the same list; silent outside a run, exit 0 on every path. A third blocks nothing: (7c) file-context.sh on Read (PostToolUse, and PreToolUse on Read|Grep|Glob) hands the model, once per file per session, what the repo's memory says about the file it reads or searches (ledger facts whose scope covers it, its latest review findings, its open known limits from debt-ledger.mjs) as additionalContext inside an <untrusted-data> block, after the secret scan and fitted to the host's 10,000-character hook output limit; a Grep with a path, or a Glob whose literal directory is inside the repo, is mapped to at most five files the stores know, and a whole-repo search gets nothing; inside a run bound to the session by default, everywhere with prefs.global.fileContext.enabled true, never with it false; exit 0 on every path. A fourth blocks nothing: (7d) answer-check.sh on AskUserQuestion names, as PostToolUse additionalContext, every question the user submitted without a choice, so an empty answer is asked again instead of resolved to the Recommended option; it runs in every session, since it only adds context, and exits 0 on every path. A fifth blocks nothing: (7e) graph-hint.sh on Grep|Glob (PreToolUse) adds, once per session, one line pointing at `/multi-agent:graph ask` and mcp__multi-agent__graph_query when the call searches the whole repo for a bare identifier and a current code graph (graphFreshness: build commit is HEAD, no indexed file changed) exists for the repo; silent with prefs.global.codeGraph.enabled false; exit 0 on every path. A sixth blocks nothing: (7f) note-skill-use.sh on Skill (PostToolUse and PostToolUseFailure) appends one row to the local <log root>/skill-usage.jsonl: the skill name (kept only when it matches a strict charset and length and carries no credential pattern, else the call is dropped), ok or error, the time, the host and the repo folder name (null outside a git repository and for a repository in prefs.global.memory.excludeProjects), never the arguments, the prompt or any output; past 1 MiB the log moves to skill-usage.jsonl.1; off with prefs.global.skillUsage.enabled false or prefs.global.usageLog.optOut true; it reads stdin for at most 1.5 s and exits 0 on every path. skill-usage.mjs summary and prune-candidates read it. A seventh blocks nothing: (7g) note-mcp-failure.sh on mcp__.* (PostToolUseFailure) appends one row to the local <log root>/mcp-failures.jsonl: the server and tool from the tool name (dropped unless both match a strict charset and length and carry no credential pattern), the time and a closed error class (the host's interrupt flag first, then a refusal by the user or the permission layer, then a JSON-RPC code in the error text, then a message opening with invalid or validation, then an HTTP status, then fixed patterns), never the arguments, the output or the error text itself; it probes nothing, is written by the same code as the skill-usage log, so it has the same 1 MiB cap and .1 generation, rotates under its own mcp-failures.jsonl.lock, never follows a symlink at the log path, is off with prefs.global.mcpFailures.enabled false or prefs.global.usageLog.optOut true, and exits 0 on every path; doctor's mcp-failures check reads it. note-mcp-call.sh is registered on PostToolUse for mcp__.* with \"async\": true (the host's hook schema defines `async`: if true, the hook runs in the background without blocking) and counts the calls that succeeded for the usage record: it starts no node process, reads the first 8 KiB of the payload, and does nothing unless the marker file <log root>/mcp-counting-on exists and is newer than the preferences file (the marker is written by the usage report and the failure hook, with a real parser, only while prefs.global.usageLog.enabled is true and neither usageLog.optOut nor mcpFailures.enabled false is set); it appends one line, the session id and the tool name, to <log root>/mcp-calls.log, which the next usage report folds into <log root>/mcp-calls.json (counts per host session, owner-only, at most 200 names per session and 20 sessions), under the same two off switches. note-command-use.sh is registered on UserPromptSubmit with \"async\": true and counts which /multi-agent commands are typed: it starts no node process, reads the first 8 KiB of the payload, looks only at a prompt whose first token is /multi-agent:<name> (or /multi-agent <name> for a shipped command), appends the shipped command name or the constant other to <log root>/cmd-calls.log, and stores no argument, text or length; it does nothing unless the marker file <log root>/cmd-counting-on exists and is newer than the preferences file (written only while prefs.global.usageLog.enabled is true and usageLog.optOut is not). One Stop hook ships as well: (8) run-stop-guard.sh answers {\"decision\":\"block\"} when the session driving an active pipeline run (bound through agent-state.json sessionId or hostSessionId, never by a worktree match) tries to stop while the run is in_progress below its mode's last phase with no haltReason or waitingFor; the reason says to finish the current phase, record the wait, or record a halt. A turn that ends on a question to the user, a session with background tasks or crons, and prefs.global.stopGuard.enabled false are never held, and run-stop-guard.sh is not registered on SubagentStop: a subagent's stop is the dispatching session's business. After three consecutive blocks it records the halt itself (status paused, haltReason <phase>:stop-guard), which write-state clears when the run advances a phase. It never blocks outside a run and fails open, with a line in <log root>/hook-failures.log, on any error. These registrations are Claude Code's; README \"Hooks per host\" lists which have no equivalent elsewhere. On Codex only the syntax gate is offered, from codex-hooks.json through host-hooks.mjs; Copilot CLI gets none, since as of 1.0.45 it discards postToolUse output; the other gates are Claude Code only. multi-agent:setup offers to merge this block.",
3
3
  "hooks": {
4
4
  "PreToolUse": [
5
5
  {
@@ -180,6 +180,31 @@
180
180
  "statusMessage": "Counting the skill call..."
181
181
  }
182
182
  ]
183
+ },
184
+ {
185
+ "matcher": "mcp__.*",
186
+ "hooks": [
187
+ {
188
+ "type": "command",
189
+ "command": "bash \"$HOME/.claude/scripts/note-mcp-call.sh\"",
190
+ "async": true,
191
+ "timeout": 5,
192
+ "statusMessage": "Counting the MCP call..."
193
+ }
194
+ ]
195
+ }
196
+ ],
197
+ "UserPromptSubmit": [
198
+ {
199
+ "hooks": [
200
+ {
201
+ "type": "command",
202
+ "command": "bash \"$HOME/.claude/scripts/note-command-use.sh\"",
203
+ "async": true,
204
+ "timeout": 5,
205
+ "statusMessage": "Counting the command..."
206
+ }
207
+ ]
183
208
  }
184
209
  ],
185
210
  "PostToolUseFailure": [
@@ -255,6 +280,12 @@
255
280
  "command": "bash \"$HOME/.claude/scripts/capture-resume.sh\"",
256
281
  "timeout": 10,
257
282
  "statusMessage": "Checking for unfinished runs..."
283
+ },
284
+ {
285
+ "type": "command",
286
+ "command": "bash \"$HOME/.claude/scripts/session-brief.sh\"",
287
+ "timeout": 5,
288
+ "statusMessage": "Loading the session brief..."
258
289
  }
259
290
  ]
260
291
  }