@mmerterden/multi-agent-pipeline 17.5.1 → 18.0.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.
- package/CHANGELOG.md +276 -0
- package/README.md +59 -1
- package/README.tr.md +57 -0
- package/docs/adr/0011-dormant-ci.md +25 -1
- package/docs/features.md +24 -0
- package/docs/server-readiness.md +188 -0
- package/docs/token-budget-history.md +1 -1
- package/index.js +16 -1
- package/install/_common.mjs +42 -17
- package/install/_dev-only-files.mjs +8 -0
- package/install/_unattended-profile.mjs +113 -0
- package/install/index.mjs +48 -0
- package/install/templates/claude-hooks.json +13 -1
- package/manifest.json +1049 -0
- package/package.json +5 -2
- package/pipeline/commands/multi-agent/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/feedback/SKILL.md +7 -1
- package/pipeline/commands/multi-agent/graph/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/issue/SKILL.md +13 -1
- package/pipeline/commands/multi-agent/jira/SKILL.md +13 -1
- package/pipeline/commands/multi-agent/resume/SKILL.md +16 -1
- package/pipeline/commands/multi-agent/setup/SKILL.md +14 -16
- package/pipeline/commands/multi-agent/status/SKILL.md +52 -21
- package/pipeline/commands/multi-agent/update/SKILL.md +13 -56
- package/pipeline/lib/_jira-auth.sh +8 -0
- package/pipeline/lib/analysis-jira-write.sh +32 -0
- package/pipeline/lib/ask-choice.sh +13 -2
- package/pipeline/lib/autopilot-state.sh +8 -0
- package/pipeline/lib/fatal.mjs +129 -0
- package/pipeline/lib/figma-mcp-refresh.sh +18 -0
- package/pipeline/lib/figma-screenshot.sh +18 -0
- package/pipeline/lib/invoked-directly.mjs +43 -0
- package/pipeline/lib/jira-publish.sh +42 -0
- package/pipeline/lib/md2confluence-v3.py +47 -0
- package/pipeline/lib/outbound-gate.mjs +175 -0
- package/pipeline/lib/plan-todos.sh +27 -6
- package/pipeline/lib/post-pr-review.sh +77 -8
- package/pipeline/lib/repo-hygiene.sh +8 -3
- package/pipeline/lib/require-jq.sh +40 -0
- package/pipeline/lib/run-paths.sh +335 -0
- package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +70 -0
- package/pipeline/multi-agent-refs/features/code-graph.md +20 -0
- package/pipeline/multi-agent-refs/features/cost-analysis.md +93 -0
- package/pipeline/multi-agent-refs/features/doctor.md +68 -0
- package/pipeline/multi-agent-refs/features/maturity-followup.md +166 -0
- package/pipeline/multi-agent-refs/features/package-manager.md +80 -0
- package/pipeline/multi-agent-refs/features/usage-reporting.md +79 -0
- package/pipeline/multi-agent-refs/features/verify-by-test.md +1 -1
- package/pipeline/multi-agent-refs/features/verify.md +83 -0
- package/pipeline/multi-agent-refs/phases/operations.md +13 -2
- package/pipeline/multi-agent-refs/phases/phase-0-init.md +6 -3
- package/pipeline/multi-agent-refs/phases/phase-3-dev.md +8 -2
- package/pipeline/multi-agent-refs/phases/phase-4-review.md +1 -1
- package/pipeline/multi-agent-refs/picker-contract.md +1 -1
- package/pipeline/multi-agent-refs/unattended-contract.md +129 -0
- package/pipeline/preferences-template.json +1 -1
- package/pipeline/schemas/agent-state.schema.json +122 -11
- package/pipeline/schemas/prefs.schema.json +35 -0
- package/pipeline/schemas/token-budget.json +2 -2
- package/pipeline/scripts/_run-paths.mjs +372 -0
- package/pipeline/scripts/aggregate-metrics.mjs +64 -64
- package/pipeline/scripts/autopilot-arming.mjs +2 -1
- package/pipeline/scripts/autopilot-intake.mjs +2 -1
- package/pipeline/scripts/autopilot-runner.mjs +206 -2
- package/pipeline/scripts/build-references.mjs +2 -1
- package/pipeline/scripts/build-stack-plugins.mjs +10 -2
- package/pipeline/scripts/capture-evidence.sh +7 -2
- package/pipeline/scripts/classify-plan-safety.mjs +2 -1
- package/pipeline/scripts/cost-analyze.mjs +600 -0
- package/pipeline/scripts/cost-budget-check.mjs +4 -12
- package/pipeline/scripts/council-view.mjs +2 -1
- package/pipeline/scripts/crush-json.mjs +2 -1
- package/pipeline/scripts/diff-explain.mjs +6 -9
- package/pipeline/scripts/diff-risk-score.mjs +2 -1
- package/pipeline/scripts/doctor.mjs +203 -4
- package/pipeline/scripts/evidence-gate.mjs +9 -3
- package/pipeline/scripts/feedback-send.mjs +13 -3
- package/pipeline/scripts/gc-abandoned.sh +29 -13
- package/pipeline/scripts/gc-worktrees.sh +11 -4
- package/pipeline/scripts/github-ssh-setup.sh +64 -7
- package/pipeline/scripts/graph-mermaid.mjs +4 -2
- package/pipeline/scripts/graph-report.mjs +155 -1
- package/pipeline/scripts/keychain-save.sh +101 -30
- package/pipeline/scripts/learn-from-transcripts.mjs +2 -1
- package/pipeline/scripts/learning-curve.mjs +34 -29
- package/pipeline/scripts/make-manifest.mjs +199 -0
- package/pipeline/scripts/maturity-followup.mjs +294 -0
- package/pipeline/scripts/migrate-prefs.mjs +2 -1
- package/pipeline/scripts/migrate-state.mjs +94 -4
- package/pipeline/scripts/package-manager.mjs +310 -0
- package/pipeline/scripts/phase-banner.sh +6 -2
- package/pipeline/scripts/phase-tracker.sh +41 -3
- package/pipeline/scripts/plan-coverage-gate.mjs +6 -2
- package/pipeline/scripts/pre-commit-check.sh +7 -0
- package/pipeline/scripts/pre-push-check.sh +7 -0
- package/pipeline/scripts/purge.sh +23 -6
- package/pipeline/scripts/render-agent-log-cost.sh +9 -2
- package/pipeline/scripts/render-cost-summary.sh +9 -2
- package/pipeline/scripts/render-work-summary.sh +11 -4
- package/pipeline/scripts/review-file-filter.mjs +4 -2
- package/pipeline/scripts/review-scope.mjs +2 -1
- package/pipeline/scripts/routine-registry.mjs +2 -1
- package/pipeline/scripts/run-aggregator.mjs +13 -14
- package/pipeline/scripts/run-metrics.mjs +3 -1
- package/pipeline/scripts/runs-index.mjs +343 -0
- package/pipeline/scripts/scorecard-snapshot.mjs +178 -0
- package/pipeline/scripts/search-logs.sh +18 -0
- package/pipeline/scripts/test-gap-scan.mjs +2 -1
- package/pipeline/scripts/test-integrity-gate.mjs +2 -1
- package/pipeline/scripts/update-issue-progress.sh +56 -7
- package/pipeline/scripts/usage-register.mjs +271 -0
- package/pipeline/scripts/usage-report.mjs +14 -3
- package/pipeline/scripts/validate-analysis-doc.mjs +2 -1
- package/pipeline/scripts/validate-code-graph.mjs +6 -3
- package/pipeline/scripts/validate-complaint-doc.mjs +2 -1
- package/pipeline/scripts/validate-diff-risk.mjs +6 -3
- package/pipeline/scripts/validate-test-gap.mjs +6 -3
- package/pipeline/scripts/validate-triage.mjs +3 -1
- package/pipeline/scripts/verify-citations.mjs +4 -2
- package/pipeline/scripts/verify.mjs +327 -0
- package/pipeline/scripts/worktree-finalize.sh +13 -4
- package/pipeline/scripts/write-state.mjs +154 -15
- package/pipeline/skills/.skill-manifest.json +6 -6
- package/pipeline/skills/.skills-index.json +56 -1
- package/pipeline/skills/shared/README.md +8 -3
- package/pipeline/skills/shared/core/multi-agent-issue/SKILL.md +14 -0
- package/pipeline/skills/shared/core/multi-agent-jira/SKILL.md +14 -0
- package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +13 -0
- package/pipeline/skills/shared/core/multi-agent-status/SKILL.md +33 -9
- package/pipeline/skills/shared/core/multi-agent-update/SKILL.md +6 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +4 -1
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +4 -1
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +2 -1
- package/pipeline/skills/skills-index.md +6 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Running multi-agent on a machine nobody is sitting at
|
|
2
|
+
|
|
3
|
+
This describes what a Mac has to have before an unattended run works, and what
|
|
4
|
+
breaks if it does not. **Nothing here is set up by reading it** - `install`
|
|
5
|
+
still writes nothing about permissions and no scheduler is loaded unless you
|
|
6
|
+
ask for one. That is deliberate: every item below changes what runs on a
|
|
7
|
+
machine without a human, and none of it should happen because someone ran an
|
|
8
|
+
installer.
|
|
9
|
+
|
|
10
|
+
Scope is macOS. Linux and Windows were removed on purpose (ADR-0012) and
|
|
11
|
+
nothing here reintroduces them.
|
|
12
|
+
|
|
13
|
+
The mechanical half of this page is `doctor --profile=server`, which checks
|
|
14
|
+
four of the conditions below and says which are missing. Read that first; this
|
|
15
|
+
page explains why each one matters and what to do about it.
|
|
16
|
+
|
|
17
|
+
## The failure this page exists for
|
|
18
|
+
|
|
19
|
+
An unattended run does not fail loudly. It **stops without saying so**, and
|
|
20
|
+
every way it does that looks identical from outside: a process that is running,
|
|
21
|
+
printing nothing, finishing never.
|
|
22
|
+
|
|
23
|
+
Four causes, in the order they bite.
|
|
24
|
+
|
|
25
|
+
## 1. The permission posture
|
|
26
|
+
|
|
27
|
+
autopilot spawns its child with `--permission-prompts none`. That stops Claude
|
|
28
|
+
Code from ASKING, and it does not grant anything - the tools the child then
|
|
29
|
+
calls still have to be allowed. On the maintainer's machine they are, because
|
|
30
|
+
`Bash`, `Edit`, `Write` and `Agent` sit in the global allow list from years of
|
|
31
|
+
interactive use. On a fresh machine they do not, and the first tool call ends
|
|
32
|
+
the run.
|
|
33
|
+
|
|
34
|
+
There is no DEFAULT that fixes this and should not be: writing a permission
|
|
35
|
+
posture into someone's settings during an install is the one action an
|
|
36
|
+
installer must never take silently. There is now a flag that asks for it:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @mmerterden/multi-agent-pipeline install --unattended --dry-run # see it first
|
|
40
|
+
npx @mmerterden/multi-agent-pipeline install --unattended # write it
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
It prints the whole profile with a reason per line before writing anything, and
|
|
44
|
+
it is additive: an entry you added by hand survives, a narrower `Bash(...)` rule
|
|
45
|
+
is kept alongside, unrelated settings are untouched, and a second run changes
|
|
46
|
+
nothing. A `settings.json` that does not parse is refused rather than
|
|
47
|
+
overwritten.
|
|
48
|
+
|
|
49
|
+
By hand, the same thing is:
|
|
50
|
+
|
|
51
|
+
```jsonc
|
|
52
|
+
// ~/.claude/settings.json
|
|
53
|
+
{
|
|
54
|
+
"permissions": {
|
|
55
|
+
"allow": ["Bash", "Edit", "Write", "Agent"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Grant the narrowest set the work needs. A server that only reviews does not
|
|
61
|
+
need `Write` - though note that the shipped profile is deliberately broad,
|
|
62
|
+
because a run builds and tests whatever the target repo uses and a narrow list
|
|
63
|
+
is the one the first unfamiliar repo stops at.
|
|
64
|
+
|
|
65
|
+
`doctor --profile=server` reports this as `unattended-permissions`, against the
|
|
66
|
+
same rule the writer applies.
|
|
67
|
+
|
|
68
|
+
## 2. The scheduler, and why it is a LaunchAgent
|
|
69
|
+
|
|
70
|
+
Something has to start the work. The template ships as a **LaunchAgent**
|
|
71
|
+
(`install/templates/multi-agent-autopilot.plist.template`), loaded in the
|
|
72
|
+
user's session at login - not a LaunchDaemon at boot.
|
|
73
|
+
|
|
74
|
+
That is a keychain decision, not a preference. Every credential the pipeline
|
|
75
|
+
reads lives in the login keychain, and the login keychain is **locked until the
|
|
76
|
+
user logs in**. A daemon started at boot gets a locked one: each credential
|
|
77
|
+
read fails, and those failures surface much later as 401s that blame the token.
|
|
78
|
+
The lock is the cause and nothing in the error says so.
|
|
79
|
+
|
|
80
|
+
So the machine needs to reach a logged-in session by itself:
|
|
81
|
+
|
|
82
|
+
- **System Settings → Users & Groups → Automatic login**, for the account that
|
|
83
|
+
owns the agent.
|
|
84
|
+
- A **keychain with no lock timeout** for that account, or the agent survives
|
|
85
|
+
a login and dies at the first idle period:
|
|
86
|
+
```
|
|
87
|
+
security set-keychain-settings -l ~/Library/Keychains/login.keychain-db
|
|
88
|
+
```
|
|
89
|
+
(no `-t`, so there is no timeout; `-l` still locks on sleep.)
|
|
90
|
+
|
|
91
|
+
Automatic login means physical access to the machine is access to the
|
|
92
|
+
credentials. On a server in a locked room that is the trade being made; on a
|
|
93
|
+
laptop it is not.
|
|
94
|
+
|
|
95
|
+
`doctor --profile=server` reports these as `scheduler` and `keychain-unlock`.
|
|
96
|
+
|
|
97
|
+
## 3. The unattended contract
|
|
98
|
+
|
|
99
|
+
`MULTI_AGENT_UNATTENDED=1` is how a run states that nobody is watching.
|
|
100
|
+
`multi-agent-refs/unattended-contract.md` lists exactly which entry points read
|
|
101
|
+
it and what each resolves to - four of them, named, because a claim of coverage
|
|
102
|
+
that is not true is worse than a short list.
|
|
103
|
+
|
|
104
|
+
The variable does **not** grant permissions and does not suppress errors. It
|
|
105
|
+
only stops a process from waiting for an answer that is not coming.
|
|
106
|
+
|
|
107
|
+
`doctor --profile=server` reports this as `unattended-contract`.
|
|
108
|
+
|
|
109
|
+
## 4. Which credential each phase needs
|
|
110
|
+
|
|
111
|
+
A server fails differently from a laptop here: an interactive run asks for a
|
|
112
|
+
missing token, an unattended one does not.
|
|
113
|
+
|
|
114
|
+
| Phase | Needs | Absent |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| 0 Init | `github` (issue intake), `jira` (ticket intake) | the run cannot resolve its input and stops at the picker |
|
|
117
|
+
| 1-2 Analysis, Plan | `figma` or `figma_mcp` when the task names a design | halts by contract rather than guessing at layout |
|
|
118
|
+
| 3 Dev | none beyond git access | - |
|
|
119
|
+
| 4 Review | `github` for PR comments | findings are computed and never posted |
|
|
120
|
+
| 5 Test | none | - |
|
|
121
|
+
| 6 Commit | git push credential | the branch stays local, which reads as "no PR yet" |
|
|
122
|
+
| 7 Report | `jira`, `confluence` as configured | the report is composed and dropped |
|
|
123
|
+
|
|
124
|
+
`credential-store.sh doctor` lists what is mapped. `doctor --probe` additionally
|
|
125
|
+
checks each one is alive, which costs network calls and is why it is opt-in.
|
|
126
|
+
|
|
127
|
+
## 4b. What the runner does when nobody is looking
|
|
128
|
+
|
|
129
|
+
Three behaviours that are invisible on a laptop and decide whether a server
|
|
130
|
+
survives a month.
|
|
131
|
+
|
|
132
|
+
**The log.** launchd appends the runner's stdout to `runner.log` forever. Each
|
|
133
|
+
tick truncates it past `MA_AP_LOG_MAX_BYTES` (5MB by default), keeping the last
|
|
134
|
+
256KB in `runner.log.1`. It truncates the SAME file rather than renaming it,
|
|
135
|
+
because launchd holds it open with `O_APPEND` - rename it and that descriptor
|
|
136
|
+
keeps writing into the renamed file while the new one stays empty, which is the
|
|
137
|
+
rotation that looks correct and silently stops logging.
|
|
138
|
+
|
|
139
|
+
**The breaker.** An expired token, a `claude` that no longer launches, a full
|
|
140
|
+
disk: every queued item fails the same way, minutes apart, until the queue is
|
|
141
|
+
empty and the ledger is a list of identical failures with no indication which
|
|
142
|
+
came first. After `MA_AP_BREAKER_LIMIT` consecutive attempts that produced
|
|
143
|
+
nothing (3 by default, 0 disables), the runner stops taking new work, writes the
|
|
144
|
+
reason into `queue.json` so `autopilot-status` shows it, and says what to check.
|
|
145
|
+
One successful attempt clears it. A run waiting for a person (`needs-input`) and
|
|
146
|
+
an item arming refused (`blocked-*`) are deliberately not failures.
|
|
147
|
+
|
|
148
|
+
**Telemetry.** `ticks.jsonl` gets one JSON line per tick. The human log answers
|
|
149
|
+
"what happened just now"; a server is only ever asked "how has this been
|
|
150
|
+
behaving for a week".
|
|
151
|
+
|
|
152
|
+
## 5. Self-hosted CI runner
|
|
153
|
+
|
|
154
|
+
ADR-0011 rejected a self-hosted runner because "a self-hosted runner on a
|
|
155
|
+
public repository executes code from any fork's pull request". Half of that has
|
|
156
|
+
changed and half has not, and the difference matters before wiring a runner to
|
|
157
|
+
a machine that holds credentials.
|
|
158
|
+
|
|
159
|
+
Measured, not assumed: the repo is **private**, and it has **one fork**, owned
|
|
160
|
+
by another account. "Zero forks" is a claim worth not making - GitHub requires
|
|
161
|
+
approval before a fork's pull request runs a workflow, but that protection is a
|
|
162
|
+
SETTING, and a self-hosted runner turns "someone approved a workflow run by
|
|
163
|
+
reflex" into code on this machine with this keychain.
|
|
164
|
+
|
|
165
|
+
So: a runner here is defensible on a private single-owner repo, and it is
|
|
166
|
+
defensible only while fork-PR approval stays on and every approval is treated
|
|
167
|
+
as a decision rather than a formality.
|
|
168
|
+
|
|
169
|
+
The same machine can host the runner:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
mkdir ~/actions-runner && cd ~/actions-runner
|
|
173
|
+
# download and configure per GitHub's instructions for the repo
|
|
174
|
+
./svc.sh install && ./svc.sh start
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Two things to keep in mind. The runner service runs in the same session as the
|
|
178
|
+
autopilot agent, so a long CI job and a pipeline run compete for the same CPU
|
|
179
|
+
and the same `~/.claude` state root. And the runner inherits that session's
|
|
180
|
+
keychain, which means a workflow can read the credentials - acceptable on a
|
|
181
|
+
single-owner machine, not on a shared one.
|
|
182
|
+
|
|
183
|
+
## What this page does NOT cover
|
|
184
|
+
|
|
185
|
+
- Turning any of it on. Every step here is the operator's to take.
|
|
186
|
+
- Linux, Windows, systemd, Docker. Out of scope and staying there.
|
|
187
|
+
- Multi-user servers. Everything above assumes one account owns the install,
|
|
188
|
+
the keychain and the queue.
|
|
@@ -19,4 +19,4 @@ back into. The ceiling can still be raised; it can no longer be raised for free.
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
Token estimate = ceil(chars / 4). Per-phase budget rule: warn = current+10% (rounded to nearest 50), max = current+25%. Gives ~6 edit cycles of headroom before warn trips - intentionally quiet under normal maintenance, loud when a phase grows unusually. Only the active phase is loaded (lazy). Recalibrated at v10.0.0 after the validator/consistency/simplifier/lesson gate contracts landed in phases 1-4. Recalibrated again at v10.9.0 after the verify-by-test (Phase 4 Step 3.7), update-check (Phase 0 Step 0.6), immutable-test (Phase 3 GREEN) and redTests re-entry contracts landed - Step 3.7 prose was compressed to a pointer into refs/features/verify-by-test.md before the recalibration. Total bumped 50000 -> 51000 at v12.5.0 after the worktree residue/traversal-prune contract (Phase 0 + Phase 5 heal) and the Reflexion causal-diagnosis contract (Phase 4 lesson memory) landed; the prose was compressed first (161 tokens reclaimed) and every per-phase max still passes - only the aggregate needed room. Recalibrated again at v13.6.0 after the install-relative path correction: an instruction that names `pipeline/scripts/x` resolves only from a repo checkout, and a run happens in the user's worktree, so 157 references across these docs moved to `$HOME/.claude/...` at +5 bytes each - 196 tokens of pure correctness cost. Same discipline as before: prose was compressed FIRST (149 tokens reclaimed, by pointing Phase 1's Figma tier table at the Phase 0 probe that already resolved it and Phase 4's Codex constraints at the always-loaded AGENTS.md block), and only then were the budgets moved. Five warn lines had been permanently amber, which makes the amber tier useless as a signal, so every warn was reset to the documented current+10% and the four maxes that the new warn would have collided with were reset to current+25%. Aggregate 51000 -> 51500. Total bumped 51500 -> 52200 at v14.0.0 after Phase 4 Review entered the four --dev mode phase sets and the criteria-resolution contract (Step 1.78) landed. Same discipline as every prior bump: prose was compressed FIRST, 820 tokens reclaimed, before the number moved. Two of those compressions are structural rather than cosmetic - the hardcoded SwiftUI interaction list in Step 1.5 and the SwiftUI convention paragraph in Step 2.8 were transcriptions of rules that now live in a scoped registry, so keeping them here would have re-created the drift this release exists to remove, and the third moved the Step 1.78 full contract into refs/features/skill-conformance.md leaving a pointer. What remains is contract text that cannot be inferred: the manifest's four consumer-visible parts, the conformance checklist the reviewers must return, and the fail-closed semantics. Every per-phase max still passes (phase-4 12405/14750); only the aggregate needed room. Total bumped 52200 -> 52700 at v14.1.0 after two more contracts landed: stack skill routing (Phase 3 pre-flight step 9) and worktree finalize (Phase 6 step 9). Compression came first, as always, and twice: 224 tokens out of Phase 3 by pointing its criteria-ledger and routing steps at their feature files instead of restating them, and 190 out of Phase 6 by moving the finalize contract into refs/features/worktree-finalize.md and leaving the invocation plus the exit-3 semantics. Both new contracts follow the pattern the earlier ones set: the phase doc carries the call and the decision, the feature file carries the reasoning, and the feature files are outside this budget because it loops only the eight phase-N-* keys. Every per-phase max still passes (phase-3 7677/8950, phase-6 5223/6150 and both under warn); only the aggregate needed room. Total bumped 52700 -> 52750 for the Phase 0 Step 3 branch-persistence correction: the step wrote the legacy `projects[].branches` while the TTL filter two sections below read `global.recentBranches`, and both spots named a `{name, lastUsed}` shape the schema rejects (`branch` required, `additionalProperties: false`), so the recent-branch picker option could never populate and a literal implementation would have failed prefs validation. Naming the right target, the right key and the legacy field to avoid costs 41 tokens over the one line it replaces. Compression came first and was applied three times to the replacement text itself, from 120 tokens down to 66, by moving the rationale out of the phase doc entirely: the reasoning now lives where it is enforced, in the migrate-prefs carry-forward comment and the smoke-pref-migration f7 block, leaving the phase doc with only the instruction. 50 was the smallest step that clears it; phase-0-init sits at 10893/12400, far under its own max, so this is purely an aggregate ceiling. v15.0.0: total 52750 -> 53100, the stack-skill tables in phase-1/2/4 now carry plugin-namespaced names (ai-<stack>-toolkit:<skill>) - functional prefixes, ~170 tokens. v15.10.0: total 53350 -> 53950 for the memory-recall + context-offload contracts (Phase 1 two-block durable-knowledge injection and its telemetry, Phase 3 build-log offload pipe, Phase 4 ranked prior art, offload pipe and recall telemetry). Compression came first and twice, taking the new prose from 1168 tokens to 580: the reasoning behind the two blocks lives in multi-agent-refs/prompt-assembly.md and the reasoning behind the offload filter lives in the offload-ref.sh header, both outside this budget, so the phase docs carry only the call, the pref that gates it and the one fact an agent cannot infer - that the evidence gate still reads the whole build log, so offloading changes what is read, never what counts as a verified pass. Every per-phase max still passes (phase-3 7985/8950, phase-4 12997/14750); phase-3 and phase-4 crossed their warn lines and are left amber on purpose, because that is the signal that those two docs are the next ones needing structural compression rather than another bump. v15.13.0: total 53950 -> 54050 for the prefs-to-flag bridges. Five settings had shipped declared-but-inert: contextOffload.minLines and .tailLines (fixed in 15.11.0), learningsLedger.maxBriefEntries, and testGap.scanTree and .promoteSeverity - the last two declared in the schema AND implemented as flags in the scanner, with nothing in between reading the pref and passing the flag. Wiring three of them costs the phase docs 94 tokens, which is the wiring itself and not prose: two `--max` substitutions and a three-line GAP_FLAGS block. Compression came first and twice, as always: the rationale that would have sat in phase-5 now lives in the header of smoke-prefs-consumed.sh, the gate that makes this class fail a build instead of shipping, and a `--severity-promote` table row was dropped because the invocation above it now shows the flag and names the pref that triggers it, which the row did not. 100 was the smallest step that clears it. Every per-phase max still passes; phase-3 and phase-4 remain amber on purpose. v15.14.0: total 54050 -> 54400 for the supported-version gate. Phase 0 Step 0.6 stopped being purely advisory: a release can now publish an npm dist-tag `required` that names the oldest runnable version, and below it the run halts instead of nagging. What the phase doc has to carry is the part an agent cannot infer - the third stdout field, that the halt is identical in autopilot, and that the run must NOT continue on the freshly updated install because its docs were already loaded from the old version. Compression came first, as always, and took the new prose from 469 tokens to 337: the rationale for the floor, the exemption list, the fail-open rules and the `npm dist-tag add` recipe all moved to multi-agent-refs/rules.md "Supported Version Gate" (loaded by 25 commands, outside this budget) and to the header of require-supported-version.sh, leaving the phase doc with the call, the decision table and the halt. 350 was the smallest step that clears it. Every per-phase max still passes (phase-0-init 11230/12400); phase-3 and phase-4 remain amber on purpose. v15.17.0: total 54400 -> 54900 for the Phase 1 analysis-document step. Phase 2 and Phase 3 pre-flights had BLOCKED on `analysis/<feature>-<platform>.md` since v9.0.0 while nothing produced it, so a full run either aborted at Phase 2 or the model ignored its own BLOCKING contract; Step 4 is the producer. What the phase doc carries is only what cannot be inferred: the when-table (taskType x Figma reference), the four refs in load order, the two artefacts, and that the doc validator fails closed. Compression came first and took the step from 745 tokens to 497: the history of why the gap existed moved to the CHANGELOG, the per-ref one-line descriptions moved into the refs' own headers, and the autopilot carve-out collapsed to one clause. The 17.4k-token analysis engine itself is NOT in this budget - it moved out of commands/ into multi-agent-refs/analysis/{locked,evidence,synthesis,render}.md, loaded on demand, which also took analysis/SKILL.md from 18081 to 5974 tokens and retired its lint grace entry. 500 was the smallest step that clears it; phase-1-analysis sits at 4338/4600 and is amber on purpose, like phase-3 and phase-4. v15.18.0: total 54900 -> 55250 for analysis mode. Three phase docs gained a mode branch that cannot be inferred: Phase 4 reviews a document instead of a diff (validator, the one question reviewers answer, the open-question walk), and Phase 6 publishes instead of committing. Compression came first and was applied twice to the new prose and once to old: the Phase 4 branch went from 320 tokens to 180 and the Phase 6 branch from 190 to 120 by pointing at multi-agent-refs/analysis/{resolve,render}.md, which now hold the walks themselves, and the front-matter parse contract stopped being spelled out in both pre-flights. The analysis engine keeps leaving this budget rather than entering it: intake joined locked/evidence/synthesis/render/resolve in multi-agent-refs/analysis/, which is what let analysis/SKILL.md drop under the 6000 hard cap after its grace entry was retired. 350 was the smallest step that clears it; phase-4 and phase-6 are amber on purpose, as phase-1 and phase-3 already were. v15.20.0: total 55250 -> 55500 for the TDD bridge. Phase 3 pre-flight read the analysis doc's concept table and even said test method names come from it, while nothing read Section 15 - so the RED step invented tests and the analysis test matrix never reached development. Phase 3 step 5b now loads it into state.dev.testPlan[] and Phase 4 step 1.45 cross-checks every planned row against a real test, which is what turns "analysis quality is output quality" from a slogan into a finding. Compression came first on both blocks, 300 tokens down to 175, by dropping the enumerated failure modes to one line each and the rationale to one clause; the reasoning lives in the CHANGELOG. 250 was the smallest step that clears it. v15.21.0: total 55500 -> 55800 for the post-analysis confirmation. Phase 2 gained Step 0.9, the last human checkpoint before Phase 3: derived values are shown for confirmation and only Section 20 rows are asked, through the resolve engine that already exists in refs. It belongs here rather than Phase 4 because Phase 4 runs after development, where an answer arrives too late to change anything. Compression came first and twice, 430 tokens down to 250, by collapsing the derived-vs-asked explanation to one sentence each and moving the walk itself to multi-agent-refs/analysis/resolve.md, which Phase 4 and analysis-resolve already mount. 300 was the smallest step that clears it. v15.22.0: total 55800 -> 55900 for the analyst-toolkit hooks. Phase 1 Step 4 now names the two prefs that decide whether a document is produced at all and how deep it goes (forceFull, mode) - the first of those had shipped declared-but-inert and smoke-prefs-consumed caught it - and Phase 4 triage gained one clause: a finding that blames a third-party library asks evidence-github whether it is already open upstream, which turns it into a deferred item with a citation instead of Phase 3 rework on code that is not ours. Compression came first and three times, taking the new prose from 220 tokens to 110, and the Phase 1d evidence contract itself never entered this budget - it lives in multi-agent-refs/analysis/evidence.md beside the phases it belongs to. 100 was the smallest step that clears it, leaving 34 tokens of headroom. phase-4 stays amber and the debt named at v15.10.0 stands: it is the doc that needs structural compression rather than another bump, and the two candidates are the inline triage JSON shape and the 3.4 telemetry block, both of which restate something already authoritative elsewhere. v16.0.0: total 55900 -> 56350 for the depth picker. `--dev` and the four dev-* commands are gone; depth is Phase 0 Step 7.5, which costs phase-0-init a step it did not have. Compression came first and three times, taking the step from 530 tokens to 300: the question wording, the per-taskType recommendation and the mode tables all live in phases/modes.md (outside this budget), so the phase doc carries only what an agent cannot infer - that the step runs after Step 7 and why, who is exempt, that ASK_CHOICE_DEFAULT must be passed explicitly because ask-choice.sh takes the FIRST option on a non-TTY, and that Short flips the Phase 1/2 tiles late rather than pre-marking them. The phase-4 telemetry block named as compression debt at v15.22.0 was collapsed to an emit() helper (-27) and the four dev-* mode files left the tree entirely, but neither offsets a genuinely new phase step. 450 was the smallest step that clears it, leaving 119 tokens of headroom. phase-4 remains amber and its other named candidate, the inline triage JSON shape, was left alone on purpose: it is the prompt the triage agent is handed, not a restatement for readers. v16.2.0: total 56350 -> 56600 for the spec-freshness and reuse-tag contracts. Phase 3 step 3 had compared `state.run.lastAnalysisDigest` since it was written, against a key nothing ever set and that the state schema did not declare, so the staleness branch was unreachable and every run reported fresh by default. Phase 1 now persists the digest and a `base_commit` anchor, and step 3 gained the repo-drift half the digest cannot see: a reused document keeps a matching digest precisely because its evidence inputs did not change, while the code underneath it moved. The second contract is the Section 14 tag reaching development: Phase 2 carries it onto the todo as `sourceTag` and Phase 3 treats it as an instruction, which is what stops a Reuse row from being re-implemented. Compression came first and took the four additions from 380 tokens to 214, by moving every rationale clause out of the phase docs: why the commit anchor exists rather than a digest recomputation lives in this note and the CHANGELOG, and the schema descriptions carry the field semantics. The baseline had 9 tokens of headroom, so no addition of any size could have fit without a bump. 250 was the smallest step that clears it, leaving 45 tokens. phase-3 and phase-4 remain amber. v16.13.0: total 57600 -> 57700 for the code-graph injection and the fable-rung switch. Phase 1 gained Step 2.6 (query the graph, hand Explore a ranked starting set), Phase 7 gained the post-branch graph refresh, and Phase 0 Step 0 gained one line: a prefs switch that resolves every preferredModel: fable persona to opus for the run, which also collapses the Phase 4 Claude Code panel from three reviewers to two. Compression came first and mostly structurally: of roughly 1,630 tokens of new contract text, 1,310 never entered this budget at all - the whole code-graph contract lives in multi-agent-refs/features/code-graph.md (604) and the fable switch's scope table, per-host effects and cost-accounting consequence live in features/model-fallback.md (+707), leaving the phase docs with the call, the pref that gates it and the one fact an agent cannot infer. Phase 4 was compressed on top of that: its TLDR restated the reviewer matrix 270 lines below it, so 36 tokens came back and the doc nets +6 despite carrying two new clauses. One of those clauses is a correction rather than a feature - the consensus rule still said reviewerCount is 2 on Claude Code, which stopped being true when the third reviewer landed in 16.12.0, and the cross-CLI smoke never caught it because it reads the matrix line instead. 100 was the smallest step that clears it, leaving 54 tokens. phase-3 and phase-4 remain amber. v16.17.0: total 57700 -> 57850 for the platform-parity cross-check. Phase 4 gained Step 1.8: when dev-context carries a counterpart app repo, the review compares the change against the other platform on four axes. Compression came first and structurally, as always - of roughly 1,610 tokens of new contract text, 1,490 never entered this budget at all, because the four axes, the file cap, the graph-query recipe, the read-only prohibitions and the rule that an extractor miss may not be reported as an absence all live in multi-agent-refs/platform-parity.md. The step itself was then cut from ~200 tokens to 120 by deleting everything the ref already owns, leaving the trigger, the pointer and the two facts an agent must not infer: the counterpart repo is read-only, and parity findings are never blocking. The baseline had 13 tokens of headroom, so no addition of any size could have fit without a bump. 150 was the smallest step that clears it, leaving 35 tokens. phase-3 and phase-4 remain amber, and phase-4's structural-compression debt still stands. v16.20.0: phase-4-review max 14750 -> 15150 and total 58250 -> 60250 for the cross-round review delta, the scope self-check handoff and the circuit-breaker wiring. Compression came first and structurally: of roughly 3,900 tokens of new contract text, 2,700 never entered this budget at all - the previous-round-findings block, the scope-self-check block, the Step 3.8 state merge, telemetry and picker wording live in multi-agent-refs/features/review-delta.md, and the scope-check record rules and consumers in features/scope-check.md - so the phase docs carry the call, the pref that gates it and the exit table. The Phase 3 stability rule and the trigger-3 write were cut twice more before the bump; phase-3 stays under its max (8692/8950). Phase 4 is the first per-phase max raised since v10.9.0: the doc gained three steps that cannot be inferred (a per-round triage file, a prefix block that changes what reviewers report, and a halt condition), and its structural-compression debt (the inline triage JSON shape, named at v15.10.0) still stands and is the next candidate. 15150 and 60250 were the smallest steps that clear it, leaving 25 and 45 tokens. v16.23.0: phase-0-init max 12400 -> 12500 and total 60250 -> 60500 for the widget-registration call and the accounting gate. Phase 0 gained the `tiles` call and the exit-3 rule, Phase 7 gained the run report; together they are contract an agent cannot infer - which call registers this host's widget, and that a completion is refused without recorded spend. Compression came first and twice, taking the new prose from 472 tokens to 255: the per-host call list moved into tracker-contract.md "The card is not the widget" and the record-then-rerun recovery into "Accounting is a gate", both outside this budget, leaving the phase docs with the call and the one fact that cannot be looked up. 100 and 250 were the smallest steps that clear it, leaving 74 and 40 tokens. phase-3 and phase-4 remain amber. v16.24.0: total 60500 -> 60750 for visual evidence. Four phase docs gained one instruction each that cannot be inferred: Phase 0 keeps the issue's own images as the pre-fix evidence, Phase 3 captures the fixed state (there and not Phase 5, because every autopilot and --local entry drops Phase 5), Phase 5 hosts the flow recording when it runs, and Phase 6 blocks on a required artefact that is neither attached nor explained. Compression came first and twice, 42 tokens back, and the contract itself never entered this budget: the trigger matrix, the three video tiers, the size-degradation ladder and both render shapes live in multi-agent-refs/features/visual-evidence.md. phase-0-init cleared its own max without a bump. 250 was the smallest step that clears the aggregate. phase-3 and phase-4 remain amber. v17.0.0: phase-0-init max 13000 -> 13100 and total 62400 -> 62500 for the evidence-verdict writer. Phase 0 Step 7.7 probed with `--platform "$PLATFORM"`, a variable no phase document ever assigned, and it was gated on `visualEvidence.required`, which no phase document ever wrote - five readers, zero writers - so the step, Phase 3's capture and Phase 6's blocker were all unreachable and the pipeline reported nothing wrong. The step now writes the verdict and derives the platform from the stack, skipping the probe with a recorded reason when there is no device platform rather than passing the empty string the probe refuses with exit 2. Compression came first and three times, 30 tokens back from the Step 7.7 index rule that restated Step 7.5 verbatim and 55 from the new block itself; the reasoning never entered this budget, because who writes the verdict and how the platform is derived live in features/visual-evidence.md sections 1a and 1b. phase-3-dev max 9250 -> 9300 in the same change: it reads the platform back from state and re-decides the provisional verdict before capturing, which is the half of the fix that makes Phase 3 honest rather than merely reachable. Compressed three times first, 29 tokens back, by pointing its Phase-5 rationale and its tier mapping at visual-evidence.md sections 3 and 4.3 where both already live. 100, 50 and 150 were the smallest steps that clear it, leaving 24, 15 and 26 tokens. phase-3 and phase-4 remain amber. v17.1.0: total 62550 -> 62600 for the Figma/toolkit MCP distinction and web as an evidence platform. Three phase docs said "MCP forbidden" without qualifying it, while the gate that enforces it (smoke-no-mcp-in-dev-phases.sh) has always matched `figma` and nothing else - so the prose banned the screenshot, xcodebuild and UI-test tools that Phase 3 Steps 3.4 and 3.55 actually call, which is one way a run reaches Phase 7 with no evidence. Phase 0 gained one `web` arm in the platform derivation, now that run-ui-tests.sh has a web arm to derive it for. Compression came first and three times, taking the new prose from 175 tokens to 30: the reasoning moved to rules.md, whose own seven-row Figma phase matrix was deleted in the same pass because it duplicated rules/figma-pipeline.md "Phase access matrix" two paragraphs below this file's own instruction not to duplicate that rule file - 74 tokens back there, which is why phase-3-dev cleared its max without a bump (9298/9300). 50 was the smallest step that clears the aggregate, leaving 37 tokens. phase-3 and phase-4 remain amber. v17.1.0 (2): total 62600 -> 62700 for the plan reaching the task widget. Phase 2 computed tasks[], their order and their dependsOn[] edges, stored them, and used them to drive Phase 3's ready-task picker - and none of it was visible on the surface the user actually watches; the card had drawn sub-phases for releases, the widget never had. Phase 2 gains one call. Compression came first and twice: the tasks[]-to-todos[] jq blob left the phase doc for plan-todos.sh `set`, which now accepts a planning-output document directly (-28, and it removes a mapping two files defined, of which this was the untested copy), and the new step's own prose was cut from 116 tokens to 61. The parsing of the plan itself never entered this budget - it lives in phase-tracker.sh `plan`, which owns the sub-phase structure it writes. 100 was the smallest step that clears it, leaving 75 tokens. phase-3 and phase-4 remain amber. v17.5.0: phase-0-init max 13100 -> 13150 for the deferred widget registration, the dev-context step and two more exit-gate assertions. Compression came first and seven times, 492 tokens reclaimed before the number moved: the TLDR restated the step headings under it, the exit-gate list restated the script's own header comment, and the clarifier cost note, the branch-collision probe rationale, the fetch-fail host explanation, the multi-repo write-state race and the baseline unknown-vs-green warning all restate something already authoritative in agents/task-clarifier.md, phases/operations.md or phase0-exit-gate.mjs. The three additions are contract an agent cannot infer: that only Phase 0 is registered at Step -1 and the rest at 7.5 with `tiles --new`, that the dev-context picker runs between project and branch and writes siblings[] even when empty, and that a one-option AskUserQuestion is refused by the host along with every question batched with it. The reasoning for the last one never entered this budget - it lives in picker-contract.md "Two options or it is not a question". 50 was the smallest step that clears it, leaving 28 tokens; the aggregate needed no bump and sits at 62698/62700. phase-3 and phase-4 remain amber. v17.5.0 (2): phase-0-init max 13150 -> 13300 and total 62700 -> 62900 for the workspace question. Phase 0 gained Step 5b: where the branch lives was decided by a flag and by a command name, never by a question, so a user who saw a run improvise "Worktree / Lokal" once took it for a shipped picker and concluded /multi-agent:local was redundant - while it was the only way to reach local mode at all. Compression came first and three times, 156 tokens reclaimed before the number moved and the step itself cut from 426 tokens to 181: the ask-choice index rule in Step 7.5 restated modes.md "Pipeline depth" in full, and the question wording, the two options and what local costs now live in modes.md "Local Mode", outside this budget. What the phase doc carries is what an agent cannot infer - that it runs after Step 4 and before Step 6b and 7.5, who is exempt, and that autopilot resolves it to a worktree rather than skipping it, because an unattended commit in the user's own checkout is what worktrees exist to prevent. The state field is the other half: localMode alone cannot say whether anyone decided, since false is both a chosen worktree and one nothing asked about, and phase0-exit-gate.mjs now refuses to close Phase 0 without workspaceSource. 150 and 200 were the smallest steps that clear it, leaving 32 and 56 tokens. phase-3 and phase-4 remain amber. v17.5.0 (3): phase-0-init max 13300 -> 13400 and total 62900 -> 63000 for base-branch evidence. Step 3 asked one question with a list it could not vouch for: `git fetch origin` ran, its exit code was discarded, and `git branch -r` printed the remote-tracking cache either way, so a restricted network produced a weeks-old local list presented as the remote's answer. And the answer was usually derivable - an issue carrying a target version, or linking a separate issue that represents the release, already names the branch on a repo whose release branches encode the version - and nothing derived it. Rule 5 now captures the exit code and rule 5b hands the list plus the issue's version fields and links to base-branch-candidates.mjs. Compression came first and six times, 1,118 characters reclaimed across this step before the number moved: the one-row picker rule and the not-skippable rule both restated picker-contract.md, the autopilot resolution order and the whole rationale for admitting version-carrying branches moved into features/base-branch-evidence.md, and the fetch-fail persistence block was four sentences for one instruction. The feature's own reasoning never entered this budget at all - the evidence sources, the learned convention, the picker contract, the autopilot fencing and the state shape are ~1,900 tokens living in that ref. What the phase doc carries is the call and the two facts an agent cannot infer: that the fetch exit code decides whether the list may be called remote, and that the branch filter needs a version alternative because a word list that discards is the prefix table this replaces. 100 was the smallest step that clears both, leaving 51 and 61 tokens. phase-3 and phase-4 remain amber.
|
|
22
|
+
Token estimate = ceil(chars / 4). Per-phase budget rule: warn = current+10% (rounded to nearest 50), max = current+25%. Gives ~6 edit cycles of headroom before warn trips - intentionally quiet under normal maintenance, loud when a phase grows unusually. Only the active phase is loaded (lazy). Recalibrated at v10.0.0 after the validator/consistency/simplifier/lesson gate contracts landed in phases 1-4. Recalibrated again at v10.9.0 after the verify-by-test (Phase 4 Step 3.7), update-check (Phase 0 Step 0.6), immutable-test (Phase 3 GREEN) and redTests re-entry contracts landed - Step 3.7 prose was compressed to a pointer into refs/features/verify-by-test.md before the recalibration. Total bumped 50000 -> 51000 at v12.5.0 after the worktree residue/traversal-prune contract (Phase 0 + Phase 5 heal) and the Reflexion causal-diagnosis contract (Phase 4 lesson memory) landed; the prose was compressed first (161 tokens reclaimed) and every per-phase max still passes - only the aggregate needed room. Recalibrated again at v13.6.0 after the install-relative path correction: an instruction that names `pipeline/scripts/x` resolves only from a repo checkout, and a run happens in the user's worktree, so 157 references across these docs moved to `$HOME/.claude/...` at +5 bytes each - 196 tokens of pure correctness cost. Same discipline as before: prose was compressed FIRST (149 tokens reclaimed, by pointing Phase 1's Figma tier table at the Phase 0 probe that already resolved it and Phase 4's Codex constraints at the always-loaded AGENTS.md block), and only then were the budgets moved. Five warn lines had been permanently amber, which makes the amber tier useless as a signal, so every warn was reset to the documented current+10% and the four maxes that the new warn would have collided with were reset to current+25%. Aggregate 51000 -> 51500. Total bumped 51500 -> 52200 at v14.0.0 after Phase 4 Review entered the four --dev mode phase sets and the criteria-resolution contract (Step 1.78) landed. Same discipline as every prior bump: prose was compressed FIRST, 820 tokens reclaimed, before the number moved. Two of those compressions are structural rather than cosmetic - the hardcoded SwiftUI interaction list in Step 1.5 and the SwiftUI convention paragraph in Step 2.8 were transcriptions of rules that now live in a scoped registry, so keeping them here would have re-created the drift this release exists to remove, and the third moved the Step 1.78 full contract into refs/features/skill-conformance.md leaving a pointer. What remains is contract text that cannot be inferred: the manifest's four consumer-visible parts, the conformance checklist the reviewers must return, and the fail-closed semantics. Every per-phase max still passes (phase-4 12405/14750); only the aggregate needed room. Total bumped 52200 -> 52700 at v14.1.0 after two more contracts landed: stack skill routing (Phase 3 pre-flight step 9) and worktree finalize (Phase 6 step 9). Compression came first, as always, and twice: 224 tokens out of Phase 3 by pointing its criteria-ledger and routing steps at their feature files instead of restating them, and 190 out of Phase 6 by moving the finalize contract into refs/features/worktree-finalize.md and leaving the invocation plus the exit-3 semantics. Both new contracts follow the pattern the earlier ones set: the phase doc carries the call and the decision, the feature file carries the reasoning, and the feature files are outside this budget because it loops only the eight phase-N-* keys. Every per-phase max still passes (phase-3 7677/8950, phase-6 5223/6150 and both under warn); only the aggregate needed room. Total bumped 52700 -> 52750 for the Phase 0 Step 3 branch-persistence correction: the step wrote the legacy `projects[].branches` while the TTL filter two sections below read `global.recentBranches`, and both spots named a `{name, lastUsed}` shape the schema rejects (`branch` required, `additionalProperties: false`), so the recent-branch picker option could never populate and a literal implementation would have failed prefs validation. Naming the right target, the right key and the legacy field to avoid costs 41 tokens over the one line it replaces. Compression came first and was applied three times to the replacement text itself, from 120 tokens down to 66, by moving the rationale out of the phase doc entirely: the reasoning now lives where it is enforced, in the migrate-prefs carry-forward comment and the smoke-pref-migration f7 block, leaving the phase doc with only the instruction. 50 was the smallest step that clears it; phase-0-init sits at 10893/12400, far under its own max, so this is purely an aggregate ceiling. v15.0.0: total 52750 -> 53100, the stack-skill tables in phase-1/2/4 now carry plugin-namespaced names (ai-<stack>-toolkit:<skill>) - functional prefixes, ~170 tokens. v15.10.0: total 53350 -> 53950 for the memory-recall + context-offload contracts (Phase 1 two-block durable-knowledge injection and its telemetry, Phase 3 build-log offload pipe, Phase 4 ranked prior art, offload pipe and recall telemetry). Compression came first and twice, taking the new prose from 1168 tokens to 580: the reasoning behind the two blocks lives in multi-agent-refs/prompt-assembly.md and the reasoning behind the offload filter lives in the offload-ref.sh header, both outside this budget, so the phase docs carry only the call, the pref that gates it and the one fact an agent cannot infer - that the evidence gate still reads the whole build log, so offloading changes what is read, never what counts as a verified pass. Every per-phase max still passes (phase-3 7985/8950, phase-4 12997/14750); phase-3 and phase-4 crossed their warn lines and are left amber on purpose, because that is the signal that those two docs are the next ones needing structural compression rather than another bump. v15.13.0: total 53950 -> 54050 for the prefs-to-flag bridges. Five settings had shipped declared-but-inert: contextOffload.minLines and .tailLines (fixed in 15.11.0), learningsLedger.maxBriefEntries, and testGap.scanTree and .promoteSeverity - the last two declared in the schema AND implemented as flags in the scanner, with nothing in between reading the pref and passing the flag. Wiring three of them costs the phase docs 94 tokens, which is the wiring itself and not prose: two `--max` substitutions and a three-line GAP_FLAGS block. Compression came first and twice, as always: the rationale that would have sat in phase-5 now lives in the header of smoke-prefs-consumed.sh, the gate that makes this class fail a build instead of shipping, and a `--severity-promote` table row was dropped because the invocation above it now shows the flag and names the pref that triggers it, which the row did not. 100 was the smallest step that clears it. Every per-phase max still passes; phase-3 and phase-4 remain amber on purpose. v15.14.0: total 54050 -> 54400 for the supported-version gate. Phase 0 Step 0.6 stopped being purely advisory: a release can now publish an npm dist-tag `required` that names the oldest runnable version, and below it the run halts instead of nagging. What the phase doc has to carry is the part an agent cannot infer - the third stdout field, that the halt is identical in autopilot, and that the run must NOT continue on the freshly updated install because its docs were already loaded from the old version. Compression came first, as always, and took the new prose from 469 tokens to 337: the rationale for the floor, the exemption list, the fail-open rules and the `npm dist-tag add` recipe all moved to multi-agent-refs/rules.md "Supported Version Gate" (loaded by 25 commands, outside this budget) and to the header of require-supported-version.sh, leaving the phase doc with the call, the decision table and the halt. 350 was the smallest step that clears it. Every per-phase max still passes (phase-0-init 11230/12400); phase-3 and phase-4 remain amber on purpose. v15.17.0: total 54400 -> 54900 for the Phase 1 analysis-document step. Phase 2 and Phase 3 pre-flights had BLOCKED on `analysis/<feature>-<platform>.md` since v9.0.0 while nothing produced it, so a full run either aborted at Phase 2 or the model ignored its own BLOCKING contract; Step 4 is the producer. What the phase doc carries is only what cannot be inferred: the when-table (taskType x Figma reference), the four refs in load order, the two artefacts, and that the doc validator fails closed. Compression came first and took the step from 745 tokens to 497: the history of why the gap existed moved to the CHANGELOG, the per-ref one-line descriptions moved into the refs' own headers, and the autopilot carve-out collapsed to one clause. The 17.4k-token analysis engine itself is NOT in this budget - it moved out of commands/ into multi-agent-refs/analysis/{locked,evidence,synthesis,render}.md, loaded on demand, which also took analysis/SKILL.md from 18081 to 5974 tokens and retired its lint grace entry. 500 was the smallest step that clears it; phase-1-analysis sits at 4338/4600 and is amber on purpose, like phase-3 and phase-4. v15.18.0: total 54900 -> 55250 for analysis mode. Three phase docs gained a mode branch that cannot be inferred: Phase 4 reviews a document instead of a diff (validator, the one question reviewers answer, the open-question walk), and Phase 6 publishes instead of committing. Compression came first and was applied twice to the new prose and once to old: the Phase 4 branch went from 320 tokens to 180 and the Phase 6 branch from 190 to 120 by pointing at multi-agent-refs/analysis/{resolve,render}.md, which now hold the walks themselves, and the front-matter parse contract stopped being spelled out in both pre-flights. The analysis engine keeps leaving this budget rather than entering it: intake joined locked/evidence/synthesis/render/resolve in multi-agent-refs/analysis/, which is what let analysis/SKILL.md drop under the 6000 hard cap after its grace entry was retired. 350 was the smallest step that clears it; phase-4 and phase-6 are amber on purpose, as phase-1 and phase-3 already were. v15.20.0: total 55250 -> 55500 for the TDD bridge. Phase 3 pre-flight read the analysis doc's concept table and even said test method names come from it, while nothing read Section 15 - so the RED step invented tests and the analysis test matrix never reached development. Phase 3 step 5b now loads it into state.dev.testPlan[] and Phase 4 step 1.45 cross-checks every planned row against a real test, which is what turns "analysis quality is output quality" from a slogan into a finding. Compression came first on both blocks, 300 tokens down to 175, by dropping the enumerated failure modes to one line each and the rationale to one clause; the reasoning lives in the CHANGELOG. 250 was the smallest step that clears it. v15.21.0: total 55500 -> 55800 for the post-analysis confirmation. Phase 2 gained Step 0.9, the last human checkpoint before Phase 3: derived values are shown for confirmation and only Section 20 rows are asked, through the resolve engine that already exists in refs. It belongs here rather than Phase 4 because Phase 4 runs after development, where an answer arrives too late to change anything. Compression came first and twice, 430 tokens down to 250, by collapsing the derived-vs-asked explanation to one sentence each and moving the walk itself to multi-agent-refs/analysis/resolve.md, which Phase 4 and analysis-resolve already mount. 300 was the smallest step that clears it. v15.22.0: total 55800 -> 55900 for the analyst-toolkit hooks. Phase 1 Step 4 now names the two prefs that decide whether a document is produced at all and how deep it goes (forceFull, mode) - the first of those had shipped declared-but-inert and smoke-prefs-consumed caught it - and Phase 4 triage gained one clause: a finding that blames a third-party library asks evidence-github whether it is already open upstream, which turns it into a deferred item with a citation instead of Phase 3 rework on code that is not ours. Compression came first and three times, taking the new prose from 220 tokens to 110, and the Phase 1d evidence contract itself never entered this budget - it lives in multi-agent-refs/analysis/evidence.md beside the phases it belongs to. 100 was the smallest step that clears it, leaving 34 tokens of headroom. phase-4 stays amber and the debt named at v15.10.0 stands: it is the doc that needs structural compression rather than another bump, and the two candidates are the inline triage JSON shape and the 3.4 telemetry block, both of which restate something already authoritative elsewhere. v16.0.0: total 55900 -> 56350 for the depth picker. `--dev` and the four dev-* commands are gone; depth is Phase 0 Step 7.5, which costs phase-0-init a step it did not have. Compression came first and three times, taking the step from 530 tokens to 300: the question wording, the per-taskType recommendation and the mode tables all live in phases/modes.md (outside this budget), so the phase doc carries only what an agent cannot infer - that the step runs after Step 7 and why, who is exempt, that ASK_CHOICE_DEFAULT must be passed explicitly because ask-choice.sh takes the FIRST option on a non-TTY, and that Short flips the Phase 1/2 tiles late rather than pre-marking them. The phase-4 telemetry block named as compression debt at v15.22.0 was collapsed to an emit() helper (-27) and the four dev-* mode files left the tree entirely, but neither offsets a genuinely new phase step. 450 was the smallest step that clears it, leaving 119 tokens of headroom. phase-4 remains amber and its other named candidate, the inline triage JSON shape, was left alone on purpose: it is the prompt the triage agent is handed, not a restatement for readers. v16.2.0: total 56350 -> 56600 for the spec-freshness and reuse-tag contracts. Phase 3 step 3 had compared `state.run.lastAnalysisDigest` since it was written, against a key nothing ever set and that the state schema did not declare, so the staleness branch was unreachable and every run reported fresh by default. Phase 1 now persists the digest and a `base_commit` anchor, and step 3 gained the repo-drift half the digest cannot see: a reused document keeps a matching digest precisely because its evidence inputs did not change, while the code underneath it moved. The second contract is the Section 14 tag reaching development: Phase 2 carries it onto the todo as `sourceTag` and Phase 3 treats it as an instruction, which is what stops a Reuse row from being re-implemented. Compression came first and took the four additions from 380 tokens to 214, by moving every rationale clause out of the phase docs: why the commit anchor exists rather than a digest recomputation lives in this note and the CHANGELOG, and the schema descriptions carry the field semantics. The baseline had 9 tokens of headroom, so no addition of any size could have fit without a bump. 250 was the smallest step that clears it, leaving 45 tokens. phase-3 and phase-4 remain amber. v16.13.0: total 57600 -> 57700 for the code-graph injection and the fable-rung switch. Phase 1 gained Step 2.6 (query the graph, hand Explore a ranked starting set), Phase 7 gained the post-branch graph refresh, and Phase 0 Step 0 gained one line: a prefs switch that resolves every preferredModel: fable persona to opus for the run, which also collapses the Phase 4 Claude Code panel from three reviewers to two. Compression came first and mostly structurally: of roughly 1,630 tokens of new contract text, 1,310 never entered this budget at all - the whole code-graph contract lives in multi-agent-refs/features/code-graph.md (604) and the fable switch's scope table, per-host effects and cost-accounting consequence live in features/model-fallback.md (+707), leaving the phase docs with the call, the pref that gates it and the one fact an agent cannot infer. Phase 4 was compressed on top of that: its TLDR restated the reviewer matrix 270 lines below it, so 36 tokens came back and the doc nets +6 despite carrying two new clauses. One of those clauses is a correction rather than a feature - the consensus rule still said reviewerCount is 2 on Claude Code, which stopped being true when the third reviewer landed in 16.12.0, and the cross-CLI smoke never caught it because it reads the matrix line instead. 100 was the smallest step that clears it, leaving 54 tokens. phase-3 and phase-4 remain amber. v16.17.0: total 57700 -> 57850 for the platform-parity cross-check. Phase 4 gained Step 1.8: when dev-context carries a counterpart app repo, the review compares the change against the other platform on four axes. Compression came first and structurally, as always - of roughly 1,610 tokens of new contract text, 1,490 never entered this budget at all, because the four axes, the file cap, the graph-query recipe, the read-only prohibitions and the rule that an extractor miss may not be reported as an absence all live in multi-agent-refs/platform-parity.md. The step itself was then cut from ~200 tokens to 120 by deleting everything the ref already owns, leaving the trigger, the pointer and the two facts an agent must not infer: the counterpart repo is read-only, and parity findings are never blocking. The baseline had 13 tokens of headroom, so no addition of any size could have fit without a bump. 150 was the smallest step that clears it, leaving 35 tokens. phase-3 and phase-4 remain amber, and phase-4's structural-compression debt still stands. v16.20.0: phase-4-review max 14750 -> 15150 and total 58250 -> 60250 for the cross-round review delta, the scope self-check handoff and the circuit-breaker wiring. Compression came first and structurally: of roughly 3,900 tokens of new contract text, 2,700 never entered this budget at all - the previous-round-findings block, the scope-self-check block, the Step 3.8 state merge, telemetry and picker wording live in multi-agent-refs/features/review-delta.md, and the scope-check record rules and consumers in features/scope-check.md - so the phase docs carry the call, the pref that gates it and the exit table. The Phase 3 stability rule and the trigger-3 write were cut twice more before the bump; phase-3 stays under its max (8692/8950). Phase 4 is the first per-phase max raised since v10.9.0: the doc gained three steps that cannot be inferred (a per-round triage file, a prefix block that changes what reviewers report, and a halt condition), and its structural-compression debt (the inline triage JSON shape, named at v15.10.0) still stands and is the next candidate. 15150 and 60250 were the smallest steps that clear it, leaving 25 and 45 tokens. v16.23.0: phase-0-init max 12400 -> 12500 and total 60250 -> 60500 for the widget-registration call and the accounting gate. Phase 0 gained the `tiles` call and the exit-3 rule, Phase 7 gained the run report; together they are contract an agent cannot infer - which call registers this host's widget, and that a completion is refused without recorded spend. Compression came first and twice, taking the new prose from 472 tokens to 255: the per-host call list moved into tracker-contract.md "The card is not the widget" and the record-then-rerun recovery into "Accounting is a gate", both outside this budget, leaving the phase docs with the call and the one fact that cannot be looked up. 100 and 250 were the smallest steps that clear it, leaving 74 and 40 tokens. phase-3 and phase-4 remain amber. v16.24.0: total 60500 -> 60750 for visual evidence. Four phase docs gained one instruction each that cannot be inferred: Phase 0 keeps the issue's own images as the pre-fix evidence, Phase 3 captures the fixed state (there and not Phase 5, because every autopilot and --local entry drops Phase 5), Phase 5 hosts the flow recording when it runs, and Phase 6 blocks on a required artefact that is neither attached nor explained. Compression came first and twice, 42 tokens back, and the contract itself never entered this budget: the trigger matrix, the three video tiers, the size-degradation ladder and both render shapes live in multi-agent-refs/features/visual-evidence.md. phase-0-init cleared its own max without a bump. 250 was the smallest step that clears the aggregate. phase-3 and phase-4 remain amber. v17.0.0: phase-0-init max 13000 -> 13100 and total 62400 -> 62500 for the evidence-verdict writer. Phase 0 Step 7.7 probed with `--platform "$PLATFORM"`, a variable no phase document ever assigned, and it was gated on `visualEvidence.required`, which no phase document ever wrote - five readers, zero writers - so the step, Phase 3's capture and Phase 6's blocker were all unreachable and the pipeline reported nothing wrong. The step now writes the verdict and derives the platform from the stack, skipping the probe with a recorded reason when there is no device platform rather than passing the empty string the probe refuses with exit 2. Compression came first and three times, 30 tokens back from the Step 7.7 index rule that restated Step 7.5 verbatim and 55 from the new block itself; the reasoning never entered this budget, because who writes the verdict and how the platform is derived live in features/visual-evidence.md sections 1a and 1b. phase-3-dev max 9250 -> 9300 in the same change: it reads the platform back from state and re-decides the provisional verdict before capturing, which is the half of the fix that makes Phase 3 honest rather than merely reachable. Compressed three times first, 29 tokens back, by pointing its Phase-5 rationale and its tier mapping at visual-evidence.md sections 3 and 4.3 where both already live. 100, 50 and 150 were the smallest steps that clear it, leaving 24, 15 and 26 tokens. phase-3 and phase-4 remain amber. v17.1.0: total 62550 -> 62600 for the Figma/toolkit MCP distinction and web as an evidence platform. Three phase docs said "MCP forbidden" without qualifying it, while the gate that enforces it (smoke-no-mcp-in-dev-phases.sh) has always matched `figma` and nothing else - so the prose banned the screenshot, xcodebuild and UI-test tools that Phase 3 Steps 3.4 and 3.55 actually call, which is one way a run reaches Phase 7 with no evidence. Phase 0 gained one `web` arm in the platform derivation, now that run-ui-tests.sh has a web arm to derive it for. Compression came first and three times, taking the new prose from 175 tokens to 30: the reasoning moved to rules.md, whose own seven-row Figma phase matrix was deleted in the same pass because it duplicated rules/figma-pipeline.md "Phase access matrix" two paragraphs below this file's own instruction not to duplicate that rule file - 74 tokens back there, which is why phase-3-dev cleared its max without a bump (9298/9300). 50 was the smallest step that clears the aggregate, leaving 37 tokens. phase-3 and phase-4 remain amber. v17.1.0 (2): total 62600 -> 62700 for the plan reaching the task widget. Phase 2 computed tasks[], their order and their dependsOn[] edges, stored them, and used them to drive Phase 3's ready-task picker - and none of it was visible on the surface the user actually watches; the card had drawn sub-phases for releases, the widget never had. Phase 2 gains one call. Compression came first and twice: the tasks[]-to-todos[] jq blob left the phase doc for plan-todos.sh `set`, which now accepts a planning-output document directly (-28, and it removes a mapping two files defined, of which this was the untested copy), and the new step's own prose was cut from 116 tokens to 61. The parsing of the plan itself never entered this budget - it lives in phase-tracker.sh `plan`, which owns the sub-phase structure it writes. 100 was the smallest step that clears it, leaving 75 tokens. phase-3 and phase-4 remain amber. v17.5.0: phase-0-init max 13100 -> 13150 for the deferred widget registration, the dev-context step and two more exit-gate assertions. Compression came first and seven times, 492 tokens reclaimed before the number moved: the TLDR restated the step headings under it, the exit-gate list restated the script's own header comment, and the clarifier cost note, the branch-collision probe rationale, the fetch-fail host explanation, the multi-repo write-state race and the baseline unknown-vs-green warning all restate something already authoritative in agents/task-clarifier.md, phases/operations.md or phase0-exit-gate.mjs. The three additions are contract an agent cannot infer: that only Phase 0 is registered at Step -1 and the rest at 7.5 with `tiles --new`, that the dev-context picker runs between project and branch and writes siblings[] even when empty, and that a one-option AskUserQuestion is refused by the host along with every question batched with it. The reasoning for the last one never entered this budget - it lives in picker-contract.md "Two options or it is not a question". 50 was the smallest step that clears it, leaving 28 tokens; the aggregate needed no bump and sits at 62698/62700. phase-3 and phase-4 remain amber. v17.5.0 (2): phase-0-init max 13150 -> 13300 and total 62700 -> 62900 for the workspace question. Phase 0 gained Step 5b: where the branch lives was decided by a flag and by a command name, never by a question, so a user who saw a run improvise "Worktree / Lokal" once took it for a shipped picker and concluded /multi-agent:local was redundant - while it was the only way to reach local mode at all. Compression came first and three times, 156 tokens reclaimed before the number moved and the step itself cut from 426 tokens to 181: the ask-choice index rule in Step 7.5 restated modes.md "Pipeline depth" in full, and the question wording, the two options and what local costs now live in modes.md "Local Mode", outside this budget. What the phase doc carries is what an agent cannot infer - that it runs after Step 4 and before Step 6b and 7.5, who is exempt, and that autopilot resolves it to a worktree rather than skipping it, because an unattended commit in the user's own checkout is what worktrees exist to prevent. The state field is the other half: localMode alone cannot say whether anyone decided, since false is both a chosen worktree and one nothing asked about, and phase0-exit-gate.mjs now refuses to close Phase 0 without workspaceSource. 150 and 200 were the smallest steps that clear it, leaving 32 and 56 tokens. phase-3 and phase-4 remain amber. v17.5.0 (3): phase-0-init max 13300 -> 13400 and total 62900 -> 63000 for base-branch evidence. Step 3 asked one question with a list it could not vouch for: `git fetch origin` ran, its exit code was discarded, and `git branch -r` printed the remote-tracking cache either way, so a restricted network produced a weeks-old local list presented as the remote's answer. And the answer was usually derivable - an issue carrying a target version, or linking a separate issue that represents the release, already names the branch on a repo whose release branches encode the version - and nothing derived it. Rule 5 now captures the exit code and rule 5b hands the list plus the issue's version fields and links to base-branch-candidates.mjs. Compression came first and six times, 1,118 characters reclaimed across this step before the number moved: the one-row picker rule and the not-skippable rule both restated picker-contract.md, the autopilot resolution order and the whole rationale for admitting version-carrying branches moved into features/base-branch-evidence.md, and the fetch-fail persistence block was four sentences for one instruction. The feature's own reasoning never entered this budget at all - the evidence sources, the learned convention, the picker contract, the autopilot fencing and the state shape are ~1,900 tokens living in that ref. What the phase doc carries is the call and the two facts an agent cannot infer: that the fetch exit code decides whether the list may be called remote, and that the branch filter needs a version alternative because a word list that discards is the prefix table this replaces. 100 was the smallest step that clears both, leaving 51 and 61 tokens. phase-3 and phase-4 remain amber. v17.6.0: phase-3-dev max 9300 -> 9450 and total 63000 -> 63150 for package-manager resolution. The node-shaped arms typed `npm` into two command lines, so a repo on pnpm, yarn or bun failed in Phase 3 with a worktree and a branch already created - or, worse, npm resolved against a lock file it does not own and the run continued on a tree the repo's own tooling would never have produced. Both arms now call package-manager.mjs, which prints the line to run. A resolver invocation is inherently longer than the four characters it replaces, and phase-3-dev had 2 tokens of headroom (9298/9300), so no addition of any size could have fit without a bump. Compression came first and twice, taking the new prose from 430 characters to 160 and trimming the build arm's tail by 140: the resolution order, the two-lock-file rule, the per-manager command shapes, the exit-3 contract and the eval-safety argument all live in features/package-manager.md, outside this budget. What the phase doc carries is the call and the one fact an agent cannot infer - that exit 3 means the repo declares no such script, so the step is skipped and said, never substituted. phase-4-review was compressed rather than raised in the same pass: its Gate 3 comment named npm as though it were the only node test command, and the corrected line is 64 characters SHORTER than the one it replaces, so the doc nets -64 while becoming true (15150/15150). 150 was the smallest step that clears phase-3-dev, leaving 51 tokens; 150 clears the aggregate, leaving 133. phase-3 and phase-4 remain amber.
|
package/index.js
CHANGED
|
@@ -69,6 +69,15 @@ if (command === "--version" || command === "-v" || command === "version") {
|
|
|
69
69
|
console.error("uninstall failed:", e.message);
|
|
70
70
|
process.exit(1);
|
|
71
71
|
});
|
|
72
|
+
} else if (command === "verify") {
|
|
73
|
+
// The manifest and this command are the answer to "is my install the thing
|
|
74
|
+
// that was published". Kept out of PLATFORM_EXEMPT on purpose: verifying an
|
|
75
|
+
// install on a host the pipeline refuses to run on answers a question nobody
|
|
76
|
+
// has.
|
|
77
|
+
const { main } = await import(
|
|
78
|
+
pathToFileURL(join(__dirname, "pipeline", "scripts", "verify.mjs")).href
|
|
79
|
+
);
|
|
80
|
+
await main();
|
|
72
81
|
} else if (command === "help") {
|
|
73
82
|
console.log(`
|
|
74
83
|
multi-agent-pipeline - 8-phase AI development pipeline
|
|
@@ -93,6 +102,12 @@ if (command === "--version" || command === "-v" || command === "version") {
|
|
|
93
102
|
npx @mmerterden/multi-agent-pipeline uninstall --all-data ALSO remove pipeline settings + logs/state/metrics
|
|
94
103
|
npx @mmerterden/multi-agent-pipeline uninstall --cursor Legacy pre-v10.7 adapter-file cleanup (also --copilot-chat / --antigravity; --target=<path> overrides cwd)
|
|
95
104
|
|
|
105
|
+
Verify (is this install the thing that was published):
|
|
106
|
+
npx @mmerterden/multi-agent-pipeline verify Package hashes + ~/.claude drift
|
|
107
|
+
npx @mmerterden/multi-agent-pipeline verify --package Package integrity only
|
|
108
|
+
npx @mmerterden/multi-agent-pipeline verify --install Install drift only
|
|
109
|
+
npx @mmerterden/multi-agent-pipeline verify --json
|
|
110
|
+
|
|
96
111
|
Help:
|
|
97
112
|
npx @mmerterden/multi-agent-pipeline help
|
|
98
113
|
npx @mmerterden/multi-agent-pipeline --version Print the installed version
|
|
@@ -111,7 +126,7 @@ if (command === "--version" || command === "-v" || command === "version") {
|
|
|
111
126
|
`);
|
|
112
127
|
} else {
|
|
113
128
|
console.error(`Unknown command: ${command}`);
|
|
114
|
-
console.error("Valid commands: install, uninstall, delete, help, version (--version/-v)");
|
|
129
|
+
console.error("Valid commands: install, uninstall, delete, verify, help, version (--version/-v)");
|
|
115
130
|
console.error("Run with 'help' for usage.");
|
|
116
131
|
process.exit(1);
|
|
117
132
|
}
|
package/install/_common.mjs
CHANGED
|
@@ -141,6 +141,34 @@ export function removePipelineAgentFiles(destDir, agentsSrc) {
|
|
|
141
141
|
* @param {string} dest
|
|
142
142
|
* @param {{ exclude?: Array<string|RegExp>, useSymlinks?: boolean }} [opts]
|
|
143
143
|
*/
|
|
144
|
+
/**
|
|
145
|
+
* Build and editor droppings that live inside a source tree and must never
|
|
146
|
+
* reach a user's install. Python writes `__pycache__/<mod>.cpython-NNN.pyc`
|
|
147
|
+
* next to any script it IMPORTS, so a tree that has merely been used has them;
|
|
148
|
+
* the Finder writes .DS_Store into any directory it has displayed.
|
|
149
|
+
*
|
|
150
|
+
* This is not cosmetic. The installed file count is a gate in this repo, and a
|
|
151
|
+
* CI runner on Python 3.14 shipped 147 files where every developer tree shipped
|
|
152
|
+
* 146 - for four rounds the difference looked like a fixture bug, because the
|
|
153
|
+
* extra file was untracked and therefore invisible to every diff of the SOURCE.
|
|
154
|
+
* Filtering here fixes the user-visible half too: a .pyc compiled against one
|
|
155
|
+
* interpreter is worse than useless on another.
|
|
156
|
+
*
|
|
157
|
+
* @param {string} rel path relative to the copy root, posix-separated
|
|
158
|
+
* @returns {boolean}
|
|
159
|
+
*/
|
|
160
|
+
function isCopyJunk(rel) {
|
|
161
|
+
return (
|
|
162
|
+
rel === ".DS_Store" ||
|
|
163
|
+
rel.endsWith("/.DS_Store") ||
|
|
164
|
+
rel === "__pycache__" ||
|
|
165
|
+
rel.startsWith("__pycache__/") ||
|
|
166
|
+
rel.includes("/__pycache__/") ||
|
|
167
|
+
rel.endsWith("/__pycache__") ||
|
|
168
|
+
rel.endsWith(".pyc")
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
144
172
|
export function copyDir(src, dest, opts = {}) {
|
|
145
173
|
const { exclude = [], useSymlinks = false, skipExisting = false } = opts;
|
|
146
174
|
if (useSymlinks) {
|
|
@@ -156,26 +184,23 @@ export function copyDir(src, dest, opts = {}) {
|
|
|
156
184
|
// user-owned trees (rules/) so an update adds new baseline files but preserves
|
|
157
185
|
// the user's locally-evolved copies. cpSync with force:false + errorOnExist:false
|
|
158
186
|
// silently skips existing files.
|
|
187
|
+
// Normalize to forward slashes so exclude patterns (written posix-style)
|
|
188
|
+
// also match on win32, where cpSync hands back backslash paths.
|
|
189
|
+
const relOf = (source) => source.slice(src.length).split("\\").join("/").replace(/^\//, "");
|
|
190
|
+
// Junk is filtered on EVERY path, including the two that take no exclude
|
|
191
|
+
// list: the point is that the caller never has to remember it.
|
|
192
|
+
const filter = (source) => {
|
|
193
|
+
const rel = relOf(source);
|
|
194
|
+
if (isCopyJunk(rel)) return false;
|
|
195
|
+
return !exclude.some((pat) =>
|
|
196
|
+
typeof pat === "string" ? rel === pat || rel.startsWith(pat + "/") : pat.test(rel),
|
|
197
|
+
);
|
|
198
|
+
};
|
|
159
199
|
if (skipExisting) {
|
|
160
|
-
cpSync(src, dest, { recursive: true, force: false, errorOnExist: false });
|
|
200
|
+
cpSync(src, dest, { recursive: true, force: false, errorOnExist: false, filter });
|
|
161
201
|
return;
|
|
162
202
|
}
|
|
163
|
-
|
|
164
|
-
cpSync(src, dest, { recursive: true, force: true });
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
cpSync(src, dest, {
|
|
168
|
-
recursive: true,
|
|
169
|
-
force: true,
|
|
170
|
-
filter: (source) => {
|
|
171
|
-
// Normalize to forward slashes so exclude patterns (written posix-style)
|
|
172
|
-
// also match on win32, where cpSync hands back backslash paths.
|
|
173
|
-
const rel = source.slice(src.length).split("\\").join("/").replace(/^\//, "");
|
|
174
|
-
return !exclude.some((pat) =>
|
|
175
|
-
typeof pat === "string" ? rel === pat || rel.startsWith(pat + "/") : pat.test(rel),
|
|
176
|
-
);
|
|
177
|
-
},
|
|
178
|
-
});
|
|
203
|
+
cpSync(src, dest, { recursive: true, force: true, filter });
|
|
179
204
|
}
|
|
180
205
|
|
|
181
206
|
/**
|
|
@@ -58,6 +58,10 @@ export const MAINTAINER_SMOKES = new RegExp(
|
|
|
58
58
|
const DEV_ONLY_TOOLING = Object.freeze([
|
|
59
59
|
"run-smokes.mjs",
|
|
60
60
|
"scorecard.mjs",
|
|
61
|
+
// Runs scorecard.mjs from the repo root and diffs its snapshots. In an
|
|
62
|
+
// install that root is $HOME, so the scorecard it shells out to is not
|
|
63
|
+
// there - shipping it would hand the user a command that cannot work.
|
|
64
|
+
"scorecard-snapshot.mjs",
|
|
61
65
|
"lint-skills.mjs",
|
|
62
66
|
"lint-personas.mjs", // imports install/_codex-agents.mjs, which never ships to scripts/
|
|
63
67
|
"lint-mcp-refs.mjs",
|
|
@@ -66,6 +70,10 @@ const DEV_ONLY_TOOLING = Object.freeze([
|
|
|
66
70
|
"validate-schemas.mjs", // validates the repo's own schema files, needs ajv
|
|
67
71
|
"sync-parity-check.sh",
|
|
68
72
|
"benchmark-phase-0.sh",
|
|
73
|
+
// Publish-time only: `prepack` runs it from the repo root to write
|
|
74
|
+
// manifest.json into the tarball. It shells `npm pack` against that root,
|
|
75
|
+
// which in an install is $HOME - so an installed copy could only ever fail.
|
|
76
|
+
"make-manifest.mjs",
|
|
69
77
|
]);
|
|
70
78
|
|
|
71
79
|
/** Eval harnesses (`eval-*.mjs`) read `pipeline/eval/**`, which never ships. */
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* _unattended-profile.mjs - the permission posture a machine with nobody at
|
|
3
|
+
* the keyboard needs, written only when asked for.
|
|
4
|
+
*
|
|
5
|
+
* autopilot spawns its child with `--permission-prompts none`. That stops Claude
|
|
6
|
+
* Code from ASKING; it grants nothing. The tools the child then calls still have
|
|
7
|
+
* to be allowed somewhere, and on a fresh machine they are not - so the run
|
|
8
|
+
* stops at the first tool call, silently, with no prompt anywhere for a person
|
|
9
|
+
* to answer. It looks exactly like a queue that has nothing to do.
|
|
10
|
+
*
|
|
11
|
+
* This is opt-in and always will be. A default install writes no permissions at
|
|
12
|
+
* all, because widening a permission set is not a thing an installer should do
|
|
13
|
+
* to somebody who only wanted the pipeline files copied. `--unattended` prints
|
|
14
|
+
* the full list and the reason for each line BEFORE writing anything, because
|
|
15
|
+
* "the installer changed my permissions" should never be something a person
|
|
16
|
+
* discovers afterwards.
|
|
17
|
+
*
|
|
18
|
+
* The entries are broad on purpose, and that breadth is the cost of unattended
|
|
19
|
+
* operation rather than an oversight. A pipeline run builds, tests, edits, and
|
|
20
|
+
* shells out to whatever the repo's own toolchain is; an allowlist narrow
|
|
21
|
+
* enough to be interesting would be one the first unfamiliar repo breaks. The
|
|
22
|
+
* honest framing is: this is a machine you have decided to let run on its own.
|
|
23
|
+
*
|
|
24
|
+
* @module install/_unattended-profile
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
28
|
+
import { join } from "node:path";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Tool name plus why an unattended run cannot proceed without it. The reason is
|
|
32
|
+
* printed, not just stored: a list of fifteen tool names with no reasons is a
|
|
33
|
+
* list nobody audits.
|
|
34
|
+
*/
|
|
35
|
+
export const UNATTENDED_ALLOW = [
|
|
36
|
+
["Bash", "every build, test, git and gh call the pipeline makes"],
|
|
37
|
+
["Edit", "Phase 3 cannot change a file without it"],
|
|
38
|
+
["Write", "new files, and every artefact a phase leaves behind"],
|
|
39
|
+
["Read", "reading the repo it was pointed at"],
|
|
40
|
+
["Glob", "finding files by pattern instead of shelling out to find"],
|
|
41
|
+
["Grep", "the same, for content"],
|
|
42
|
+
["Agent", "Phase 1 and Phase 4 dispatch subagents"],
|
|
43
|
+
["Skill", "the phase specs are skills"],
|
|
44
|
+
["WebFetch", "issue and ticket bodies referenced by URL"],
|
|
45
|
+
["TaskCreate", "the phase tracker's task list"],
|
|
46
|
+
["TaskUpdate", "the same"],
|
|
47
|
+
["TaskList", "the same"],
|
|
48
|
+
["TaskGet", "the same"],
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Render the profile for a human to read before it is applied.
|
|
53
|
+
*
|
|
54
|
+
* @param {string[]} already entries the settings file already carries
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
export function describeUnattendedProfile(already = []) {
|
|
58
|
+
const lines = [
|
|
59
|
+
" Unattended permission profile - these go into ~/.claude/settings.json",
|
|
60
|
+
" under permissions.allow. Nothing is removed; existing entries are kept.",
|
|
61
|
+
"",
|
|
62
|
+
];
|
|
63
|
+
for (const [tool, why] of UNATTENDED_ALLOW) {
|
|
64
|
+
const mark = already.includes(tool) ? "already there" : "will be added";
|
|
65
|
+
lines.push(` ${tool.padEnd(12)} ${why} (${mark})`);
|
|
66
|
+
}
|
|
67
|
+
lines.push("");
|
|
68
|
+
lines.push(" This is broad, and that breadth is what unattended operation costs: a run");
|
|
69
|
+
lines.push(" builds and tests whatever the target repo uses, so a narrow list is one the");
|
|
70
|
+
lines.push(" first unfamiliar repo stops at, with nobody there to answer.");
|
|
71
|
+
return lines.join("\n");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Merge the profile into settings.json. Additive only, and idempotent: running
|
|
76
|
+
* it twice changes nothing the second time, and an entry a person added by hand
|
|
77
|
+
* survives.
|
|
78
|
+
*
|
|
79
|
+
* @param {{home:string, dryRun?:boolean}} opts
|
|
80
|
+
* @returns {{path:string, added:string[], already:string[], written:boolean}}
|
|
81
|
+
*/
|
|
82
|
+
export function applyUnattendedProfile({ home, dryRun = false }) {
|
|
83
|
+
const path = join(home, ".claude", "settings.json");
|
|
84
|
+
let settings = {};
|
|
85
|
+
if (existsSync(path)) {
|
|
86
|
+
try {
|
|
87
|
+
settings = JSON.parse(readFileSync(path, "utf-8"));
|
|
88
|
+
} catch (err) {
|
|
89
|
+
// A settings file that does not parse is the user's, not ours to
|
|
90
|
+
// rewrite: overwriting it would lose whatever is in there.
|
|
91
|
+
throw new Error(`${path} is not valid JSON, so it will not be modified: ${err.message}`, {
|
|
92
|
+
cause: err,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const permissions = settings.permissions || {};
|
|
97
|
+
const allow = Array.isArray(permissions.allow) ? [...permissions.allow] : [];
|
|
98
|
+
const already = [];
|
|
99
|
+
const added = [];
|
|
100
|
+
for (const [tool] of UNATTENDED_ALLOW) {
|
|
101
|
+
if (allow.some((a) => String(a) === tool || String(a).startsWith(`${tool}(`)))
|
|
102
|
+
already.push(tool);
|
|
103
|
+
else {
|
|
104
|
+
allow.push(tool);
|
|
105
|
+
added.push(tool);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (dryRun || !added.length) return { path, added, already, written: false };
|
|
109
|
+
|
|
110
|
+
settings.permissions = { ...permissions, allow };
|
|
111
|
+
writeFileSync(path, `${JSON.stringify(settings, null, 2)}\n`);
|
|
112
|
+
return { path, added, already, written: true };
|
|
113
|
+
}
|