@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
@@ -62,7 +62,7 @@ behind.
62
62
  15. **New assets default to SVG.** Section 8 entries marked `new` are SVG unless a documented exception is captured in the rationale column (Lottie for motion design, optimized PNG for raster-only icons). PDF, JPG, and unoptimized PNG are rejected.
63
63
  16. **Files-to-Add tag required.** Every row in Section 14 carries one tag from `Reuse | Add new | Modify`. Untagged rows fail the dispatch gate.
64
64
  17. **API response variants exhaustive.** Section 9 lists every HTTP status code returned by the endpoint with at least one example body and the matching UI outcome. Phrases like "other errors" or "various 4xx" are rejected.
65
- 18. **Screenshots embedded, not linked, and every inventory row gets one.** Section 5 frame galleries reference local PNG files. Dispatch uploads them as Confluence multipart attachments and injects `<ac:image><ri:attachment ri:filename="..." /></ac:image>` into the page body. The gallery is generated from the inventory, never hand-picked: one row, one embedded image, ordered by node id and titled `<nodeId> <frame name>`. A bare filename in a table cell is text to the reader, not a picture: an attachment that is uploaded but not embedded is invisible on the page. Narrowing to a canonical subset for page weight is not a call the run makes on its own; the display-width cap (`md2confluence-v3.py --image-width`, phone frames overriding to 320) already solves readability without dropping evidence. Dispatch reports the embedded-over-inventory ratio and warns below 1. URL-only Figma references in Section 5 are a review finding, not a validator ERROR: the check belongs to the Confluence dispatch step, which is the only place that knows whether an attachment upload succeeded.
65
+ 18. **Screenshots embedded, not linked, and every inventory row gets one.** Section 5 frame galleries reference local PNG files. Dispatch uploads them as Confluence multipart attachments and injects `<ac:image><ri:attachment ri:filename="..." /></ac:image>` into the page body. The gallery is generated from the inventory, never hand-picked: one row, one embedded image, ordered by node id and titled `<nodeId> <frame name>`. A bare filename in a table cell is text to the reader, not a picture: an attachment that is uploaded but not embedded is invisible on the page. Narrowing to a canonical subset for page weight is not a call the run makes on its own; the display-width cap (`md2confluence-v3.py --image-width`, with every gallery frame at the 240 px table-cell width) already solves readability without dropping evidence. Dispatch reports the embedded-over-inventory ratio and warns below 1. URL-only Figma references in Section 5 are a review finding, not a validator ERROR: the check belongs to the Confluence dispatch step, which is the only place that knows whether an attachment upload succeeded.
66
66
  19. **All Figma variants drilled, and drilled means read.** When a Figma section URL is supplied, all child frames are drilled, not just the canonical default. The renderer enumerates child frames via `mcp__claude_ai_Figma__get_metadata` (Tier 1) or `figma-screenshot.sh --section` (Tier 2) and produces one Section 5.1 row per child frame. Counting them is not drilling them: extract the visible `TEXT` layers inside each frame's own bounds, dropping hidden layers and component-instance boilerplate that overflows the frame (default card and widget filler can outnumber the real text several times over). A frame may be called out of scope only by quoting its own extracted text; "the name looked unrelated" is not a reason. Opening a Section 20 question about a frame requires that its text was extracted first, and asking about a frame nobody read fails the dispatch gate: a frame whose name looks ambiguous can spell out a whole step in its text.
67
67
  20. **Localization mode (ownership-aware).** Section 10's shape is driven by the project `figma-config` `localization.ownership` (default `in-repo`). The locale set comes from `localization.locales` (default `tr, en, ar, de, es, fr, it, ru`); do not hardcode a locale list in the render.
68
68
  - **`in-repo`** (default, historical behavior): new keys carry filled cells for every configured locale. Placeholder values `[bekleniyor: çeviri ekibi]` / `[pending: translation team]` are a soft state and the dispatch report flags `i18n_pending: <count>` as a blocker. Empty cells are rejected outright.
@@ -1,7 +1,7 @@
1
1
  # Cross-CLI Contract (Claude Code · Copilot CLI · Codex CLI)
2
2
 
3
3
  <!-- toc -->
4
- - [1. Command Inventory (71 commands)](#1-command-inventory-71-commands)
4
+ - [1. Command Inventory (73 commands)](#1-command-inventory-73-commands)
5
5
  - [2. Canonical Placeholder Vocabulary](#2-canonical-placeholder-vocabulary)
6
6
  - [2.6 Intentional structural divergence - thin dispatcher vs inlined orchestrator](#26-intentional-structural-divergence---thin-dispatcher-vs-inlined-orchestrator)
7
7
  - [2.7 One command, three different meanings: `/multi-agent:model`](#27-one-command-three-different-meanings-multi-agentmodel)
@@ -20,17 +20,17 @@
20
20
 
21
21
  ---
22
22
 
23
- ## 1. Command Inventory (71 commands)
23
+ ## 1. Command Inventory (73 commands)
24
24
 
25
25
  ```
26
26
  analysis, analysis-jira, analysis-resolve, autopilot, autopilot-off,
27
- autopilot-on, autopilot-status, bug-bash, build-optimize, channels, complaint-analysis,
27
+ autopilot-on, autopilot-status, bug-bash, build-optimize, channels, clean-disk, complaint-analysis,
28
28
  create-jira, design-check, diff-explain, doctor, estimate, feedback, forget,
29
29
  garbage-collect, graph, health, help, ios-coding-standard, issue, jira, kill,
30
30
  language, log, manual-test, model, office-off, office-on, office-pair, office-status,
31
31
  postmortem, prune-logs,
32
32
  prune-prompts, purge, refactor, research, resume, review,
33
- review-analysis, review-issue, review-jira, route-off, route-on,
33
+ review-analysis, review-issue, review-jira, review-priority, route-off, route-on,
34
34
  route-status, routines, save, scaffold, scan, scenario-audit, search,
35
35
  security-review, serve, setup, stack, status, steer, store-ready, sync, test, test-accessibility,
36
36
  test-dark-mode, test-dynamic-type, test-gen, test-screenshots, testflight-validation,
@@ -43,7 +43,7 @@ Categories:
43
43
  - **Issue generator** (one-shot, no worktree, asks type Task/Bug/Story, hard approval gate before create): `create-jira`
44
44
  - **Pipeline entries**: `autopilot` (plus the bare `/multi-agent` in the dispatcher). The phase set is a property of the command, and every mode runs its whole set.
45
45
  - **Tail path** (the pipeline tail over work already on a branch, no run behind it): `resume`
46
- - **Ops commands** (one-shot, no worktree): `status`, `log`, `kill`, `steer`, `purge`, `uninstall`, `resume`, `review`, `review-jira`, `review-issue`, `analysis`, `analysis-resolve`, `research`, `scaffold`, `complaint-analysis`, `bug-bash`, `test-gen`, `build-optimize`, `channels`, `scan`, `search`, `diff-explain`, `garbage-collect`, `graph`, `health`, `postmortem`, `prune-logs`, `prune-prompts`, `serve`, `office-on`, `office-off`, `office-pair`, `office-status`
46
+ - **Ops commands** (one-shot, no worktree): `status`, `log`, `kill`, `steer`, `purge`, `uninstall`, `resume`, `review`, `review-jira`, `review-issue`, `review-priority`, `analysis`, `analysis-resolve`, `research`, `scaffold`, `complaint-analysis`, `bug-bash`, `test-gen`, `build-optimize`, `channels`, `scan`, `search`, `diff-explain`, `garbage-collect`, `graph`, `health`, `postmortem`, `prune-logs`, `prune-prompts`, `clean-disk`, `serve`, `office-on`, `office-off`, `office-pair`, `office-status`
47
47
  - **Local audits** (worktree only to build; no commit, push, PR or channels): `design-check`, `testflight-validation`, `ios-coding-standard`. `testflight-validation` additionally never invokes `altool --upload-app` - a validation run must not be able to ship a build by accident.
48
48
  - **Meta-ops**: `setup`, `sync`, `update`, `help`, `refactor`, `test`, `stack`, `manual-test`, `language`
49
49
  - **Routines** (user-defined routine registry; the routines they create are local-only and never synced): `save`, `routines`, `forget`
@@ -1,4 +1,12 @@
1
- # cost analysis - projection, anomaly, burn, diff
1
+ # cost analysis - projection, anomaly, burn, diff, advise
2
+
3
+ <!-- toc -->
4
+ - [Where the numbers come from, and what that makes them worth](#where-the-numbers-come-from-and-what-that-makes-them-worth)
5
+ - [Why the median and the MAD, not the mean](#why-the-median-and-the-mad-not-the-mean)
6
+ - [Why projection divides by the calendar window](#why-projection-divides-by-the-calendar-window)
7
+ - [Snapshots](#snapshots)
8
+ - [Advice](#advice)
9
+ <!-- /toc -->
2
10
 
3
11
  `cost-budget-check.mjs` answers one question, live, for one run: is THIS task
4
12
  about to cross its ceiling. Two ways a budget actually empties are invisible to
@@ -6,7 +14,7 @@ it. A slow drift never trips any single run's ceiling. And one pathological
6
14
  session can burn a week's worth in an hour while every individual run stays
7
15
  comfortably under its cap.
8
16
 
9
- `cost-analyze.mjs` answers the other four questions off one series.
17
+ `cost-analyze.mjs` answers the other questions off one series.
10
18
 
11
19
  | Sub-command | Question |
12
20
  |---|---|
@@ -14,6 +22,7 @@ comfortably under its cap.
14
22
  | `anomaly` | which day or session is out of family |
15
23
  | `burn` | is the last day accelerating against the preceding week |
16
24
  | `diff` | two saved snapshots, side by side |
25
+ | `advise` | which lever to pull, each finding with its numbers and their source |
17
26
 
18
27
  ```bash
19
28
  node "$HOME/.claude/scripts/cost-analyze.mjs" projection --days 14 [--monthly-usd 200]
@@ -21,6 +30,7 @@ node "$HOME/.claude/scripts/cost-analyze.mjs" anomaly --days 30 [--by day|sessio
21
30
  node "$HOME/.claude/scripts/cost-analyze.mjs" burn [--factor 3]
22
31
  node "$HOME/.claude/scripts/cost-analyze.mjs" --save [--days 30]
23
32
  node "$HOME/.claude/scripts/cost-analyze.mjs" diff [a.json b.json]
33
+ node "$HOME/.claude/scripts/cost-analyze.mjs" advise [--days 7]
24
34
  ```
25
35
 
26
36
  Exit 0 means nothing to report, 10 means a finding, 2 is a usage error. Every
@@ -95,3 +105,28 @@ budget to compare against would produce a number that looks measured.
95
105
  per-day rate and the per-day breakdown. `diff` compares two, by path or the last
96
106
  two by default, and says when the windows differ - the per-day rate is
97
107
  comparable across different windows, the total is not.
108
+
109
+ ## Advice
110
+
111
+ `advise` reads the same transcripts, sub-agent files under
112
+ `<session>/subagents/` included, and reports only what crosses a threshold.
113
+ Every finding carries `numbers` (the measured values), `source` (the
114
+ transcript root, file and record counts, the window and the price table) and
115
+ `savingUsd`: the same tokens repriced at another rate, or `null` where no
116
+ defensible figure exists.
117
+
118
+ | Finding | Fires when | Saving |
119
+ |---|---|---|
120
+ | `cache-read-ratio` | under 80% of input came from cache reads, over at least 1M input tokens | null |
121
+ | `ttl-1h-payback` | the 1-hour write surcharge (0.75x input over a 5-minute write) exceeds the value of the reads that came more than five minutes after the session's previous turn, by at least $0.50 | surcharge minus that value |
122
+ | `subagent-tier-<rung>` | sub-agent turns on fable or opus would cost at least $1 less one rung down | the difference |
123
+ | `context-bloat` | a session of 20 or more turns averaged 150k context tokens a turn | null |
124
+ | `unpriced` | a model id is not in `cost-table.json` | null |
125
+
126
+ A 1-hour write pays off only for a read a 5-minute entry would have missed,
127
+ which is a read after a pause of more than five minutes; reads in quick
128
+ succession were served as well by the cheaper TTL. The sub-agent finding names
129
+ the personas pinned to that rung by their frontmatter. For fable it points at
130
+ the fable switch, since `agent-model-sync.mjs` rewrites those installed
131
+ personas to opus when the switch is off. Quality is not measured here, so the
132
+ action asks for a comparison before a persona moves down.
@@ -6,6 +6,7 @@
6
6
  - [Who calls it, and what they do with the code](#who-calls-it-and-what-they-do-with-the-code)
7
7
  - [The four severities](#the-four-severities)
8
8
  - [The line shape](#the-line-shape)
9
+ - [The JSON report](#the-json-report)
9
10
  - [It recommends, it never fixes](#it-recommends-it-never-fixes)
10
11
  - [Checks](#checks)
11
12
  - [The server profile (`--profile=server`)](#the-server-profile---profileserver)
@@ -86,6 +87,35 @@ The third field is one step, and its first word comes from a closed list:
86
87
  `record`, `re-run`. `consider`, `may want` and `should probably` are refused by
87
88
  the gate. One problem, one step: a reader with five suggestions does nothing.
88
89
 
90
+ ## The JSON report
91
+
92
+ `--json` prints one document whose shape `schemas/doctor-report.schema.json`
93
+ fixes and `test/doctor-json-contract.test.mjs` holds against real output and a
94
+ golden file:
95
+
96
+ ```json
97
+ {
98
+ "schemaVersion": 1,
99
+ "exit": 1,
100
+ "selection": null,
101
+ "checks": [{ "id": "identity", "severity": "WARN", "problem": "...", "step": "set ...", "detail": null }]
102
+ }
103
+ ```
104
+
105
+ - `schemaVersion` changes only when an existing field changes meaning or
106
+ shape. A new check id, or a new optional field, does not change it, so a
107
+ reader keys on `id` and ignores ids it does not know.
108
+ - `exit` equals the process exit code (0, 1, 2 or 4).
109
+ - `selection` is the `--only` list in the order given, or null for a full run,
110
+ so a filtered report is never mistaken for a complete one.
111
+ - `checks` holds one entry per check that ran, in registry order. `problem` and
112
+ `step` are null for OK; `step` is null for SKIP.
113
+
114
+ `--only <id,...>` (or `--only=<id,...>`) runs and reports only the named
115
+ checks; the layout checks still run first, since nothing resolves without
116
+ them, and a run whose layout does not resolve is still exit 4. An unknown id
117
+ is exit 3 with the nearest known id named.
118
+
89
119
  ## It recommends, it never fixes
90
120
 
91
121
  Nothing here rewrites a remote URL, edits `settings.json` or touches a token.
@@ -295,6 +325,18 @@ many servers are worth their context is the user's call, not a health failure.
295
325
  The threshold is judgement, which is why it is a pref instead of a constant in
296
326
  the script - a number nobody can see is a number nobody can argue with.
297
327
 
328
+ ### mcp-schema-load
329
+
330
+ How much of every turn the toolkit's tool list takes, per tool family, and
331
+ what each `MCP_TOOLKIT_CAPS` family would save. With `--probe` it is measured
332
+ from the `tools/list` the registration probe served; without it, a
333
+ `families` field in the `tool-manifest.json` beside a toolkit registered by
334
+ path is read; otherwise SKIP. Tokens are bytes / 4 of the JSON each entry is
335
+ sent as: an estimate, and the problem line says so. INFO once the total
336
+ reaches `prefs.global.mcpSurface.schemaInfoAboveTokens` (default 8000), naming
337
+ the three largest families; `--explain` lists every family. Like
338
+ `mcp-surface` it only reports: which families a repo needs is the user's call.
339
+
298
340
  ### mcp-failures
299
341
 
300
342
  A server whose MCP tool calls keep failing, read from the local log
@@ -304,7 +346,9 @@ the arguments, the output or the error text. INFO when one server failed five
304
346
  times or more in the last 24 hours; `--explain` lists each such server with its
305
347
  failures per tool and per class. Invalid input, a denied call and an
306
348
  interrupted one are the caller's or the user's, so they never count toward the
307
- light. SKIP when `mcpFailures.enabled` is false or `usageLog.optOut` is true.
349
+ light. A single `disk-full` failure (ENOSPC, no space left on device) in the
350
+ window lights INFO on its own, with `/multi-agent:clean-disk` as the step. SKIP
351
+ when `mcpFailures.enabled` is false or `usageLog.optOut` is true.
308
352
 
309
353
  Nothing is probed: the light only reflects calls the sessions already made.
310
354
  INFO and never WARN, because a flaky third-party server makes a session worse
@@ -312,9 +356,27 @@ without making this install unhealthy.
312
356
 
313
357
  ### disk-space
314
358
 
315
- Free space on the volume holding `$HOME`. WARN under 2 GB: a worktree plus a
316
- build is the largest thing a run writes, and ENOSPC mid-run corrupts the state
317
- file it was writing at the time.
359
+ Free space on the volume holding `$HOME`, from one statfs call in
360
+ `lib/low-disk.mjs`. WARN under `diskCleaner.lowDiskGb` (default 10 GB) or
361
+ `diskCleaner.lowDiskPercent` (default 5%) free: a worktree plus a build is the
362
+ largest thing a run writes, and ENOSPC mid-run corrupts the state file it was
363
+ writing at the time. The step names `/multi-agent:clean-disk`, which measures
364
+ before it deletes anything; doctor itself deletes nothing.
365
+
366
+ What could be freed comes from the newest disk-cleaner dry run under
367
+ `~/.claude/logs/disk-cleaner/`: its reclaimable total, its three largest
368
+ categories and how long ago it ran. Doctor never measures on its own, since a
369
+ full measurement walks every cache. A run older than 24 hours, or none, is
370
+ named as such, with `/multi-agent:clean-disk` to measure. With `--probe` it
371
+ runs `disk-cleaner.mjs --dry-run --json` under a 60-second cap; a timeout is
372
+ reported in the detail and never changes the severity. Enough free space but
373
+ at least `diskCleaner.reclaimableGb` (default 10) to reclaim, from a fresh
374
+ run, is INFO with the same step: "run /multi-agent:clean-disk: N GB can be
375
+ freed". An OK result still carries the free space and the reclaimable line in
376
+ `detail.summary`, which the text output prints after the id. The JSON detail
377
+ holds `freeBytes`, `totalBytes`, `freePercent`, the thresholds,
378
+ `reclaimable` (`source`, `file`, `measuredAt`, `ageHours`, `stale`,
379
+ `totalBytes`, `top`) and `probe`.
318
380
 
319
381
  ### worktree-residue
320
382
 
@@ -236,6 +236,31 @@ same once `cost-budget-check.mjs` reports the run at the warn threshold of
236
236
  `budgetCeilingUsd`. `recordDecisions: false` is honoured; `true` (the default)
237
237
  logs each decision as `model_routing.decision`.
238
238
 
239
+ **Learned order (`modelRouting.learned.enabled`, ships false).** After the
240
+ strategy, `route-learn.mjs choose` may reorder the same candidates from a
241
+ promoted policy; the decision's reason then ends in `learned`. The loop:
242
+
243
+ 1. `route-learn.mjs ingest --state <agent-state.json>` at the end of a run
244
+ turns each `model_routing.decision` it logged into an outcome row for its
245
+ bucket (call site, task kind, complexity band from `--complexity`) and rung.
246
+ The reward is 0 when any gate's latest verdict failed, else
247
+ `1 / (1 + first-round blockers + still-present findings + rework rounds)`.
248
+ A model's own report never enters it, and a row with no gate or review
249
+ signal is refused.
250
+ 2. `route-learn.mjs promote` fits per-bucket Beta posteriors (older outcomes
251
+ weighted down by `halfLifeDays`), calibrates them with isotonic regression,
252
+ and replaces the policy only when it beats the current one by `margin` in
253
+ Brier score on the newest `holdout` fraction (at least `minRows` rows).
254
+ The old policy is kept as `policy.json.bak`.
255
+ 3. `choose` draws one Thompson sample per rung, seeded by task id so the same
256
+ task gets the same order, and tries the cheapest rung whose draw clears
257
+ `target` first. Until two candidates have `minSamples` outcomes the rule's
258
+ order stands; a rung whose last three outcomes scored 0 goes last on nine
259
+ draws in ten.
260
+
261
+ The two limits above still hold on a learned order: the fable switch is
262
+ checked after it, and a subagent stays on the Anthropic ladder.
263
+
239
264
  The script never fails and never returns an empty rung: a missing preferences
240
265
  file, a missing `jq`, unparseable JSON, an out-of-scope call site and a rung
241
266
  absent from `cost-table.json` all return the caller's default and exit 0. A
@@ -47,9 +47,13 @@ A later drift replaces the flag and its confirmation. `files[]` and `creates[]`
47
47
  | `tdd-red <task> <todo> <results> [--tests a,b]` | at least one test fails; with `--tests`, one of the failing tests is a named one | nothing failed, nothing ran, or every failure is in another test; under `enforce`, `--tests` on results that name no failing test (use JUnit XML); `warn` records that run with `red.testsUnverifiable` and a warning |
48
48
  | `tdd-red ... --already-passing <reason>` | the run has no failure: the behaviour already exists; the run stands for RED and GREEN, the reason is kept | any test fails |
49
49
  | `tdd-green <task> <todo> <results>` | RED is recorded (not needed under test policy `tests-after`), the run has no failure, and it is the RED suite: RED's named tests pass in it, or, without names on either side, it ran at least as many tests | a test still fails, nothing ran, no RED, a RED test is missing, fewer tests than RED |
50
+ | `tdd-green ... --test-edit-reason <why>` | as above, when a test file RED kept was changed because the test itself was wrong; the edit and the reason go to `green.testEdits[]` and Phase 3 reviews them | the reason is missing |
51
+ | `tdd-restore <task> <todo>` | writes the RED bytes of every kept test file that changed back into the worktree | a kept path leaves the worktree |
50
52
 
51
53
  Both refuse results written before the todo's `startedAt`.
52
54
 
55
+ `tdd-red` keeps the test files the run wrote (committed since the run base, `state.baseSha` or `MA_RUN_BASE_SHA`, plus new and changed ones in the worktree) as `red.testFiles[]` ({path, blob}; the bytes go into the repository's object store). `tdd-green` refuses (exit 2) when one of them was modified or deleted since: a suite made green by weakening its own new test proves nothing. Restore it with `tdd-restore`, or give `--test-edit-reason`. `test-integrity-gate.mjs --state` reports a recorded edit as important (blocking in an unattended run, where nobody read the reason) and an unrecorded one as blocking.
56
+
53
57
  `complete` then reads `prefs.global.tddEvidence.mode`:
54
58
 
55
59
  - `off`: no check.
@@ -0,0 +1,123 @@
1
+ # review-priority - the rule-file format
2
+
3
+ <!-- toc -->
4
+ - [Where rule files live](#where-rule-files-live)
5
+ - [The corporate baseline](#the-corporate-baseline)
6
+ - [The parts of a file](#the-parts-of-a-file)
7
+ - [Rule ids](#rule-ids)
8
+ - [Decision order](#decision-order)
9
+ - [Evaluations](#evaluations)
10
+ - [Writes](#writes)
11
+ <!-- /toc -->
12
+
13
+ `/multi-agent:review-priority` grades a team's open bugs against that team's
14
+ rule file. The engine, `scripts/priority-review.mjs`, holds nothing
15
+ team-specific: which bugs are fetched, which fields are shown as evidence and
16
+ which rule ids an evaluation may cite all come from the file. A team that
17
+ writes one file gets the command.
18
+
19
+ ## Where rule files live
20
+
21
+ One file per team in the rules directory: `prefs.global.reviewPriority.rulesDir`,
22
+ default `~/.claude/routine-assets/review-priority/rules/`. Run data (the Jira
23
+ snapshot and the evaluations) goes to `runs/` beside it.
24
+ `priority-review.mjs paths` prints both. A file that does not parse is listed
25
+ by `teams` as skipped, with its reason, and is never offered.
26
+
27
+ Start from `multi-agent-refs/review-priority/rules/example.md`: copy it to
28
+ `<rulesDir>/<slug>.md` and edit it.
29
+
30
+ ## The corporate baseline
31
+
32
+ `corporate.md` in the same directory is optional. When it exists, its rule
33
+ rows apply to every team, and it is never offered as a team itself. A team's
34
+ own row with the same id replaces the baseline row for that team; every other
35
+ team keeps the baseline. A team file may then carry only its frontmatter, its
36
+ `jira-selection` block and the rules that are its own (PRI-100 and up, or the
37
+ ids it overrides).
38
+
39
+ `priority-review.mjs rules --team <slug>` prints the merged set, each row with
40
+ the file it came from, and `teams --json` lists each team's overrides. The
41
+ report names the baseline in its header and ends with a table of every cited
42
+ rule id and its file. A `corporate.md` that does not parse makes every team
43
+ unusable rather than silently dropping the baseline; `teams` says why.
44
+
45
+ ## The parts of a file
46
+
47
+ 1. **Frontmatter.** `team` is the display name used in the picker and the
48
+ report title; `slug` must equal the file name without `.md`. `directorate`
49
+ is read as a synonym of `team`.
50
+ 2. **The `jira-selection` block.** A fenced code block whose info string is
51
+ exactly `json jira-selection`, holding one JSON object:
52
+
53
+ | Key | Required | Meaning |
54
+ |---|---|---|
55
+ | `base` | yes | JQL every preset is ANDed with, normally `issuetype = Bug` |
56
+ | `default` | yes | id of the preset used when none is chosen |
57
+ | `presets` | yes | list of `{id, label, jql}`; the label is shown in the picker |
58
+ | `order` | no | the `ORDER BY` clause, default `created DESC` |
59
+ | `evidenceFields` | no | `{fieldId: label}`; each field is fetched and shown under its label. Instance-specific custom field ids belong here, never in the engine |
60
+
61
+ `fetch` builds `base AND (preset) [AND created >= -Nd] [AND (extra)]`, so a
62
+ free-text filter can narrow a preset but never drop `base`.
63
+ 3. **Rules.** Markdown table rows that start with `| PRI-nnn |`. Every such
64
+ row is a rule id; an evaluation citing an id neither this file nor the baseline has is
65
+ refused. Ids are stable: change a rule's wording, keep its id, so past
66
+ reports still read.
67
+
68
+ ## Rule ids
69
+
70
+ The example file uses one scheme; keep it when you write your own, so
71
+ evaluations and reports compare across teams:
72
+
73
+ | Range | Content |
74
+ |---|---|
75
+ | PRI-001..009 | principles: impact, not urgency; what never raises a level |
76
+ | PRI-010..015 | Critical, and what is not Critical on its own |
77
+ | PRI-020..024 | High |
78
+ | PRI-030..034 | Medium |
79
+ | PRI-040..042 | Low, and what is never Low |
80
+ | PRI-050 | the decision order |
81
+ | PRI-060..061 | evidence the record should carry; consistency |
82
+ | PRI-070..073 | the decision matrix |
83
+ | PRI-080 | the triage checklist |
84
+ | PRI-090 | roles: the review proposes, people decide |
85
+ | PRI-100 and up | the team's own mappings of the generic rules onto its flows |
86
+
87
+ A team mapping (PRI-1xx) names the generic rule it derives from, so a reader
88
+ can tell a derivation from a rule.
89
+
90
+ ## Decision order
91
+
92
+ The evaluator applies PRI-050 to every bug: is it a defect; which flow; does
93
+ the flow complete; is there a workable workaround; what is at risk; then the
94
+ level, with urgency and release impact as a separate note. When the record
95
+ does not say enough to run those steps, the verdict is `insufficient` and
96
+ `missing` lists what PRI-060 asks for.
97
+
98
+ ## Evaluations
99
+
100
+ `report` reads one JSON object per fetched bug:
101
+
102
+ ```json
103
+ {"key": "ABC-1", "proposed": "High", "rules": ["PRI-020", "PRI-023"],
104
+ "evidence": ["Environment = Test", "description: \"retry succeeds\""],
105
+ "confidence": "high", "verdict": "too_low",
106
+ "missing": [], "reason": "One sentence in the output language."}
107
+ ```
108
+
109
+ It refuses the file when a bug has no evaluation or two, a verdict is not one
110
+ of `too_high`, `too_low`, `insufficient`, `correct`, a rule id is unknown, the
111
+ confidence is not `high`, `medium` or `low`, an `insufficient` verdict has no
112
+ `missing` items, a verdict disagrees with the current and proposed levels, or
113
+ a non-`insufficient` verdict has no evidence. A current level outside
114
+ Critical, High, Medium, Low can only be `insufficient`.
115
+
116
+ ## Writes
117
+
118
+ The engine writes to Jira in one place. `propose` reads the live issue and
119
+ prints the change and a token derived from the issue key, the current and new
120
+ level and the issue's last update time. `apply` reads the issue again,
121
+ recomputes the token and refuses when it differs, so a level someone else
122
+ changed in between is never overwritten. It sets the priority field and
123
+ nothing else. Both refuse when `MULTI_AGENT_UNATTENDED=1`.
@@ -174,8 +174,10 @@ In addition to the attended exit gate:
174
174
  ```bash
175
175
  S="$HOME/.claude/scripts"
176
176
  STACK=$(node "$S/_stack-adapter.mjs" resolve --dir "$WORKTREE" | cut -d' ' -f1)
177
- node "$S/evidence-gate.mjs" --claim build --status passed --evidence "$WORKTREE/.build.log" --stack "$STACK"
178
- node "$S/evidence-gate.mjs" --claim test --status passed --evidence "$WORKTREE/.test.log" --stack "$STACK"
177
+ # taken right before each command runs: BUILD_RAN_ON / TEST_RAN_ON
178
+ # =$(node "$HOME/.claude/lib/source-digest.mjs" --repo "$WORKTREE")
179
+ node "$S/evidence-gate.mjs" --claim build --status passed --evidence "$WORKTREE/.build.log" --stack "$STACK" --ran-on "$BUILD_RAN_ON"
180
+ node "$S/evidence-gate.mjs" --claim test --status passed --evidence "$WORKTREE/.test.log" --stack "$STACK" --ran-on "$TEST_RAN_ON" --command "<test-command>"
179
181
  node "$S/test-summary.mjs" --log "$WORKTREE/.test.log" --stack "$STACK"
180
182
  node "$S/test-strength.mjs" --repo "$WORKTREE" --base HEAD --head worktree --stack "$STACK"
181
183
  node "$S/symbol-existence-gate.mjs" --repo "$WORKTREE" --base HEAD --stack "$STACK"
@@ -183,7 +185,7 @@ node "$S/symbol-existence-gate.mjs" --repo "$WORKTREE" --base HEAD --stack "$STA
183
185
 
184
186
  | Gate | Verdict in the ledger |
185
187
  |---|---|
186
- | `evidence-gate --stack` | the adapter's markers and test counts; a status that is not `passed` is recorded as a failure. A test claim needs a positive executed-test count, from the log or from `--junit <dir>` / `--xcresult <bundle>`: markers alone fail. Gradle prints no counts on success and `xcodebuild -quiet` only its verdict, so pass the adapter's `resultFiles` directory of this run (`build/test-results`, `target/surefire-reports`) or the `-resultBundlePath` bundle; wipe the directory before the run so an old result cannot be counted. An adapter's `skipped` markers (Maven `Tests are skipped.`, a runner's "no test files") and a Gradle log whose every test task is `SKIPPED` or `NO-SOURCE` count as zero tests |
188
+ | `evidence-gate --stack` | the adapter's markers and test counts; a status that is not `passed` is recorded as a failure. A test claim needs a positive executed-test count, from the log or from `--junit <dir>` / `--xcresult <bundle>`: markers alone fail. Gradle prints no counts on success and `xcodebuild -quiet` only its verdict, so pass the adapter's `resultFiles` directory of this run (`build/test-results`, `target/surefire-reports`) or the `-resultBundlePath` bundle; wipe the directory before the run so an old result cannot be counted. An adapter's `skipped` markers (Maven `Tests are skipped.`, a runner's "no test files") and a Gradle log whose every test task is `SKIPPED` or `NO-SOURCE` count as zero tests. The run has to be on the source as it is now: a `--ran-on` digest (`lib/source-digest.mjs`) that differs from the tree's current one fails the claim, and the ledger entry carries that digest, so an edit after the build makes the entry `stale` at commit even though HEAD did not move. The test run has to be the whole suite: a narrowed `--command` (`-only-testing`, `--filter`, `--tests`, `-t`, `-k`, `--grep`, `-run`, one test file, `--passWithNoTests`) fails with `gaming.kind: narrowed-run`, and so does a log in which the runner names its filter |
187
189
  | `test-summary` | `passed` pass; `failed` and `no-tests` fail; `unparsed` not-applicable (the markers still decide) |
188
190
  | `test-strength --head worktree` | every changed test red: pass. Any still-green, or a test failing on head: fail. No test file or no production change: not-applicable. A test that goes red only by failing to compile or load without the change is `unjudged`, never red: red plus unjudged is a pass, unjudged alone not-applicable. The uncommitted tree is snapshotted through a private index, so the checkout is not touched |
189
191
  | `symbol-existence-gate` | every key, resource and endpoint the added lines reference exists in the adapter's truth sources (section 6); nothing to check against: not-applicable |
@@ -386,7 +386,7 @@ per failed MCP tool call to `~/.claude/logs/multi-agent/mcp-failures.jsonl`.
386
386
  | `server` | the server part of `mcp__<server>__<tool>`, kept only when it matches `[A-Za-z0-9][A-Za-z0-9._-]`, at most 96 characters, with no credential pattern; otherwise the call is dropped |
387
387
  | `tool` | the tool part, under the same rule |
388
388
  | `ts` | when the hook ran |
389
- | `errorClass` | one of `denied`, `timeout`, `rate-limit`, `auth`, `connection`, `invalid-input`, `not-found`, `server-error`, `interrupted`, `other`, chosen from the error text: a JSON-RPC error code first (`-32603` and the implementation range `-32000..-32099` are the server's, with the MCP SDK's `-32000` read as connection and `-32001` as timeout; `-32602`, `-32600` and `-32700` are the caller's input; `-32601` and `-32002` are not found), then a message that opens with `invalid` or `validation` (the caller's input), then an HTTP status written as a status rather than a number in a path, a bare three-digit number counting only after `HTTP`, `status` or a request line, or before a reason phrase (5xx server, 401 and 403 auth, 404 not found, 429 rate limit), then fixed wording patterns that try the server-side classes before `invalid-input`; `denied` is kept for a refusal by the user or the permission layer |
389
+ | `errorClass` | one of `denied`, `disk-full`, `timeout`, `rate-limit`, `auth`, `connection`, `invalid-input`, `not-found`, `server-error`, `interrupted`, `other`, chosen in this order: the host's interrupt flag (`interrupted`), then a refusal by the user or the permission layer (`denied`), then a JSON-RPC error code in the error text (`-32603` and the implementation range `-32000..-32099` are the server's, with the MCP SDK's `-32000` read as connection and `-32001` as timeout; `-32602`, `-32600` and `-32700` are the caller's input; `-32601` and `-32002` are not found), then a message that opens with `invalid` or `validation` (the caller's input), then an HTTP status written as a status rather than a number in a path, a bare three-digit number counting only after `HTTP`, `status` or a request line, or before a reason phrase (5xx server, 401 and 403 auth, 404 not found, 429 rate limit), then fixed wording patterns that try `disk-full` (`ENOSPC`, no space left on device) first and the other server-side classes before `invalid-input` |
390
390
  | `v` | the row format version, a constant (`1.0.0`) |
391
391
 
392
392
  The arguments, the output and the error text are never written; the text is
@@ -403,4 +403,6 @@ opt-out in it cannot be read.
403
403
  counts failed calls per server, per tool and per class in the window (default
404
404
  24 hours). `doctor`'s `mcp-failures` check lights INFO for a server with five or
405
405
  more failures there; `invalid-input`, `denied` and `interrupted` are the
406
- caller's or the user's and never count toward it.
406
+ caller's or the user's and never count toward it. Any `disk-full` row in the
407
+ window also lights INFO with `/multi-agent:clean-disk` as its step, whatever the
408
+ count, because a full disk fails every server at once.
@@ -82,6 +82,7 @@ Status & Resume:
82
82
  /multi-agent:prune-logs Delete per-task project logs (audit + metrics kept; age/project/task filters, dry-run first)
83
83
  /multi-agent:prune-prompts Zero-base prompt review: measure always-on instruction footprint, propose keep/trial/delete per rule (report first, apply on approval)
84
84
  /multi-agent:garbage-collect Sweep run residue; --abandoned reaps stopped runs
85
+ /multi-agent:clean-disk Free disk space: measure every category, choose what to delete, apply, report the space freed
85
86
  /multi-agent:purge Worktree + logs - full reset (double confirm)
86
87
  /multi-agent:autopilot-on Continuous mode on this machine: pick repos, labelled items run to a PR
87
88
  /multi-agent:autopilot-status Running, queued, awaiting an answer, today's PRs
@@ -98,6 +99,7 @@ Post-Hoc & Side-Channel:
98
99
  /multi-agent:feedback "msg" Tell the maintainer something broke; only your text is sent
99
100
  /multi-agent:review Parallel review of a PR or branch diff; no URL -> pick open GitHub/Bitbucket PRs
100
101
  /multi-agent:review-jira Grade a Jira issue's pipeline-readiness -> comment the gaps on it
102
+ /multi-agent:review-priority Grade a team's open bug priorities against its rule file (read-only; one approved change at a time)
101
103
  /multi-agent:review-issue Grade a GitHub issue's pipeline-readiness -> comment the gaps on it
102
104
  /multi-agent:analysis ["name"] Feature-spec analysis (Figma + Swagger + Confluence + repos). Asks the standard first: global (23-section dev handoff) or corporate (IG→UC→FG requirements doc). Stack optional; References built from the evidence record
103
105
  /multi-agent:analysis-resolve [doc] Resolve Section 20 open questions of an analysis doc, one at a time with source-labeled candidates
@@ -144,7 +146,7 @@ Plugins & tools (called directly, no wrappers):
144
146
 
145
147
  Stack plugins ai-<stack>-toolkit:<skill>, e.g. ai-ios-toolkit:create-component
146
148
  Catalog: ai-<stack>-toolkit:help Enable per repo: /multi-agent:stack (common + analyst always on)
147
- Toolkit MCP multi-agent-toolkit - 228 tools, most for a RUNNING app, no pipeline run needed:
149
+ Toolkit MCP multi-agent-toolkit - 230 tools, most for a RUNNING app, no pipeline run needed:
148
150
  ios_* / android_* (launch, tap, screenshot, ui tree, logs, crashes,
149
151
  locale, dark mode), web_*, design_* (Design Check above), and the
150
152
  audits (ios_app_store_audit, ios_testflight_validate, android_apk_audit,
@@ -81,6 +81,7 @@ Status & Resume:
81
81
  /multi-agent:prune-logs Task bazlı proje log'larını sil (audit + metrics korunur; yaş/proje/task filtresi, önce dry-run)
82
82
  /multi-agent:prune-prompts Sıfır-tabanlı prompt incelemesi: sürekli yüklü talimat yükünü ölç, kural başına tut/dene/sil öner (önce rapor, onayla uygula)
83
83
  /multi-agent:garbage-collect Koşu artığını süpür; --abandoned durmuş koşuları toplar
84
+ /multi-agent:clean-disk Disk alanı aç: her kategoriyi ölç, neyin silineceğini seç, uygula, açılan alanı raporla
84
85
  /multi-agent:purge Worktree + log'lar - tam reset (çift onay)
85
86
  /multi-agent:autopilot-on Bu makinede sürekli mod: repo seç, etiketli maddeler PR'a kadar koşar
86
87
  /multi-agent:autopilot-status Koşan, sıradaki, cevap bekleyen, bugünkü PR'lar
@@ -97,6 +98,7 @@ Post-Hoc & Side-Channel:
97
98
  /multi-agent:feedback "mesaj" Bakımcıya bir şeyin bozulduğunu bildir; yalnızca yazdığın metin gider
98
99
  /multi-agent:review PR veya branch diff'ini paralel review et; URL yoksa -> açık GitHub/Bitbucket PR'larını seçtir
99
100
  /multi-agent:review-jira Jira maddesinin pipeline'a hazırlığını değerlendir -> eksikleri yorum olarak ekle
101
+ /multi-agent:review-priority Ekibin açık bug priority'lerini kural dosyasına göre denetle (salt okur; her seferinde tek onaylı değişiklik)
100
102
  /multi-agent:review-issue GitHub issue'nun pipeline'a hazırlığını değerlendir -> eksikleri yorum olarak ekle
101
103
  /multi-agent:analysis ["analysis-name"] Feature-spec analizi (Figma + Swagger + Confluence + repolar). Önce standardı sorar: global (23 bölümlük geliştirme dokümanı) veya kurumsal (IG→UC→FG gereksinim dokümanı). Stack opsiyonel; Referanslar kanıt kaydından üretilir
102
104
  /multi-agent:analysis-resolve [doc] Analiz dokümanının Bölüm 20 açık sorularını kaynak etiketli adaylarla teker teker çözer
@@ -143,7 +145,7 @@ Plugin'ler ve tool'lar (doğrudan çağrılır, sarmalayıcı yok):
143
145
 
144
146
  Stack plugin ai-<stack>-toolkit:<skill>, örn. ai-ios-toolkit:create-component
145
147
  Katalog: ai-<stack>-toolkit:help Repo bazında aç: /multi-agent:stack (common + analyst hep açık)
146
- Toolkit MCP multi-agent-toolkit - 228 araç, çoğu ÇALIŞAN uygulama için, pipeline koşusu
148
+ Toolkit MCP multi-agent-toolkit - 230 araç, çoğu ÇALIŞAN uygulama için, pipeline koşusu
147
149
  gerektirmez: ios_* / android_* (başlat, tap, screenshot, ui ağacı, log,
148
150
  crash, locale, koyu mod), web_*, design_* (yukarıdaki Design Check), ve
149
151
  denetimler (ios_app_store_audit, ios_testflight_validate,
@@ -6,6 +6,7 @@
6
6
  - [Read here, write through a command](#read-here-write-through-a-command)
7
7
  - [Which stack skills apply](#which-stack-skills-apply)
8
8
  - [multi-agent-toolkit MCP](#multi-agent-toolkit-mcp)
9
+ - [Status line](#status-line)
9
10
  <!-- /toc -->
10
11
 
11
12
  > Loaded on demand by `rules/outside-the-pipeline.md`, which carries only the
@@ -112,6 +113,7 @@ another stack's toolkit in its place.
112
113
  | `learnings_search` / `learnings_timeline` / `learnings_get` | what past runs learned about a repo, across every repo not excluded from memory |
113
114
  | `graph_*` (`graph_stats`, `graph_hubs`, `graph_cluster`, `graph_query`, ...) | reading a built code graph without a shell |
114
115
  | `research_community` / `media_transcript` | what developers already reported about a problem, or the subtitles of a linked YouTube talk (`media-remote` cap, `yt-dlp`) |
116
+ | `media_video_plan` / `media_video_render` | a short video is wanted from screenshots, clips or a script: plan the scenes and timing first, then render the planned video |
115
117
  | `social_read` | the user asked for posts from X, Reddit, LinkedIn, Instagram or Facebook; reads through their own signed-in Chrome, off unless the `social` cap is set, confirmed per channel, never unattended |
116
118
  | `pass_*` (`pass_inspect`, `pass_validate`, `pass_certificates`, `pass_build`) | an Apple Wallet pass will not open, or a test pass is needed |
117
119
  | `store_*` (`store_status`, `store_asc_*`, `store_play_*`, `store_search` / `store_call`) | a question about App Store Connect or Google Play data: builds and build numbers, reviews, subscriptions, tracks, vitals. Keys come from the Keychain via the store reference file `/multi-agent:setup` writes; `store_status` says which store resolves. Writes return a preview until `confirm: true` and are refused unattended |
@@ -125,3 +127,7 @@ config, and a `@scope:registry=` line there outranks `--registry`. That is how t
125
127
  server came to report `CONNECTION_CLOSED` while working perfectly when run directly:
126
128
  npm fetched from the wrong registry and the process never started. The registration
127
129
  carries `--@<scope>:registry=<url>`; `smoke-npm-scope-pinning.sh` keeps it that way.
130
+
131
+ ## Status line
132
+
133
+ Asked for a status bar that shows the run, offer `node "$HOME/.claude/scripts/statusline.mjs" install`. It adds a Claude Code `statusLine` with the phase, the cost against an enabled `costBudget`, the gates and whether the run waits for an answer, from local files only. It never replaces a `statusLine` already set; `statusline.mjs uninstall` removes only its own.
@@ -213,7 +213,7 @@ Phase 1 and Phase 2 pre-flights BLOCK on `analysis/<feature-slug>-<platform>.md`
213
213
 
214
214
  A fresh document is also skipped when one already exists for this feature and platform AND its front-matter `evidence_digest` still matches (Locked 26 cache); record `docStatus = "reused"`.
215
215
 
216
- **How it runs.** Load `$HOME/.claude/multi-agent-refs/analysis/` on demand, in order: `locked.md` (the 31 binding decisions) then `evidence.md`, `synthesis.md`, `render.md`. Intake is NOT re-asked; platform, repos and account come from Phase 0 state. Autopilot auto-approves the Phase 2a convention preview and writes the local file, because it may not ask.
216
+ **How it runs.** Load `$HOME/.claude/multi-agent-refs/analysis/` on demand, in order: `locked.md` (the 37 binding decisions) then `evidence.md`, `synthesis.md`, `render.md`. Intake is NOT re-asked; platform, repos and account come from Phase 0 state. Autopilot auto-approves the Phase 2a convention preview and writes the local file, because it may not ask.
217
217
 
218
218
  **Where it lands.** `<worktree>/analysis/<feature-slug>-<platform>.md`, one file per platform in `state.analysisSpec.platforms[]`. Persist the paths to `state.analysis.docPath[]` and set `docStatus` to `produced` | `reused` | `not-applicable`. Also persist `state.run.lastAnalysisDigest` (this document's `evidence_digest`) and `state.run.analysisBaseCommit` (`git rev-parse HEAD`). Phase 2's freshness check reads both; unwritten, it has nothing to compare and passes silently. Whether the file is committed with the work is `prefs.global.analysisPhase.commitDoc` (default `true`), read at Phase 4.
219
219
 
@@ -166,7 +166,7 @@ For each task (respecting dependency order), on start and on end: `bash $HOME/.c
166
166
  - **ios, fallback (raw)**: same lock pair around `xcodebuild build -scheme "{scheme}" -destination "generic/platform=iOS" -derivedDataPath "{worktreePath}/.DerivedData" 2>&1 | tail -5`.
167
167
  - **android**: lock pair around `./gradlew assembleDebug 2>&1 | tail -5` (the Gradle daemon and `build/` outputs contend across parallel worktrees exactly as DerivedData does - the lock applies).
168
168
  - **backend / web**: `python -m compileall .` / run the command `node $HOME/.claude/scripts/package-manager.mjs run --dir "{worktreePath}" --script build` prints, `2>&1 | tail -5` (exit 3: no build script); no lock.
169
- 5. If build fails → fix → rebuild (max 3 attempts, track `retryCount` in state).
169
+ 5. If build fails → fix → rebuild (max 3 attempts, track `retryCount` in state). A failure that says `ENOSPC` or no space left is not a code defect, and retrying will not fix it: save the output and run `node $HOME/.claude/lib/low-disk.mjs --scan <log>`, print its line, and stop retrying. Attended, ask once whether to run `/multi-agent:clean-disk`; unattended, record the line and halt. Never delete anything from here.
170
170
  6. **Intermediate commit** (after each completed task in the plan):
171
171
  ```bash
172
172
  git -C "{worktreePath}" add -A
@@ -372,11 +372,11 @@ bash $HOME/.claude/scripts/pre-commit-check.sh
372
372
  **Default-FAIL evidence gate (required before recording any pass):** a green exit code is not enough - the captured log must actually show success. Before marking build/test passed, run the evidence gate against the tee'd log; it fails CLOSED when the log is missing, empty, or shows failure markers:
373
373
 
374
374
  ```bash
375
- node $HOME/.claude/scripts/evidence-gate.mjs --claim build --status passed --evidence "$WORKTREE/.build.log" || BUILD_PASS=false
376
- node $HOME/.claude/scripts/evidence-gate.mjs --claim test --status passed --evidence "$WORKTREE/.test.log" || TEST_PASS=false
375
+ node $HOME/.claude/scripts/evidence-gate.mjs --claim build --status passed --evidence "$WORKTREE/.build.log" --repo "$WORKTREE" || BUILD_PASS=false
376
+ node $HOME/.claude/scripts/evidence-gate.mjs --claim test --status passed --evidence "$WORKTREE/.test.log" --repo "$WORKTREE" --command "<test-command>" || TEST_PASS=false
377
377
  ```
378
378
 
379
- This prevents a false "it built" claim with no log behind it. On exit 1, treat the gate as failed (do NOT proceed to AI review) and surface the gate's `reason`.
379
+ This prevents a false "it built" claim with no log behind it. `--repo` fails a log older than the last edit, `--command` a narrowed run (`-only-testing`, `-k`, `-t`, one file). On exit 1, treat the gate as failed (do NOT proceed to AI review) and surface the gate's `reason`.
380
380
 
381
381
  **Why the pipe (opt-in via `prefs.global.contextOffload.enabled`).** `tee` decides where the log is written, not how much of it the model reads. The filter parks the full text at `.multi-agent/refs/<node_id>.md` and prints a stub plus the tail, where a failing build's error already is; read that file before re-running a failed build. The evidence gate still reads the whole `.build.log`, so what counts as a verified pass is unchanged. Pref off = pass-through.
382
382
 
@@ -123,11 +123,11 @@ $HOME/.claude/scripts/log-metric.sh "$TASK_ID" 3 review.diff_risk \
123
123
 
124
124
  #### Step 1.76 - Test-integrity gate (produces BLOCKING findings)
125
125
 
126
- Turns Step 1.75's `test_lines_removed` hint into blocking findings triage must adjudicate, and greps the diff for test gaming: an environment branch, a swallowed error, an inflated timeout, a disabled test, a lint suppression or a loosened lint config. A lint suppression that states its reason on the line is important, not blocking. `TI_COUNT=-1` (non-zero exit, missing file, or `gaming.scanned: false`) means the change was not checked for test gaming, never "no findings": `review-decision-gate.mjs` reads that file as unreadable (exit 3), which parks the run; where that gate does not run, add one blocking `test_integrity` finding with `signal: "gate_error"`. `--out` drops the previous iteration's file first, so a failed run leaves none.
126
+ Turns Step 1.75's `test_lines_removed` hint into blocking findings triage must adjudicate, and greps the diff for test gaming: an environment branch, a swallowed error, an inflated timeout, a disabled test, a lint suppression or a loosened lint config; `--state` adds RED tests changed later. A lint suppression that states its reason on the line is important, not blocking. `TI_COUNT=-1` (non-zero exit, missing file, or `gaming.scanned: false`) means the change was not checked for test gaming, never "no findings": `review-decision-gate.mjs` reads that file as unreadable (exit 3), which parks the run; where that gate does not run, add one blocking `test_integrity` finding with `signal: "gate_error"`. `--out` drops the previous iteration's file first, so a failed run leaves none.
127
127
 
128
128
  ```bash
129
129
  TI_FILE="$WORKTREE/.pipeline/test-integrity.json"
130
- printf '%s' "$RISK_FULL" | node $HOME/.claude/scripts/test-integrity-gate.mjs --diff-base "$BASE_BRANCH" --repo "$WORKTREE" --out "$TI_FILE" 2>/dev/null; TI_RC=$?
130
+ printf '%s' "$RISK_FULL" | node $HOME/.claude/scripts/test-integrity-gate.mjs --diff-base "$BASE_BRANCH" --repo "$WORKTREE" --state "$STATE_FILE" --out "$TI_FILE" 2>/dev/null; TI_RC=$?
131
131
  TI_COUNT=$(jq -r 'if .gaming.scanned == false then -1 else (.count // 0) end' "$TI_FILE" 2>/dev/null || echo -1)
132
132
  [ "$TI_RC" -ne 0 ] && TI_COUNT=-1
133
133
  [ "$TI_COUNT" -gt 0 ] && $HOME/.claude/scripts/log-metric.sh "$TASK_ID" 3 review.test_integrity findings="$TI_COUNT"
@@ -233,6 +233,8 @@ WS_ERR=$(printf '{"status":"complete","currentPhase":5,"finishedAt":"%s"}' "$TS"
233
233
 
234
234
  **Per-run outcome metrics (evidence corpus):** also emit `run-metrics.mjs --state <agent-state.json>` and append/persist its JSON. It records review iterations, first-pass-clean, reviewer signal-to-noise, consensus verdict and build outcome.
235
235
 
236
+ **Routing outcomes:** with `modelRouting.learned.enabled`, run `route-learn.mjs ingest --state "$STATE_FILE"` (outcome rows only, `features/model-fallback.md`).
237
+
236
238
  **Cost Breakdown emission (required):** as part of agent-log compose, append the per-task cost block produced by `render-agent-log-cost.sh`:
237
239
 
238
240
  ```bash
@@ -158,7 +158,9 @@ Act on the exit code:
158
158
  - `10` (WARN) - surface the printed `WARN: ...` line to the user (and into `agent-log.md`). Continue.
159
159
  - `11` (EXCEEDED) - surface the `EXCEEDED: ...` line. If `costBudget.onExceed = "halt"`, pause the run and require `multi-agent:resume` (autopilot included) so the user explicitly accepts the overage; if `"warn"`, continue.
160
160
 
161
- The check is a silent no-op (exit 0) when the budget is disabled or no tracker data exists yet, so unconditional invocation is safe. It prices accumulated tokens conservatively (default `opus` rate) so the ceiling trips early. Enforced by `smoke-cost-budget.sh`.
161
+ The check is a silent no-op (exit 0) when the budget is disabled or no tracker data exists yet, so unconditional invocation is safe. It prices accumulated tokens conservatively (default `fable` rate, the most expensive tier) so the ceiling trips early. Enforced by `smoke-cost-budget.sh`.
162
+
163
+ Between phases the same ladder is read at every subagent spawn: `run-scope-guard.sh` on `Agent|Task` prices the bound run's tracker with `_cost-budget.mjs` and, while the run is over `maxUsd`, asks the user before the subagent starts (`onExceed: "halt"` refuses it). From `warnPct` up to the ceiling the model gets a note and the spawn goes ahead. Off with the budget, outside a run, and for a finished run.
162
164
 
163
165
  ---
164
166