@mmerterden/multi-agent-pipeline 20.41.0 → 20.43.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 (114) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +8 -6
  3. package/README.tr.md +8 -6
  4. package/docs/architecture.md +3 -3
  5. package/docs/ecosystem.md +50 -13
  6. package/docs/facts.json +9 -9
  7. package/docs/features.md +9 -4
  8. package/install/claude.mjs +34 -1
  9. package/install/templates/claude-hooks.json +12 -1
  10. package/manifest.json +117 -90
  11. package/package.json +3 -2
  12. package/pipeline/commands/multi-agent/autopilot/SKILL.md +11 -0
  13. package/pipeline/commands/multi-agent/clean-disk/SKILL.md +134 -0
  14. package/pipeline/commands/multi-agent/review-priority/SKILL.md +143 -0
  15. package/pipeline/commands/multi-agent/setup/SKILL.md +1 -1
  16. package/pipeline/commands/multi-agent/sync/SKILL.md +4 -4
  17. package/pipeline/lib/args.mjs +131 -4
  18. package/pipeline/lib/bg-launch.mjs +5 -2
  19. package/pipeline/lib/credential-store.sh +11 -1
  20. package/pipeline/lib/hook-once.mjs +134 -0
  21. package/pipeline/lib/isotonic.mjs +73 -0
  22. package/pipeline/lib/low-disk.mjs +154 -0
  23. package/pipeline/lib/mcp-schema-load.mjs +90 -0
  24. package/pipeline/lib/md2confluence-v3.py +8 -7
  25. package/pipeline/lib/model-dispatch.sh +26 -2
  26. package/pipeline/lib/normalize-text.mjs +135 -0
  27. package/pipeline/lib/outbound-gate.mjs +21 -3
  28. package/pipeline/lib/plan-todos.sh +17 -4
  29. package/pipeline/lib/redact.mjs +12 -3
  30. package/pipeline/lib/risky-settings.mjs +198 -0
  31. package/pipeline/lib/route-state.sh +1 -0
  32. package/pipeline/lib/secret-patterns.generated.mjs +6 -2
  33. package/pipeline/lib/session-usage.mjs +232 -0
  34. package/pipeline/lib/source-digest.mjs +211 -0
  35. package/pipeline/lib/tdd-evidence.mjs +250 -17
  36. package/pipeline/lib/untrusted-fence.mjs +132 -1
  37. package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
  38. package/pipeline/multi-agent-refs/cross-cli-contract.md +5 -5
  39. package/pipeline/multi-agent-refs/features/cost-analysis.md +37 -2
  40. package/pipeline/multi-agent-refs/features/doctor.md +66 -4
  41. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -0
  42. package/pipeline/multi-agent-refs/features/plan-todos.md +4 -0
  43. package/pipeline/multi-agent-refs/features/review-priority.md +123 -0
  44. package/pipeline/multi-agent-refs/features/unattended-gates.md +5 -3
  45. package/pipeline/multi-agent-refs/features/usage-reporting.md +4 -2
  46. package/pipeline/multi-agent-refs/help/en.md +3 -1
  47. package/pipeline/multi-agent-refs/help/tr.md +3 -1
  48. package/pipeline/multi-agent-refs/outside-the-pipeline.md +6 -0
  49. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +1 -1
  50. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +4 -4
  51. package/pipeline/multi-agent-refs/phases/phase-3-review.md +2 -2
  52. package/pipeline/multi-agent-refs/phases/phase-5-report.md +2 -0
  53. package/pipeline/multi-agent-refs/progress-contract.md +3 -1
  54. package/pipeline/multi-agent-refs/review-priority/rules/example.md +137 -0
  55. package/pipeline/office/toolkit.json +1 -1
  56. package/pipeline/rules/outside-the-pipeline.md +1 -1
  57. package/pipeline/schemas/doctor-report.schema.json +47 -0
  58. package/pipeline/schemas/plan-todos.schema.json +29 -1
  59. package/pipeline/schemas/prefs.schema.json +81 -0
  60. package/pipeline/schemas/route-config.schema.json +51 -0
  61. package/pipeline/schemas/secret-patterns.json +17 -1
  62. package/pipeline/schemas/toolkit-path-params.json +15 -1
  63. package/pipeline/scripts/_cost-advise.mjs +357 -0
  64. package/pipeline/scripts/_cost-budget.mjs +78 -0
  65. package/pipeline/scripts/_cost.mjs +29 -0
  66. package/pipeline/scripts/_decode_text.py +107 -0
  67. package/pipeline/scripts/_guard-probe.mjs +406 -0
  68. package/pipeline/scripts/_guard_rules.py +206 -0
  69. package/pipeline/scripts/_memory-policy.mjs +1 -25
  70. package/pipeline/scripts/_retrieval.mjs +148 -2
  71. package/pipeline/scripts/_secret-scan.mjs +6 -1
  72. package/pipeline/scripts/_stack-routing.mjs +1 -0
  73. package/pipeline/scripts/_test-gaming.mjs +346 -0
  74. package/pipeline/scripts/agent-guard.py +8 -1
  75. package/pipeline/scripts/argv-secret-scan.mjs +2 -1
  76. package/pipeline/scripts/autopilot-loop.mjs +407 -0
  77. package/pipeline/scripts/autopilot-runner.mjs +38 -25
  78. package/pipeline/scripts/capture-resume.sh +9 -1
  79. package/pipeline/scripts/cost-analyze.mjs +66 -4
  80. package/pipeline/scripts/cost-budget-check.mjs +5 -13
  81. package/pipeline/scripts/disk-cleaner.mjs +1432 -0
  82. package/pipeline/scripts/doctor.mjs +302 -47
  83. package/pipeline/scripts/evidence-gate.mjs +90 -0
  84. package/pipeline/scripts/gate-ledger.mjs +76 -21
  85. package/pipeline/scripts/gc-tmp.sh +5 -0
  86. package/pipeline/scripts/guard-probe-known-holes.json +3 -0
  87. package/pipeline/scripts/learnings-ledger.mjs +16 -12
  88. package/pipeline/scripts/note-agent-event.mjs +2 -0
  89. package/pipeline/scripts/note-mcp-failure.mjs +9 -2
  90. package/pipeline/scripts/note-skill-use.mjs +4 -1
  91. package/pipeline/scripts/pre-commit-check.sh +2 -2
  92. package/pipeline/scripts/pre-push-check.sh +8 -1
  93. package/pipeline/scripts/priority-review.mjs +912 -0
  94. package/pipeline/scripts/publish-staged.mjs +324 -0
  95. package/pipeline/scripts/route-learn.mjs +628 -0
  96. package/pipeline/scripts/run-scope-guard.mjs +55 -1
  97. package/pipeline/scripts/scan-agent-config.sh +1 -1
  98. package/pipeline/scripts/statusline.mjs +309 -0
  99. package/pipeline/scripts/test-integrity-gate.mjs +97 -2
  100. package/pipeline/scripts/triage-memory.mjs +12 -4
  101. package/pipeline/scripts/uninstall.mjs +1 -0
  102. package/pipeline/skills/.skill-manifest.json +17 -5
  103. package/pipeline/skills/.skills-index.json +36 -3
  104. package/pipeline/skills/shared/README.md +9 -6
  105. package/pipeline/skills/shared/core/multi-agent-clean-disk/SKILL.md +34 -0
  106. package/pipeline/skills/shared/core/multi-agent-review-priority/SKILL.md +36 -0
  107. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +4 -4
  108. package/pipeline/skills/shared/external/backlog/SKILL.md +1 -1
  109. package/pipeline/skills/shared/external/disk-cleaner/SKILL.md +111 -0
  110. package/pipeline/skills/shared/external/disk-cleaner/evals/evals.json +62 -0
  111. package/pipeline/skills/shared/external/disk-cleaner/scripts/disk-cleaner.mjs +1432 -0
  112. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +1 -1
  113. package/pipeline/skills/skill-copies.json +4 -0
  114. package/pipeline/skills/skills-index.md +5 -2
package/CHANGELOG.md CHANGED
@@ -16,6 +16,62 @@ Internal file-layout changes that don't affect the slash-command surface are sti
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [20.43.0] - 2026-11-04
20
+
21
+ ### Added
22
+
23
+ - `/multi-agent:clean-disk` runs the disk cleaner as a command: measure, choose, apply, report; the low-disk line names it.
24
+ - `/multi-agent:review-priority` reviews open bug priorities against a team's rule file, read only by default, one approved change at a time; an example impact-based rule file ships with it. An optional `corporate.md` in the rules directory is a baseline every team inherits, a team row with the same id overrides it, and the report names the file each cited rule came from.
25
+
26
+ ### Changed
27
+
28
+ - `disk-cleaner.mjs` never stops a process: the `processes` category and `--processes` are gone, and orphaned session children are listed under `orphans` in the report as information. 23 categories remain; the Trash and old transcripts stay opt-in and are never unattended. The JSON report gives each category's largest items with real paths and sizes (`top`, `--top=N`), the count left out (`more`), the kept reasons (`kept`), `reclaimableBytes` and `disk.expectedFreeBytes`.
29
+ - doctor's `disk-space` check shows the free space every time, and what can be freed from the newest disk-cleaner dry run (total, top three categories, age; a run over a day old or none is named as such). `--probe` measures under a 60-second cap, and a timeout is reported, not failed. Enough free space but at least `diskCleaner.reclaimableGb` (default 10) to reclaim is INFO with the step `run /multi-agent:clean-disk: N GB can be freed`.
30
+
31
+ ## [20.42.0] - 2026-11-04
32
+
33
+ ### Added
34
+
35
+ - Build and test evidence is tied to a digest of the working tree (`lib/source-digest.mjs`). The gate ledger records it, an edit after the build makes the entry `stale` at commit, and `evidence-gate --ran-on` refuses a run whose source changed under it.
36
+ - `evidence-gate --command` / `--command-file` refuses a narrowed test run (`-only-testing`, `--filter`, `--tests`, `-t`, `-k`, `--grep`, `-run`, a single test file, `--passWithNoTests`) across fourteen runners and package scripts. `test-integrity-gate --test-command-file` reports one as blocking.
37
+ - `tdd-red` keeps the test files changed since the run's base commit, committed or not. `tdd-green` refuses a weakened or deleted one unless `--test-edit-reason` is given (blocking regardless when unattended), `plan-todos.sh tdd-restore` puts them back without creating anything outside the work tree, and `test-integrity-gate --state` reports the edits. An unreadable `--state` or `--test-command-file` is a blocking finding.
38
+ - `eval-guard-robustness` probes every PreToolUse hook in the install template, and the library matchers, with ReDoS, 1 MB and 5000-deep inputs under a timeout, against a dated known-holes list. `npm test` runs `--fast`; `npm run eval:guards` runs the whole probe.
39
+ - The guard asks before a recursive delete of `/`, the home directory (`$HOME`, `${HOME:?}` and the other parameter forms, `~`, `~user`) or a directory above it, and before a fork bomb, and refuses these unattended.
40
+ - The outbound gate, the command-line credential scan and the memory secret scan also match credentials hidden in base64, hex or rot13, with a Python twin used by the guard.
41
+ - Fenced untrusted text that reads like instructions is marked `suspicious` with the toolkit's classes: instruction-override, role-tag, tool-invocation, exfiltration and fence-escape.
42
+ - The installer reports risky `settings.json` combinations before it merges hooks, and setup asks about each HIGH finding.
43
+ - `run-scope-guard` on `Agent|Task` asks before a subagent starts on a run over its cost budget, and refuses with `onExceed: halt`.
44
+ - `lib/hook-once.mjs` makes the note-skill-use, note-mcp-failure and note-agent-event hooks write once per tool event.
45
+ - `cost-analyze advise` reports cache-read ratio, 1-hour cache TTL payback, sub-agent rung downshift with the pinned personas, context bloat and unpriced models, each finding with its numbers, its source and a what-if saving or null.
46
+ - `session-usage.mjs --host codex` reads the Codex CLI token ledger (running-total deltas, resets, forked replays); an unknown format reports UNMEASURED.
47
+ - Memory recall re-picks its head with MMR and ranks each clause of a multi-part task as its own query (`memoryRecall.mmrLambda`, `memoryRecall.multiQuery`); eval-recall gains two diversity cases.
48
+ - `doctor --json` carries `schemaVersion: 1` and `selection` under `schemas/doctor-report.schema.json`, with a golden test; `--only <id,...>`; the new check `mcp-schema-load` reports the toolkit's tool-list load per family as an estimate (`mcpSurface.schemaInfoAboveTokens`).
49
+ - An unknown flag or subcommand names the nearest one, in the output language.
50
+ - Opt-in `statusline.mjs` shows the run a session drives. Its cache lives in a private per-user directory, install never replaces an existing `statusLine`, and a symlinked settings file is written through with its mode kept.
51
+ - `publish-staged.mjs` publishes under a candidate dist-tag, matches the integrity, runs an install test, then promotes to latest; `--tag latest` is refused. It is the documented release step.
52
+ - Learned model-rung order (`modelRouting.learned`, off by default): `route-learn.mjs` learns from gate and review outcomes, promotes a policy only after a holdout Brier comparison with isotonic calibration, and chooses with seeded Thompson sampling.
53
+ - `/multi-agent:autopilot --loop N` (`autopilot-loop.mjs`): a bounded loop in which every iteration is a fully gated unattended run, launched with the autopilot runner's own argv, environment, unattended settings profile and preconditions, so the loop refuses to start where the runner would. Completion is checked and marked by the loop itself, and iterations, time and cost are hard caps.
54
+ - `disk-cleaner.mjs` frees disk space on a macOS developer machine by deleting regenerable data from a fixed allowlist of 24 categories: Xcode DerivedData, SwiftPM `.build` and DerivedData folders inside dev roots that look like build output and sat untouched for 12 hours, stale XCTest device clones, SwiftUI preview, Interface Builder and documentation caches, archives past an age, DeviceSupport for OS versions no paired device runs, unavailable simulators, simulator, SwiftPM, CocoaPods, Gradle, npm, yarn and pnpm caches, Homebrew, `dd-*` build folders in /tmp and $TMPDIR, pipeline scratch through `gc-tmp.sh`, scratchpads of ended Claude Code sessions, merged and clean agent worktrees under `.claude/worktrees`, developer-tool folders in ~/Library/Caches, old simulator logs and crash reports, finished pipeline task logs through `prune-logs.sh`, `.DS_Store` in dev roots, and orphaned children of ended sessions. The default run measures and deletes nothing; `--apply` deletes, every category can be skipped, and every path is checked again right before it goes: no symlink is followed, the real path must sit inside the category's roots, the user's folders, iCloud, keychains, credential folders and memory folders are refused, and nothing an open file or running command points into is touched. Transcripts and the Trash are opt-in; processes are stopped only with `--apply --processes`; unattended runs keep to a safe subset. It prints free space before and after and writes a JSON report.
55
+ - New `disk-cleaner` skill in ai-common-toolkit, which ships the script.
56
+ - Low-disk suggestion: `lib/low-disk.mjs` checks free space with one statfs call against `diskCleaner.lowDiskGb` (default 10) and `diskCleaner.lowDiskPercent` (default 5), and prints one line naming the disk-cleaner skill from doctor's `disk-space` check, the SessionStart banner, and the pre-push gate when a failed step said ENOSPC. `diskCleaner.suggest: false` silences it. Nothing is deleted from any of these places.
57
+ - `note-mcp-failure.mjs` classifies `ENOSPC` and no-space errors as `disk-full`, and doctor's `mcp-failures` check names the disk-cleaner skill after one such failure.
58
+
59
+ ### Changed
60
+
61
+ - `credential-store.sh set <key>` without a value reads the secret from stdin, or asks for it with hidden input on a terminal, and refuses an empty secret with usage.
62
+ - `usage-reporting.md`, the hooks template and the classifier's header give the MCP failure classes in the order the code reads them: the interrupt flag, a user or permission refusal, then a JSON-RPC code.
63
+ - `md2confluence-v3.py --image-width` help says images in a table cell stay at 240 px, and decision 18 in `locked.md` names that width for the frame gallery.
64
+ - `outside-the-pipeline.md` lists `media_video_plan` and `media_video_render`.
65
+ - Phase 2 stops retrying a build that failed for lack of disk space and prints the low-disk line instead.
66
+ - The `backlog` and `localization-reuse-map` skill descriptions are shorter, to stay under the description ceiling.
67
+
68
+ ### Fixed
69
+
70
+ - The URL-credential secret pattern, the command-line DSN pattern and the outbound email rule scan a long URL-shaped line in linear time, and a URL password of any length is still caught.
71
+ - `redact` skips the fold for printable ASCII text.
72
+ - `phase-1-plan.md` counts the 37 locked analysis decisions.
73
+ - progress-contract.md names the cost check's real default rate.
74
+
19
75
  ## [20.41.0] - 2026-11-03
20
76
 
21
77
  ### Added
package/README.md CHANGED
@@ -158,7 +158,7 @@ The discipline behind all of this - bounded loops, evidence gates, token-budgete
158
158
 
159
159
  ## Commands
160
160
 
161
- `/multi-agent` plus <!-- fact:commandCount -->71<!-- /fact --> sub-commands. `/multi-agent:help` renders the same catalog in your terminal, in your `outputLanguage`.
161
+ `/multi-agent` plus <!-- fact:commandCount -->73<!-- /fact --> sub-commands. `/multi-agent:help` renders the same catalog in your terminal, in your `outputLanguage`.
162
162
 
163
163
  ### Pipeline entries
164
164
 
@@ -180,6 +180,7 @@ The discipline behind all of this - bounded loops, evidence gates, token-budgete
180
180
  | `/multi-agent:search` | Ranked search across every task log; `--semantic` queries the triage corpus; the toolkit's `learnings_*` tools read the learnings ledger of every repo |
181
181
  | `/multi-agent:garbage-collect` | Sweep leftover scratch, orphan worktrees and offloaded payloads. `--abandoned` also reaps runs that stopped and were never picked back up. Dry-run first |
182
182
  | `/multi-agent:prune-logs` | Delete per-task logs by age / project / task. Audit trail and metrics kept |
183
+ | `/multi-agent:clean-disk` | Free disk space: measure every category, choose what to delete, apply, report the space freed. Nothing is deleted before you choose |
183
184
  | `/multi-agent:purge` | Wipe every worktree, branch, log and state file. Double confirmation |
184
185
 
185
186
  ### Review
@@ -188,6 +189,7 @@ The discipline behind all of this - bounded loops, evidence gates, token-budgete
188
189
  | ---------------------------------- | ------------------------------------------------------------------------------------------- |
189
190
  | `/multi-agent:review` | Parallel review of a branch diff or a PR; inline comments + approve/needs-work on PR input |
190
191
  | `/multi-agent:review-jira` | Grade a Jira issue's readiness for development, comment the gaps |
192
+ | `/multi-agent:review-priority` | Grade a team's open bug priorities against its rule file. Read-only; one approved change at a time |
191
193
  | `/multi-agent:review-issue` | Same grading for a GitHub issue |
192
194
  | `/multi-agent:review-analysis` | Review a written analysis document; findings cite the Locked rule they break |
193
195
  | `/multi-agent:diff-explain` | Map a Phase 3 triage finding back to the diff lines that caused it |
@@ -468,17 +470,17 @@ This enables the matching plugin (+ the shared `ai-common` plugin) in the repo's
468
470
 
469
471
  ## Tool support
470
472
 
471
- The pipeline runs natively on **Claude Code**, **Copilot CLI** and **Codex CLI** - all three install from the same `pipeline/` source and get the same <!-- fact:commandCount -->71<!-- /fact --> commands.
473
+ The pipeline runs natively on **Claude Code**, **Copilot CLI** and **Codex CLI** - all three install from the same `pipeline/` source and get the same <!-- fact:commandCount -->73<!-- /fact --> commands.
472
474
 
473
475
  | Tool | Flag | What it installs |
474
476
  | ----------- | -------------------- | ------------------------------------------------------------------------------------------------------ |
475
477
  | Claude Code | `--claude` (default) | slash commands + skills + agents + the enforcement hooks (secret scan, agent-guard, read-size gate, run-scope guard, run-stop guard) |
476
- | Copilot CLI | `--copilot` | instructions + <!-- fact:commandCount -->71<!-- /fact --> sub-command skills + scripts |
477
- | Codex CLI | `--codex` | one router skill + <!-- fact:commandCount -->71<!-- /fact --> specs as refs + <!-- fact:agentCount -->11<!-- /fact --> agent TOML + `AGENTS.md` block + `codex mcp add` |
478
+ | Copilot CLI | `--copilot` | instructions + <!-- fact:commandCount -->73<!-- /fact --> sub-command skills + scripts |
479
+ | Codex CLI | `--codex` | one router skill + <!-- fact:commandCount -->73<!-- /fact --> specs as refs + <!-- fact:agentCount -->11<!-- /fact --> agent TOML + `AGENTS.md` block + `codex mcp add` |
478
480
 
479
481
  Filter skills by stack with `--platform=ios\|android\|all`.
480
482
 
481
- **Why Codex gets one skill and not <!-- fact:commandCount -->71<!-- /fact -->.** Codex assembles every discovered skill's name
483
+ **Why Codex gets one skill and not <!-- fact:commandCount -->73<!-- /fact -->.** Codex assembles every discovered skill's name
482
484
  and description into a single prompt block and drops entries when it overflows, with no
483
485
  error. Measured on 0.145: installing one plugin that declares 142 skills surfaced only
484
486
  75 of them and evicted an unrelated user skill. So on Codex the pipeline ships a single
@@ -538,7 +540,7 @@ Installing the pipeline is not only useful when you run it. Open an ordinary ses
538
540
 
539
541
  - **Services you already onboarded.** The token `setup` mapped is readable now - resolve the logical name through `credential-store.sh` and fetch the issue, the page, the log. **Reads are ordinary work; writes are not.** Posting a Jira comment, editing an issue or opening a PR goes through the pipeline commands, because the rules that make those safe (never auto-close, `Ref:` not `Closes:`, humanizer on outward prose) live there.
540
542
  - **The stack skills `/multi-agent:stack` enabled for the repo.** Each toolkit's own `index` skill routes; the pipeline keeps no copy of that table.
541
- - **The `multi-agent-toolkit` MCP.** <!-- fact:toolCount -->228<!-- /fact --> tools, most of them for a running app - screen state, crash logs, design comparison, store pre-submission, web scraping and browser test states. Several measure instead of judging by eye: WCAG contrast (`design_contrast_check`), layout shift across themes or a mirrored locale (`ios_visual_diff` with `mode: "layout"`), store listing limits (`store_listing_lint`), review themes with verbatim quotes (`store_review_themes`) and whether security findings cite real lines (`security_evidence_check`, with `security_sarif_export` for code-scanning views). The learnings ledger and the code graph are readable through it too (`learnings_*`, `graph_*`).
543
+ - **The `multi-agent-toolkit` MCP.** <!-- fact:toolCount -->230<!-- /fact --> tools, most of them for a running app - screen state, crash logs, design comparison, store pre-submission, web scraping and browser test states. Several measure instead of judging by eye: WCAG contrast (`design_contrast_check`), layout shift across themes or a mirrored locale (`ios_visual_diff` with `mode: "layout"`), store listing limits (`store_listing_lint`), review themes with verbatim quotes (`store_review_themes`) and whether security findings cite real lines (`security_evidence_check`, with `security_sarif_export` for code-scanning views). The learnings ledger and the code graph are readable through it too (`learnings_*`, `graph_*`).
542
544
 
543
545
  Uninstall preserves this layer: the tokens, the reader that opens them, the mapping that names them, and the MCP registration. Removing the pipeline should not cost you the credentials you onboarded through it.
544
546
 
package/README.tr.md CHANGED
@@ -157,7 +157,7 @@ Koşunun kendisinde ayarlanabilen tek şey autopilot; geri kalan her şey kendi
157
157
 
158
158
  ## Komutlar
159
159
 
160
- `/multi-agent` ve <!-- fact:commandCount -->71<!-- /fact --> alt komut. `/multi-agent:help` aynı katalogu terminalde, `outputLanguage` ayarına göre gösterir.
160
+ `/multi-agent` ve <!-- fact:commandCount -->73<!-- /fact --> alt komut. `/multi-agent:help` aynı katalogu terminalde, `outputLanguage` ayarına göre gösterir.
161
161
 
162
162
  ### Pipeline girişleri
163
163
 
@@ -179,6 +179,7 @@ Koşunun kendisinde ayarlanabilen tek şey autopilot; geri kalan her şey kendi
179
179
  | `/multi-agent:search` | Tüm görev loglarında sıralamalı arama; `--semantic` triyaj corpus'unu sorgular. Toolkit'in `learnings_*` araçları tüm repoların öğrenim kaydını okur |
180
180
  | `/multi-agent:garbage-collect` | Artık scratch, sahipsiz worktree ve offload edilmiş payload'ları süpürür. `--abandoned` ile durup bir daha dönülmemiş koşuları da toplar. Önce dry-run |
181
181
  | `/multi-agent:prune-logs` | Görev loglarını yaş / proje / görev filtresiyle siler. Denetim izi ve metrikler kalır |
182
+ | `/multi-agent:clean-disk` | Disk alanı açar: her kategoriyi ölçer, neyin silineceğini seçtirir, uygular, açılan alanı raporlar. Seçmeden hiçbir şey silinmez |
182
183
  | `/multi-agent:purge` | Tüm worktree, branch, log ve state dosyalarını siler. Çift onay |
183
184
 
184
185
  ### Review
@@ -187,6 +188,7 @@ Koşunun kendisinde ayarlanabilen tek şey autopilot; geri kalan her şey kendi
187
188
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ |
188
189
  | `/multi-agent:review` | Branch diff'i veya PR üzerinde paralel review; PR girdisinde inline yorum + approve/needs-work |
189
190
  | `/multi-agent:review-jira` | Bir Jira issue'sunun geliştirmeye hazırlığını puanlar, eksikleri yorum olarak yazar |
191
+ | `/multi-agent:review-priority` | Ekibin açık bug priority'lerini kural dosyasına göre denetler. Salt okur; her seferinde tek onaylı değişiklik |
190
192
  | `/multi-agent:review-issue` | Aynı puanlama, GitHub issue'su için |
191
193
  | `/multi-agent:review-analysis` | Yazılmış analiz dokümanını review eder; bulgular ihlal edilen Locked kuralını gösterir |
192
194
  | `/multi-agent:diff-explain` | Faz 4 triyaj bulgusunu onu doğuran diff satırlarına eşler |
@@ -467,17 +469,17 @@ Bu, ilgili plugin'i (+ ortak `ai-common` plugin'ini) repo'nun `.claude/settings.
467
469
 
468
470
  ## Araç desteği
469
471
 
470
- Pipeline **Claude Code**, **Copilot CLI** ve **Codex CLI** üzerinde native çalışır - üçü de aynı `pipeline/` kaynağından kurulur ve aynı <!-- fact:commandCount -->71<!-- /fact --> komutu alır.
472
+ Pipeline **Claude Code**, **Copilot CLI** ve **Codex CLI** üzerinde native çalışır - üçü de aynı `pipeline/` kaynağından kurulur ve aynı <!-- fact:commandCount -->73<!-- /fact --> komutu alır.
471
473
 
472
474
  | Araç | Bayrak | Ne kurar |
473
475
  | ----------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------- |
474
476
  | Claude Code | `--claude` (varsayılan) | slash komutları + skill'ler + agent'lar + üç `PreToolUse` hook'u (secret scan, agent-guard, okuma-boyutu geçidi) |
475
- | Copilot CLI | `--copilot` | talimatlar + <!-- fact:commandCount -->71<!-- /fact --> alt-komut skill'i + script'ler |
476
- | Codex CLI | `--codex` | bir router skill + ref olarak <!-- fact:commandCount -->71<!-- /fact --> spec + <!-- fact:agentCount -->11<!-- /fact --> agent TOML + `AGENTS.md` bloğu + `codex mcp add` |
477
+ | Copilot CLI | `--copilot` | talimatlar + <!-- fact:commandCount -->73<!-- /fact --> alt-komut skill'i + script'ler |
478
+ | Codex CLI | `--codex` | bir router skill + ref olarak <!-- fact:commandCount -->73<!-- /fact --> spec + <!-- fact:agentCount -->11<!-- /fact --> agent TOML + `AGENTS.md` bloğu + `codex mcp add` |
477
479
 
478
480
  Skill'leri stack'e göre filtrele: `--platform=ios\|android\|all`.
479
481
 
480
- **Codex neden <!-- fact:commandCount -->71<!-- /fact --> değil de tek bir skill alıyor.** Codex, keşfettiği her skill'in adını
482
+ **Codex neden <!-- fact:commandCount -->73<!-- /fact --> değil de tek bir skill alıyor.** Codex, keşfettiği her skill'in adını
481
483
  ve açıklamasını tek bir prompt bloğuna toplar ve blok taştığında girdileri hatasızca
482
484
  düşürür. 0.145 üzerinde ölçüldü: 142 skill deklare eden bir plugin kurulduğunda sadece
483
485
  75'i yüzeye çıktı ve alakasız bir kullanıcı skill'i tahliye edildi. Bu yüzden Codex'te
@@ -537,7 +539,7 @@ Pipeline'ı kurmak yalnız onu çalıştırdığında işe yaramıyor. Sıradan
537
539
 
538
540
  - **Zaten onboard ettiğin servisler.** `setup`'ın eşlediği token okunabilir durumda - mantıksal adı `credential-store.sh` ile çöz, issue'yu, sayfayı, logu getir. **Okuma sıradan iş, yazma değil.** Jira yorumu, issue düzenleme ve PR açma pipeline komutlarından geçer, çünkü onları güvenli kılan kurallar (issue asla otomatik kapanmaz, `Closes:` değil `Ref:`, dışa dönük metinde humanizer) orada yaşıyor.
539
541
  - **`/multi-agent:stack`'in bu repo için açtığı stack skilleri.** Yönlendirmeyi her toolkit'in kendi `index` skill'i yapar; pipeline o tablonun kopyasını tutmaz.
540
- - **`multi-agent-toolkit` MCP.** <!-- fact:toolCount -->228<!-- /fact --> araç, çoğu çalışan uygulama için - ekran durumu, crash logu, tasarım karşılaştırma, store ön-kontrolü, web kazıma ve tarayıcı test durumları. Bazı kontrolleri gözle değil ölçümle yapar. WCAG kontrastı `design_contrast_check` ile, tema ya da RTL değişince kayan yerleşim `ios_visual_diff` (`mode: "layout"`) ile ölçülür. Mağaza metni sınırlarını `store_listing_lint` denetler. `store_review_themes` yorumları temalara ayırır ve alıntıyı birebir bırakır. Güvenlik bulgularının gerçek satırlara dayandığını `security_evidence_check` doğrular; `security_sarif_export` kod tarama ekranları için SARIF yazar. Öğrenim kaydı (`learnings_*`) ve kod grafiği (`graph_*`) de buradan okunur.
542
+ - **`multi-agent-toolkit` MCP.** <!-- fact:toolCount -->230<!-- /fact --> araç, çoğu çalışan uygulama için - ekran durumu, crash logu, tasarım karşılaştırma, store ön-kontrolü, web kazıma ve tarayıcı test durumları. Bazı kontrolleri gözle değil ölçümle yapar. WCAG kontrastı `design_contrast_check` ile, tema ya da RTL değişince kayan yerleşim `ios_visual_diff` (`mode: "layout"`) ile ölçülür. Mağaza metni sınırlarını `store_listing_lint` denetler. `store_review_themes` yorumları temalara ayırır ve alıntıyı birebir bırakır. Güvenlik bulgularının gerçek satırlara dayandığını `security_evidence_check` doğrular; `security_sarif_export` kod tarama ekranları için SARIF yazar. Öğrenim kaydı (`learnings_*`) ve kod grafiği (`graph_*`) de buradan okunur.
541
543
 
542
544
  Uninstall bu katmanı korur: token'lar, onları açan okuyucu, adlarını tutan eşleme ve MCP kaydı. Pipeline'ı kaldırmak, onun üzerinden onboard ettiğin credential'ları kaybetmek anlamına gelmemeli.
543
545
 
@@ -115,7 +115,7 @@ graph TB
115
115
  end
116
116
 
117
117
  subgraph "Pipeline Specs"
118
- CMD[commands/<br/>71 command files]
118
+ CMD[commands/<br/>73 command files]
119
119
  AGT[agents/<br/>11 agent personas]
120
120
  RUL[rules/<br/>13 domain rules]
121
121
  PHS[multi-agent-refs/phases/<br/>phase specs + contracts]
@@ -207,8 +207,8 @@ repo and the website, plus the two independently shipped repos
207
207
  ```mermaid
208
208
  graph TD
209
209
  CC["Claude Code<br/>(source of truth)"]
210
- COP["Copilot CLI<br/>(instructions + 71 sub-command skills)"]
211
- COD["Codex CLI<br/>(1 router skill + 71 refs)"]
210
+ COP["Copilot CLI<br/>(instructions + 73 sub-command skills)"]
211
+ COD["Codex CLI<br/>(1 router skill + 73 refs)"]
212
212
  REPO["Pipeline Repo<br/>(npm package)"]
213
213
  WEB["Website"]
214
214
  PLUGREPO["multi-agent-plugins<br/>(6 plugins, own repo)"]
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 -->71<!-- /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 -->73<!-- /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-toolkit-mcp`** | The pipeline's hands on devices and browsers: <!-- fact:toolCount -->228<!-- /fact --> MCP tools across <!-- fact:toolFamilyCount -->23<!-- /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) | npm package, registered as a standard stdio MCP server on every host |
10
+ | **`multi-agent-toolkit-mcp`** | The pipeline's hands on devices and browsers: <!-- fact:toolCount -->230<!-- /fact --> MCP tools across <!-- fact:toolFamilyCount -->23<!-- /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) | 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 · 71 commands"]
22
+ PHASES["6 phases · 73 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/>71 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 + 71 refs<br/>+ 11 agent TOML"]
73
+ CC -->|"Step 2: copy + reformat<br/>73 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 + 73 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
 
@@ -95,7 +95,7 @@ graph TD
95
95
  from the Claude Code source - sync writes their content. `multi-agent-toolkit-mcp` is not:
96
96
  it's a separate codebase developed on its own schedule. Sync's Step 3d only
97
97
  *detects* whether it moved (dirty tree, unpushed commits, untagged version), runs
98
- **its own** gate suite, and ships it - commit, tag, `npm publish`. If the pipeline
98
+ **its own** gate suite, and ships it - commit, tag, staged publish (section 6). If the pipeline
99
99
  needs a tool that toolkit doesn't have yet, that's a two-repo change: add the tool
100
100
  in `multi-agent-toolkit-mcp`, ship it, then bump the minimum version pin back in
101
101
  `cross-cli-contract.md` (see section 4).
@@ -113,7 +113,7 @@ hand-authored *inside* `multi-agent-plugins` and are never touched by sync.
113
113
  <!-- facts: skillCount="skills - single authoring source" -->
114
114
  ```mermaid
115
115
  graph TD
116
- EXT["pipeline/skills/shared/external/<br/>167 skills - single authoring source<br/>(the pipeline's own phases read these too)"]
116
+ EXT["pipeline/skills/shared/external/<br/>168 skills - single authoring source<br/>(the pipeline's own phases read these too)"]
117
117
 
118
118
  EXT -->|"cross-stack skills"| COMMONP["ai-common-toolkit"]
119
119
  EXT -->|"outside facts for analysis"| ANAP["ai-analyst-toolkit"]
@@ -136,7 +136,7 @@ graph TD
136
136
  style EXT fill:#ffd,stroke:#333
137
137
  ```
138
138
 
139
- Together the plugins carry more skills than the <!-- fact:skillCount -->167<!-- /fact -->-skill source because each
139
+ Together the plugins carry more skills than the <!-- fact:skillCount -->168<!-- /fact -->-skill source because each
140
140
  plugin also carries its own authored `reference/`, `workflow/` and `tools/`
141
141
  skills and an `index` router. A vendored knowledge skill ships in exactly one
142
142
  plugin: cross-stack skills go to `ai-common-toolkit` rather than into every
@@ -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 -->71<!-- /fact --> slash-command skills, native | <!-- fact:commandCount -->71<!-- /fact --> sub-command skills, `multi-agent-{cmd}` naming, copied in | 1 router skill (`multi-agent`) + <!-- fact:commandCount -->71<!-- /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 -->73<!-- /fact --> slash-command skills, native | <!-- fact:commandCount -->73<!-- /fact --> sub-command skills, `multi-agent-{cmd}` naming, copied in | 1 router skill (`multi-agent`) + <!-- fact:commandCount -->73<!-- /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-toolkit-mcp** | `claude mcp add multi-agent-toolkit -- npx -y @mmerterden/multi-agent-toolkit-mcp` | `copilot mcp add multi-agent-toolkit -- npx -y @mmerterden/multi-agent-toolkit-mcp` | `codex mcp add multi-agent-toolkit -- npx -y @mmerterden/multi-agent-toolkit-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-toolkit-mcp's tools, by category
241
241
 
242
- <!-- fact:toolCount -->228<!-- /fact --> tools in <!-- fact:toolFamilyCount -->23<!-- /fact --> families, counted from the server's own `tools/list` response
243
- at toolkit <!-- fact:toolkitVersion -->3.31.0<!-- /fact --> rather than from a README. Three families are defined in
242
+ <!-- fact:toolCount -->230<!-- /fact --> tools in <!-- fact:toolFamilyCount -->23<!-- /fact --> families, counted from the server's own `tools/list` response
243
+ at toolkit <!-- fact:toolkitVersion -->3.32.1<!-- /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.
@@ -253,8 +253,8 @@ skill body and leaves frontmatter `allowed-tools` alone. Both qualified forms
253
253
  let `lint-mcp-refs.mjs` check that the tool exists.
254
254
 
255
255
  The families can be narrowed per host: `MCP_TOOLKIT_CAPS` serves only the named
256
- ones, and unset serves all <!-- fact:toolCount -->228<!-- /fact -->. A frontend repo that sets `web,code,context`
257
- sees 50 tools instead of <!-- fact:toolCount -->228<!-- /fact -->, which matters because every registered server's
256
+ ones, and unset serves all <!-- fact:toolCount -->230<!-- /fact -->. A frontend repo that sets `web,code,context`
257
+ sees 50 tools instead of <!-- fact:toolCount -->230<!-- /fact -->, which matters because every registered server's
258
258
  tool list is charged against the context window on every turn.
259
259
 
260
260
  | Family | Tools | Primary pipeline consumers |
@@ -304,3 +304,40 @@ tool list is charged against the context window on every turn.
304
304
  present *for specific task types* (component work, UI testing) but functions
305
305
  without either - a non-component bugfix task never touches the plugin marketplace,
306
306
  and a task with no UI-testing step never opens the MCP connection.
307
+
308
+ ---
309
+
310
+ ## 6. Release step: staged npm publish
311
+
312
+ Both npm packages, the pipeline and `multi-agent-toolkit-mcp`, are published
313
+ with `pipeline/scripts/publish-staged.mjs` from a clean checkout of the
314
+ release tag, never with a bare `npm publish`. `latest` then only ever names a
315
+ version the registry was seen to serve and that installed:
316
+
317
+ 1. `npm pack`, and the tarball's sha512 computed locally; npm's reported
318
+ integrity must agree.
319
+ 2. `npm publish <tarball> --tag candidate`. A version the registry already
320
+ holds with the same bytes is a resumed release and is not published again;
321
+ with other bytes it is refused.
322
+ 3. Poll the packument over HTTP (not `npm view`, whose cache answers before
323
+ the registry does) until the version carries the local integrity and the
324
+ `candidate` tag names it. A different integrity fails at once.
325
+ 4. Download the tarball the registry serves and compare its sha512.
326
+ 5. Install that tarball into an empty temp project with scripts off, and check
327
+ the installed version and its bins.
328
+ 6. Run `--smoke "<cmd>"` in that project, when given.
329
+ 7. `npm dist-tag add <name>@<version> latest`, then poll until `latest` names it.
330
+
331
+ ```bash
332
+ node pipeline/scripts/publish-staged.mjs --dir . --userconfig "$TMP_NPMRC" \
333
+ --smoke "node node_modules/@mmerterden/multi-agent-pipeline/index.js --version"
334
+ ```
335
+
336
+ `--userconfig` points every npm call at a temporary npmrc built from the
337
+ credential store, so the token never reaches argv. Exit 0 means promoted; 1
338
+ means nothing was published; 3 means the version is on `candidate` and
339
+ `latest` did not move, and running the same command again resumes from the
340
+ registry check. `--dry-run` stops after the pack. `test/publish-staged.test.mjs`
341
+ drives the whole flow against a fake npm and a fake registry, including a
342
+ corrupted upload, a slow registry, a failed install, a failed smoke and a
343
+ resumed release.
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-03",
4
- "version": "20.41.0",
3
+ "generatedAt": "2026-11-04",
4
+ "version": "20.43.0",
5
5
  "phaseSchema": 2,
6
6
  "phases": [
7
7
  {
@@ -35,12 +35,12 @@
35
35
  "autopilot": [0, 1, 2, 3, 4, 5],
36
36
  "analysis": [0, 1, 2, 3, 4, 5]
37
37
  },
38
- "commandCount": 71,
39
- "skillCount": 167,
40
- "skillCountAll": 241,
38
+ "commandCount": 73,
39
+ "skillCount": 168,
40
+ "skillCountAll": 244,
41
41
  "agentCount": 11,
42
42
  "hosts": ["Claude Code", "Codex CLI", "Copilot CLI"],
43
- "toolCount": 228,
43
+ "toolCount": 230,
44
44
  "toolCategories": {
45
45
  "ios": 42,
46
46
  "web": 38,
@@ -55,17 +55,17 @@
55
55
  "security": 5,
56
56
  "ui": 5,
57
57
  "context": 4,
58
+ "media": 4,
58
59
  "pass": 4,
59
60
  "document": 3,
60
61
  "learnings": 3,
61
62
  "research": 3,
62
63
  "agent": 2,
63
64
  "llm": 2,
64
- "media": 2,
65
65
  "coverage": 1,
66
66
  "social": 1,
67
67
  "test": 1
68
68
  },
69
- "pluginSkillCount": 262,
70
- "toolkitVersion": "3.31.0"
69
+ "pluginSkillCount": 264,
70
+ "toolkitVersion": "3.32.1"
71
71
  }
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-toolkit` MCP.** <!-- fact:toolCount -->228<!-- /fact --> tools, most of them for a running app.
57
+ - **The `multi-agent-toolkit` MCP.** <!-- fact:toolCount -->230<!-- /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
 
@@ -256,7 +256,7 @@ A triage verdict is a judgment call; a failing repro test is proof. When `prefs.
256
256
 
257
257
  ### Immutable-Test Rule + `test_lines_removed` Signal
258
258
 
259
- Existing tests are immutable during a task: deleting, renaming, or weakening an assertion to reach green is a violation (`refs/rules.md`, Phase 2 GREEN step). A test changes only when the task changes the spec it encodes, named in the commit body. Deterministic backstop: `diff-risk-score.mjs` emits `test_lines_removed` (w=3.0) for any test-classified file whose diff removes more lines than it adds.
259
+ Existing tests are immutable during a task: deleting, renaming, or weakening an assertion to reach green is a violation (`refs/rules.md`, Phase 2 GREEN step). A test changes only when the task changes the spec it encodes, named in the commit body. Deterministic backstop: `diff-risk-score.mjs` emits `test_lines_removed` (w=3.0) for any test-classified file whose diff removes more lines than it adds. In Phase 2 the tests a todo wrote in RED are kept (`tdd-red` stores their bytes): `tdd-green` refuses a run in which one was weakened or deleted unless `--test-edit-reason` says why, `tdd-restore` puts them back, and `test-integrity-gate.mjs --state` reports a recorded edit as important and an unrecorded one as blocking.
260
260
 
261
261
  ### Update Check at Run Start
262
262
 
@@ -314,9 +314,13 @@ Detail: [`autopilot-operations.md`](../pipeline/multi-agent-refs/features/autopi
314
314
  ### Security Base
315
315
 
316
316
  - **Fail-closed guard.** `agent-guard.sh` is the PreToolUse hook on `Bash`, `Edit|Write|NotebookEdit` and `WebFetch|mcp__multi-agent-toolkit__.*`. Under the variable a Bash command is judged only when it reduces to simple commands joined by `;`, `&&`, `||` and plain pipes between non-interpreter commands; a subshell, group, nested substitution, unquoted heredoc, background job, shell keyword, interpreter reading stdin, shell `-c`, inline interpreter program (`node -e`, `perl -e`, `php -r`, ...), program file the run wrote or modified, or runtime-built command name is refused unparsed. On what it parses: no push, PR, issue or tracker write, no Keychain read, no package install or manifest edit, no write into a protected path. The guard arms its own 5-second deadline and answers "block" on expiry when unattended.
317
+ - **Destructive floor, every mode.** A recursive `rm` of the filesystem root, of `$HOME` or of a directory above it (`~`, `$HOME`, `${HOME}/*`, `../..` resolved against the working directory, `--no-preserve-root`), and a fork bomb (`:(){ :|:& };:` under any name, perl's `fork while fork`) ask the user in an attended session and are refused unattended. A delete inside home or the project, a quoted mention and an ordinary shell function do not ask.
318
+ - **Encoded secrets.** The outbound gate, the command-line credential scan and the memory secret scan also match the certain credential shapes on a bounded decode of the text: base64 (standard and URL-safe), hex and rot13, two layers deep, a decoded run kept only when nine tenths of it is printable, at most 32 copies and 256 KB decoded per scan. A finding names the decode path (`encoding: "base64>hex"`). The guard reads a stored-secret read hidden the same way. Hashes, paths, images and encoded configuration are held to no finding by a negative set.
319
+ - **Guard probe.** `eval-guard-robustness.mjs` throws ReDoS-shaped input, a 1 MB string and 5000-deep nesting at every PreToolUse hook in the install template and at the library matchers, each in its own process group with a timeout. A probe fails on a timeout, an exit outside 0 and 2, a throw, or a median over the hook's own timeout (1 s for a library call); a dated known-holes list holds an accepted failure until its expiry. `npm test` runs the `--fast` subset; `npm run eval:guards` runs the whole probe.
317
320
  - **Network allowlist.** `curl`, `wget`, `WebFetch` and the toolkit's `web_*` tools reach only hosts in the allowlist (`network.staticHosts` plus the configured service hosts); a URL built at run time, a proxy flag or a request body is refused, and `web_eval` is refused outright. The runner starts the toolkit with `MCP_TOOLKIT_URL_POLICY=strict` and `MCP_TOOLKIT_INDEX_DENY`.
318
321
  - **No package installs.** A restore from the committed lockfile is allowed; adding a package is not.
319
- - **Untrusted data.** Fetched bodies, ticket text, comments and PR text enter prompts inside `<untrusted-data>` delimiters that defuse a forged closing tag.
322
+ - **Untrusted data.** Fetched bodies, ticket text, comments and PR text enter prompts inside `<untrusted-data>` delimiters that defuse a forged closing tag. Text that reads like instructions to the model gets `suspicious="instruction-override,tool-invocation,..."` on its block, naming in a fixed order the classes the toolkit uses for the same mark: instruction-override (override phrases, new-directive headers, role reassignment, prompt probes, requests to keep something from the user), role-tag (chat template tokens and forged conversation turns), tool-invocation, exfiltration and fence-escape. The patterns are matched on the text and on a folded copy, over the head and tail of a long text; hidden or look-alike characters hide text rather than instruct, so they are not marked. The mark is a signal and never blocks; the toolkit vendors the same file, and a block it already labels with `injection-flags` gets no second mark.
323
+ - **Risky settings at install.** Before the installer merges its hooks it reads `~/.claude/settings.json` for what lets anything run unasked: `bypassPermissions` with a blanket Bash allow or every project MCP server enabled (HIGH), a hook that pipes fetched or decoded code into a shell (HIGH), a literal credential (HIGH), and each risky setting alone or a floating MCP launch (MEDIUM). It prints the rule and the place, never a value, changes nothing, and leaves `multi-agent-risky-settings.json` for `/multi-agent:setup`, which asks about each HIGH finding.
320
324
  - **Permission profile.** `install --unattended` writes a `dontAsk` profile with a narrow allow list and deny rules into `~/.claude/multi-agent-unattended.settings.json`, printed in full before anything is written; the runner passes it with `claude --settings`, so `~/.claude/settings.json` and attended sessions are unchanged. A default install writes no permissions.
321
325
  - **Machine setup, applied by the operator.** A separate non-admin macOS user for the runner, per-repo GitHub credentials limited to contents and pull requests, a Jira token that can only read and comment, and GitHub rulesets on every default and release branch (no force-push, no deletion, PR and code-owner review required, the bot in no bypass list).
322
326
 
@@ -333,7 +337,7 @@ While the quality gates are active (`MULTI_AGENT_UNATTENDED=1`, or `state.autopi
333
337
  | `verify-citations` | a triage citation quotes the line it cites (at least 8 non-space characters, or the whole line) |
334
338
  | pre-existing claims | a "pre-existing" finding cites a line the diff from the base does not add or change |
335
339
  | `plan-coverage` | every plan step is accounted for; a planned run with no todos is a gap |
336
- | `evidence-gate`, `test-summary` | build and test claims read with the stack's own markers and a positive executed test count |
340
+ | `evidence-gate`, `test-summary` | build and test claims read with the stack's own markers and a positive executed test count; the run must cover the whole suite (a narrowed command such as `-only-testing`, `-k`, `-t` or one test file fails) and be on the source as it is now: the entry carries a digest of the working tree, so an edit after the build makes it stale at commit |
337
341
  | `test-strength` | a new test goes red without the change it claims to cover |
338
342
  | `review-decision` | a `blocking` finding carries two independent reviewers or a failing test |
339
343
  | `spec-consistency`, `plan-critique` | recorded, not required at commit (see below) |
@@ -410,6 +414,7 @@ Per-phase token budgets prevent runaway sessions. If a phase exceeds its budget,
410
414
  - **Cost Telemetry**: Per-phase token cost tracking (`tokens_in`, `tokens_out`, `model`, `duration_ms`). Omitted fields handled gracefully.
411
415
  - **Phase Tracker**: Cross-CLI visual progress (current phase, elapsed time, iteration count).
412
416
  - **Phase Banner**: Terminal UI for phase transitions with Unicode box-drawing characters.
417
+ - **Status Line (opt-in)**: `node ~/.claude/scripts/statusline.mjs install` adds a Claude Code `statusLine` showing the run this session drives: phase, cost against `costBudget`, gates passed and the first failing one, and whether it waits for an answer. Local files only, no network. Install never replaces a `statusLine` that is already set; `uninstall` removes only its own.
413
418
  - **Per-task Cost Breakdown in agent-log.md**: Phase 5 appends a 4-column block (Phase · Model · Tokens in/out · Est. USD) to every run's `agent-log.md`. Sourced from `phase-tracker.sh tokens` accumulators × `cost-table.json` prices. Independent of the channels-side `reportContent.costSummary` toggle. The `LOG_METRIC_FORWARD_TO_TRACKER=1` env flag mirrors `tokens_in`/`tokens_out`/`model` from `log-metric.sh` into the tracker so JSONL metrics and the cost block stay in sync from one call site.
414
419
 
415
420
  ### Run Post-Mortem (`/multi-agent:postmortem`)
@@ -44,6 +44,7 @@ import { registerMcpServer } from "./_mcp-register.mjs";
44
44
  import { linkClaudeXcodePlugin } from "./_xcode-skills.mjs";
45
45
  import { applyFableRung, fableEnabled } from "../pipeline/lib/agent-model-sync.mjs";
46
46
  import { PREFS_FILE, prefsFileIn } from "../pipeline/lib/prefs-value.mjs";
47
+ import { RISKY_REPORT, riskyReport, scanRiskySettings } from "../pipeline/lib/risky-settings.mjs";
47
48
 
48
49
  export const AGENT_GUARD_FILE_MATCHER = "Edit|Write|NotebookEdit";
49
50
  // WebFetch and the toolkit's tools reach hosts with no Bash hook to see them:
@@ -755,7 +756,7 @@ export function quotePipelineHookCommands(hooks) {
755
756
  * The run-scoped hooks the installer registers beside the two gates above:
756
757
  * run-stop-guard.sh (Stop), task-mirror.sh (TaskCreate / TaskUpdate),
757
758
  * answer-check.sh (AskUserQuestion, in every session: it only adds context),
758
- * file-context.sh (after a Read, and before a Read, Grep or Glob), run-scope-guard.sh (Figma MCP tools, file edits, Figma over HTTP and direct run-state writes in Bash or WebFetch), 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
759
+ * file-context.sh (after a Read, and before a Read, Grep or Glob), 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
759
760
  * registering them by default changes nothing until a run is active. note-skill-use.sh runs in every
760
761
  * session, records only the skill name, outcome, time, host and repo folder name into the local
761
762
  * skill-usage log, and is off with prefs.global.skillUsage.enabled false. note-mcp-failure.sh
@@ -812,6 +813,13 @@ export const RUN_HOOKS = [
812
813
  timeout: 10,
813
814
  statusMessage: "Checking the edit is inside the run's worktree...",
814
815
  },
816
+ {
817
+ event: "PreToolUse",
818
+ matcher: "Agent|Task",
819
+ script: "run-scope-guard.sh",
820
+ timeout: 10,
821
+ statusMessage: "Checking the run's cost budget before a new subagent...",
822
+ },
815
823
  {
816
824
  event: "PreToolUse",
817
825
  matcher: "Bash|WebFetch|AskUserQuestion",
@@ -899,6 +907,29 @@ export function ensureHook(hooks, r) {
899
907
  return true;
900
908
  }
901
909
 
910
+ /**
911
+ * The risky-settings gate, before the hooks are merged: findings are printed
912
+ * (rule and place, never a value) and left in RISKY_REPORT for
913
+ * /multi-agent:setup to ask about. Nothing in settings.json is changed here;
914
+ * a clean scan removes an old report.
915
+ */
916
+ function reportRiskySettings(home, settings, settingsPath) {
917
+ const reportPath = join(home, ".claude", RISKY_REPORT);
918
+ const findings = scanRiskySettings(settings);
919
+ if (!findings.length) {
920
+ if (existsSync(reportPath) && !isDryRun()) unlinkSync(reportPath);
921
+ return;
922
+ }
923
+ const high = findings.filter((f) => f.level === "HIGH").length;
924
+ console.log(
925
+ ` -> Risky settings in ${settingsPath}: ${high} high, ${findings.length - high} medium (left as they are; /multi-agent:setup asks about them)`,
926
+ );
927
+ for (const f of findings) console.log(` [${f.level}] ${f.rule} (${f.where}): ${f.message}`);
928
+ if (!isDryRun()) {
929
+ writeFile(reportPath, `${JSON.stringify(riskyReport(findings, settingsPath), null, 2)}\n`);
930
+ }
931
+ }
932
+
902
933
  export function configureSettings(home) {
903
934
  console.log(" [Claude Code] Configuring hooks + context management...");
904
935
  const SETTINGS_PATH = join(home, ".claude", "settings.json");
@@ -907,6 +938,8 @@ export function configureSettings(home) {
907
938
  ? JSON.parse(readFileSync(SETTINGS_PATH, "utf-8"))
908
939
  : {};
909
940
 
941
+ reportRiskySettings(home, settings, SETTINGS_PATH);
942
+
910
943
  let settingsChanged = false;
911
944
 
912
945
  if (!settings.env) settings.env = {};
@@ -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-toolkit tool (WebFetch|mcp__multi-agent-toolkit__.*). 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 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 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-toolkit__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 chosen from the error text (a JSON-RPC code first, 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-toolkit tool (WebFetch|mcp__multi-agent-toolkit__.*). 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 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-toolkit__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.",
3
3
  "hooks": {
4
4
  "PreToolUse": [
5
5
  {
@@ -80,6 +80,17 @@
80
80
  }
81
81
  ]
82
82
  },
83
+ {
84
+ "matcher": "Agent|Task",
85
+ "hooks": [
86
+ {
87
+ "type": "command",
88
+ "command": "bash \"$HOME/.claude/scripts/run-scope-guard.sh\"",
89
+ "timeout": 10,
90
+ "statusMessage": "Checking the run's cost budget before a new subagent..."
91
+ }
92
+ ]
93
+ },
83
94
  {
84
95
  "matcher": "Read|Grep|Glob",
85
96
  "hooks": [