Skip to content

R03 - Fix rounds and compaction

Purpose: When a wave lead should resume a builder for review findings and when it should start a fresh one, and what Claude Code’s compaction and prompt cache settings do for builders, reviewers and leads. Measured over the V1-M2-walking-skeletonV1-M2-walking-skeleton: Walking skeletonwb-vmd boots a fixture VM bundle in its confined process, wb-guestd answers over vsock, a data disk made on the host holds the homes, and wb shell opens a PTY as a project user, with its output through the terminal fi… runs I307I307 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane)., I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane)., I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane)., I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17)., I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). and waves 1 and 2 of I384I384 (closed): Run 2026-10-22 (V1-M2-walking-skeleton, lane mac)/wave --waves 5 --lane mac --merge (2026-10-16 to 2026-10-22). Issue I386I386 (closed): Fix rounds and compaction: when to resume a builder, and how agents should compactWhen a review sends findings back, the wave lead resumes the original builder..

Requirements: none. This note is about the agent harness, not the product.

  • Transcripts. The session transcripts of the six run sessions under ~/.claude/projects/ for this repository: 48 builders, 46 code reviewers, 23 security reviewers and 18 wave leads. This note’s own builder and its lead are left out. Short Python scripts read the usage of every API call, deduplicated by message ID, and the time stamps. A resume is a message from the lead that starts a new turn of a finished builder.
  • Round kinds. A must-fix round follows a needs changes review, a fold round follows an approve. The lead’s message says which. Background-task notices, rebase items and the three continuations after a turn limit are counted apart.
  • Warm or cold. A call is cold when it reads less than half its context from the cache. The cache write and read counts come from the API’s usage fields.
  • Cost. In input-equivalent tokens: one base input token of the model is 1. For Opus 5.5 a 5-minute cache write is 1.25, a 1-hour cache write 2, a cache read 0.05 and an output token 5. Fable 5.1 reads at 0.025 (Anthropic’s pricing page). Every agent in the runs ran on Opus 5.5 except the security reviewers, which ran on Fable 5.1. 1M input-equivalent tokens on Opus 5.5 is $4 at list price. The maintainer’s plan usage is assumed to scale the same way, which the note doesn’t check.
  • Next check. The reviews and re-checked: comments on each pull request, from GitHub.
  • Options. Claude Code’s documentation at code.claude.com/docs, and the settings and version on the maintainer’s Mac. Each claim below names its page.
Run Pull request Round Idle Cache Context Calls Cost Minutes Next check
I307I307 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR308PR308 (merged): docs: list S15-least-privilege in the README and docs site spec tablesAdds the S15-least-privilege row to the spec table in README.md and in the docs site's design.md. folds 3 warm 36k 11 31k 3 re-checked
I307I307 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR310PR310 (merged): fix(doc): render every page in the docs build so reference errors fail itThe CI Docs job runs doc:check before doc:build. folds 6 cold 50k 9 86k 3 re-checked
I307I307 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR311PR311 (merged): feat(swift): wb-vmd device-set check and the refused-class lint rule- WraithBoxVM gets VMDescription (VMDevice and its kinds), wb-vmd's own description of a VM configuration. must-fix 7 cold 132k 31 414k 5 approve
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR315PR315 (merged): chore(agents): add spike:clean for spike VM bundlesSpikes that boot a macOS guest leave VM bundles in ~/Library/Caches/wraithbox-spikes/, and nothing removed them. must-fix 8 cold 90k 28 292k 6 approve
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR315PR315 (merged): chore(agents): add spike:clean for spike VM bundlesSpikes that boot a macOS guest leave VM bundles in ~/Library/Caches/wraithbox-spikes/, and nothing removed them. folds 3 warm 122k 5 34k 3 re-checked
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR316PR316 (merged): docs(threats): record the data disk, login code, config link and graphics cache residualsRecords four accepted residual risks in T00-index and points the specs that state each one at its entry. must-fix 5 warm 107k 21 155k 4 approve
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR317PR317 (merged): ci: run the go and swift jobs and the docs site steps only when their inputs changedOn a pull request, CI now skips the go and swift jobs and the docs site check and build steps when no file they read changed. folds 6 cold 113k 21 294k 5 re-checked
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR319PR319 (merged): feat(go): hostgit, resolve and check the host git, run it scrubbedAdds internal/hostgit, the library wb and wb-hostd will use to run the host's git. must-fix 11 cold 152k 33 520k 8 approve
I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR319PR319 (merged): feat(go): hostgit, resolve and check the host git, run it scrubbedAdds internal/hostgit, the library wb and wb-hostd will use to run the host's git. folds 2 warm 194k 7 73k 3 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR324PR324 (merged): feat(swift): name guest-written bundle files so a double click doesn't mount themThe 2026-10-16 decision on #312 renames the guest-written disk images, so a double click on one doesn't make Launch Services attach a guest-written image on the host. folds 4 warm 98k 15 99k 4 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR325PR325 (merged): feat(proto): first contracts for wb-vmd and wb-guestd, with buf checksThe first .proto contracts, the buf tooling, and committed generated code for Go and Swift (B52-proto-contracts, decision A). folds 8 cold 192k 15 401k 5 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR326PR326 (merged): feat(swift): wb-vmd boots and stops its slot's VM, confinedwb-vmd boots and stops the VM in its slot's bundle, confined to that bundle, behind the device-set check of #160. folds 16 cold 465k 33 1389k 10 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR326PR326 (merged): feat(swift): wb-vmd boots and stops its slot's VM, confinedwb-vmd boots and stops the VM in its slot's bundle, confined to that bundle, behind the device-set check of #160. must-fix, rebase builder 12 cold 86k 32 495k 11 approve
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR326PR326 (merged): feat(swift): wb-vmd boots and stops its slot's VM, confinedwb-vmd boots and stops the VM in its slot's bundle, confined to that bundle, behind the device-set check of #160. folds, rebase builder 1 warm 131k 8 218k 8 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR327PR327 (merged): ci: add go:fuzz, which runs every Go fuzz target for 10sAdds mise run go:fuzz, the fuzz smoke run that S11-verification-and-spikes ("Fuzzing", "CI") asks for. folds 4 warm 112k 18 139k 7 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR328PR328 (merged): feat(go): stamp the VCS revision into the build version, and treat an unstamped build as no versionStamps one build version into every Go and Swift program, and makes an unstamped build "no version" that every peer refuses, an unstamped peer included (sec L5 of #171). must-fix 11 cold 185k 24 492k 8 approve
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR329PR329 (merged): feat(go): terminal filter for guest output, with drop counts and fuzz propertiesAdds packages/wraithbox-go/internal/termfilter, the allowlist filter of S16-01-filter for the host terminal stream (boundary 6 of T00-index). folds 16 cold 214k 17 470k 7 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR330PR330 (merged): feat(go): wb-hostd state.db with migrations, closed config keys, refusing mode, daemon log pipesPart M2.7a of wb-hostd core: libraries with unit tests, not wired into cmd/wb-hostd (that is #287). must-fix 18 cold 211k 35 756k 9 approve
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR330PR330 (merged): feat(go): wb-hostd state.db with migrations, closed config keys, refusing mode, daemon log pipesPart M2.7a of wb-hostd core: libraries with unit tests, not wired into cmd/wb-hostd (that is #287). folds 5 warm 273k 22 372k 8 re-checked
I323I323 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane mac)Size 4, 5 waves, lane mac, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). PR331PR331 (merged): feat(platform): one-descriptor socket channels and the Seatbelt trampoline with its deny probeTwo shared platform mechanisms that every later daemon needs. folds 13 cold 273k 24 721k 8 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR342PR342 (merged): feat(wb): keep the links the terminal filter drops, with their marksThe terminal filter keeps each OSC 8 link it drops, with a mark, for M4.11 to record and list. must-fix 8 cold 165k 27 716k 14 approve
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR343PR343 (merged): feat(guestd): vsock listener on port 1023 and the checked hellowb-guestd now listens on vsock port 1023 and serves GuestService.Hello. folds 13 cold 231k 23 881k 10 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR344PR344 (merged): feat(app): ad-hoc Wraith Box.app with helper bundles, guest tools disk and the entitlement checkmise run build on macOS now runs app:bundle and writes packages/wraithbox-swift/.build/Wraith Box.app. must-fix 10 cold 291k 49 2107k 31 approve
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR344PR344 (merged): feat(app): ad-hoc Wraith Box.app with helper bundles, guest tools disk and the entitlement checkmise run build on macOS now runs app:bundle and writes packages/wraithbox-swift/.build/Wraith Box.app. folds 3 warm 363k 16 1203k 21 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR346PR346 (merged): feat(wb): terminal reset on exit, checked against a terminal state modelFilter.ExitReset() []byte in internal/termfilter/reset.go returns the bytes that undo what the guest may have changed in the terminal, for the filter's state at that moment. folds 6 cold 146k 14 294k 3 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR347PR347 (merged): feat(platform): host paths, peer-checked local IPC and the host version exchangeHost paths, a peer-checked local IPC endpoint, and the build version exchange with a gRPC adapter, so wb-hostd (M2.7) and wb (M2.9) only call them. folds 11 cold 216k 20 796k 18 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR348PR348 (merged): feat(hostd): VM manager for the work and isolated VMs, with generations and the tools disk stepwb-hostd's VM manager in internal/hostd/vm. must-fix 8 cold 235k 31 729k 13 approve
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR348PR348 (merged): feat(hostd): VM manager for the work and isolated VMs, with generations and the tools disk stepwb-hostd's VM manager in internal/hostd/vm. folds 3 warm 277k 12 185k 8 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR351PR351 (merged): feat(wb): wb setup checks the host and bundle, installs the agent and linkwb setup now does the macOS install path of S17-02-setup for an ad-hoc bundle. folds 12 cold 274k 25 1066k 18 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR352PR352 (merged): feat(hostd): wb-diskfmt formats a VM's new data disk, with records and wb vm reset-datawb-diskfmt formats a VM's new data disk on the host, the one exception SEC15-no-guest-disk-mount makes. folds 12 cold 550k 34 2381k 21 re-checked
I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). PR360PR360 (merged): feat(swift): wb-dev-bundle and mise run vm:* tasks for test VM bundleswb-dev-bundle is a dev-only Swift executable in packages/wraithbox-swift, promoted from the X18-vsock-handoff host tool. must-fix 12 cold 213k 29 962k 23 approve
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR368PR368 (merged): fix(wb): drop DECSTR (CSI ! p) from the terminal filter allowlistFollows the maintainer's decision on #345 (option 1): the filter drops a guest's soft reset CSI ! folds 5 warm 61k 7 94k 11 re-checked
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR369PR369 (merged): fix(hostd): kill wb-diskfmt's process group on a timeout- wb-diskfmt now leads its own process group on macOS. must-fix 13 cold 195k 37 966k 14 approve
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR371PR371 (merged): ci(swift): trim the Swift cache, run the bundle for every Go change, measure the warm runFollow-ups from the review of #357 (#354). folds 6 cold 195k 18 922k 21 re-checked
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR372PR372 (merged): feat(wb): resolve a directory to its project key and recorded identitywb can now find the repository a directory belongs to, its project key, its recorded identity and its default name. folds 17 cold 292k 16 1327k 14 re-checked
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR373PR373 (merged): feat(vmd): ConnectGuest hands off the guest connection, with the host receiver and wb-dev-vmwb-vmd now serves ConnectGuest: it opens a vsock connection to a guest port below 1024 and sends the descriptor to the host in one HandoffMessage on fd 4. must-fix 10 cold 469k 29 1894k 14 approve
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR375PR375 (merged): feat(wb): terminal-stream contract and the wb end of the shell relayThe terminal-stream contract, and wb's end of the shell relay. must-fix 24 cold 336k 29 954k 13 approve
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR375PR375 (merged): feat(wb): terminal-stream contract and the wb end of the shell relayThe terminal-stream contract, and wb's end of the shell relay. folds 2 warm 369k 2 39k 0 re-checked
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR376PR376 (merged): feat(hostd): guest link with port routing, connection caps, reconnect, version match and gRPC limitsThe link wb-hostd keeps to each running VM's wb-guestd: the ports it connects to, the caps on its connections, the reconnect waits and rate, the build version match of the hello, the clock schedule, and the gRPC… folds 17 cold 292k 17 626k 10 re-checked
I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20). PR377PR377 (merged): feat(wb): refuse a host terminal whose charset isn't UTF-8wb now refuses to relay a guest terminal stream when the host terminal's charset isn't UTF-8, as the maintainer decided on #341: refuse, no warn mode, no override flag. folds 3 warm 116k 14 255k 12 re-checked
I384I384 (closed): Run 2026-10-22 (V1-M2-walking-skeleton, lane mac)/wave --waves 5 --lane mac --merge PR385PR385 (merged): feat(hostd): wb vm start, stop and status over wraithbox.hostd.v1Adds StartVM, StopVM and GetVMStatus to HostService in the existing proto/wraithbox/hostd/v1/hostd.proto. folds 9 cold 212k 41 1340k 25 re-checked
I384I384 (closed): Run 2026-10-22 (V1-M2-walking-skeleton, lane mac)/wave --waves 5 --lane mac --merge PR387PR387 (merged): feat(go): refuse a .git directory whose core.worktree names another treeProject resolution now refuses a .git directory (a main checkout) or a linked worktree whose core.worktree doesn't resolve, in canonical form, to the directory that holds that .git, as the maintainer decided on #374. must-fix 15 cold 108k 28 535k 15 approve

Idle is the minutes since the builder’s last API call, context is the builder’s context at its first call of the round, and calls, cost and minutes cover the round. PR360PR360 (merged): feat(swift): wb-dev-bundle and mise run vm:* tasks for test VM bundleswb-dev-bundle is a dev-only Swift executable in packages/wraithbox-swift, promoted from the X18-vsock-handoff host tool. was built in the I340I340 (closed): Run 2026-10-17 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-17). session the day after the run, in an attended wave.

All 42 rounds
must-fix rounds, fold rounds 15, 27
Cold, warm 29, 13
Context at resume, median and largest 195k, 550k
Rounds at 200k or more, under 100k 20, 6
Calls per round, median 21.5
Minutes per round, median 9.5
Cost, total and median 27.7M, 508k
Share of all builder cost (81.0M) 34%

Most of a fix round’s cost is the context the builder carries. A resumed round pays its context C once as a cache write (cold) or a read (warm), then reads it again on each further call. A fresh builder pays an orientation of about 120k and then reads a context of about 60k on each call. The work itself costs the same either way. Under that model, reading and writing the context the builders already had cost 18.4M of the 27.7M the 42 rounds cost.

Rule 5-minute cache, today 1-hour cache
Always resume 18.4M 10.5M
Resume under 100k, else fresh 7.5M 8.8M
Resume under 150k, else fresh 7.5M 7.8M
Resume under 200k, else fresh 8.9M 7.6M
Always fresh 7.8M 9.7M

With a fresh builder that orients at 80k instead of 60k, resuming under 150k costs 8.1M on today’s cache. Of the limits in the table, 150k is within 0.2M of the cheapest under both cache lifetimes. Both lifetimes matter because Claude Code ignores the agent frontmatter’s 1h cache while the subscription draws on usage credits. On the 5-minute cache, 150k costs 1.4M less than 200k, and on the 1-hour cache 200k saves only 0.2M. A fresh builder adds 2 to 4 minutes to a round that takes 9.5 minutes at the median.

The lead can see the size: a builder’s completion notice has a <subagent_tokens> field, which matched the builder’s last context within 3k on the PR385PR385 (merged): feat(hostd): wb vm start, stop and status over wraithbox.hostd.v1Adds StartVM, StopVM and GetVMStatus to HostService in the existing proto/wraithbox/hostd/v1/hostd.proto. builder (213,072 against 210,279).

The cache also goes cold inside a builder’s own run. 118 builder calls rewrote 23.9M tokens of context. All but five of them, which rewrote 0.1M together, came after an idle gap of 5 to 25 minutes:

Before the cold call Rewrites Tokens Idle minutes, median
A CI watch (ci-watch, gh run watch) 41 9.7M 8
A resume by the lead 31 6.8M 12
Another Bash command 22 3.8M 7
mise run ci 9 1.5M 9
Edits, VM, Swift and docs tasks, other 15 2.0M 7

A one-hour cache turns each rewrite with a gap under 60 minutes into a read, and makes every other cache write cost 2 instead of 1.25:

Role Cost Cold rewrites Saved by 1 hour Extra writes Net
Builder 81.0M 118, 23.9M 28.6M 6.3M -22.3M (-28%)
Code reviewer 11.9M 30, 2.7M 3.2M 2.7M -0.5M (-4%)
Wave lead 9.4M 71, 4.0M 4.5M 1.4M -3.1M (-33%)
Security reviewer 5.3M 22, 0.8M 1.0M 1.9M +0.9M
General-purpose agents 3.8M 17, 0.4M 0.5M 1.4M +0.9M

Every builder rewrite had a gap under 60 minutes. The lead’s rewrites follow its waits for agents, up to 127 minutes.

So the runs don’t show a builder, reviewer or lead losing something to compaction, because none of them compacted.

On the maintainer’s Mac: Claude Code 2.1.302, "model": "opus" (Opus 5.5) and "autoCompactEnabled": false in ~/.claude/settings.json. Main sessions write their cache with the one-hour lifetime and subagents with five minutes: in the I384I384 (closed): Run 2026-10-22 (V1-M2-walking-skeleton, lane mac)/wave --waves 5 --lane mac --merge session the main conversation wrote 235k tokens to the one-hour cache and none to the five-minute one, and its subagents 6.0M to the five-minute cache and none to the one-hour one.

Option What it does Source
Context window Opus 4.7 and later run with a 1M window by default. model-config, “Extended context”
Default threshold Models with a native 1M window compact at about 967K. model-config, “Default auto-compact thresholds”
autoCompactEnabled Turns automatic compaction off or on. The documentation doesn’t say whether it covers subagents. settings-reference, index
/autocompact, autoCompactWindow, --autocompact, CLAUDE_CODE_AUTO_COMPACT_WINDOW Set how full the window gets before compaction, 100K to 1M, per model, per launch or for every model. The variable takes precedence over the others. model-config, “Set the auto-compact window”
autoCompactWindow in agent frontmatter Compacts one subagent earlier, as a plain integer from 100000 to 1000000. Needs 2.1.296. The variable above overrides it. sub-agents, “Set the auto-compact window for one subagent”
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE Applies to subagents as well. sub-agents, “Auto-compaction”
/compact <focus> and a # Compact instructions section in CLAUDE.md Tell the summary what to keep. costs, “Manage context proactively”
SessionStart hook matching compact Adds the hook’s output to the compacted context. context-window, “What survives compaction”
PreCompact hook, matcher manual or auto Can block a compaction with decision: "block". hooks, decision control table
What survives The project CLAUDE.md is re-read from disk. Up to five recently changed files are read again, and the rest is a summary. context-window, “What survives compaction”
Compacting a subagent at a chosen point None of the pages read documents a way. /compact is typed at the prompt, and the frontmatter has only autoCompactWindow. sub-agents, frontmatter reference
Cost of a compaction The summary request reads the history, from the cache when warm, uncached after the cache lifetime. prompt-caching, “Compacting the conversation”
Subagent cache lifetime Five minutes by default, also on a subscription. A resumed subagent can read the cache its first run warmed. prompt-caching, “Subagents and the cache”
experimental: cacheTtl: 1h in agent frontmatter One-hour cache for that subagent. Needs 2.1.248, and is ignored while the subscription draws on usage credits. sub-agents, frontmatter reference, and prompt-caching, “Choose the TTL yourself”
subagentPromptCacheTtl, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL The same for every subagent, workflow and helper request, compaction included. settings-reference, subagentPromptCacheTtl

A larger window changes when compaction runs, not what a resumed round costs: that cost scales with the context the builder carries, at any window size.

The settings weren’t tried on a sample fix round. A builder can’t spawn agents, and an agent file’s frontmatter applies to agents spawned after the change.

  • 42 rounds by 35 builders. The model’s orientation cost comes from two fresh builders, and its work cost is assumed equal for a fresh and a resumed builder. A fresh builder that re-reads more files, or that redoes a choice the review didn’t question, costs more than the model says.
  • No fix round failed, so the data can’t tell whether a fresh builder fixes better or worse. The rule below rests on cost alone.
  • The one-hour estimate replays the same calls with other prices. It assumes every call would have been the same.
  • Costs are API list prices. The maintainer’s plan may count usage differently.
  • A one-hour cache for builders and wave leads. Set experimental: cacheTtl: 1h in .claude/agents/builder.md and wave-lead.md. It would have saved about 28% of builder cost and 33% of lead cost: their cold rewrites follow waits for CI, reviews and agents, all under 60 minutes for builders. Leave the reviewers and other agents at five minutes, where it saves little or costs more. The frontmatter is per agent, so .claude/settings.json stays as it is. After the change, a builder’s transcript should show ephemeral_1h_input_tokens in its usage.
  • Resume a builder under 150k, else start a fresh one. The lead reads <subagent_tokens> from the builder’s last notice. Under 150k it resumes the builder. At 150k or more it stops it and spawns a fresh builder on the same branch, with the pull request, the posted reviews and the same findings message as its brief, plus “read the pull request’s Choices made, and don’t revisit a choice the review didn’t question”. On the 42 rounds this rule costs 7.5M against 18.4M today, and 7.8M against 10.5M with the one-hour cache.
  • Keep resuming after a turn limit. A builder that stops at its turn limit has work in its context that isn’t in a commit or a pull request yet. Its three continuations were warm.
  • No compaction setting. Replaced by “Follow-up: compaction for builders” below, which turns compaction on with a 200k window for builders. The reasoning this note first gave: no builder, reviewer or lead compacted, and the largest builder stopped at 587k, below the 967K default. A lower autoCompactWindow would summarize builders in the middle of their work, with an effect the runs can’t measure, and the fix-round rule already caps the largest resumed contexts. With autoCompactEnabled off, if that setting covers subagents, a builder that reaches the 1M window stops with a context-limit error instead of compacting.

Issue I392I392 (closed): Compaction: turn on auto-compaction for the project, a 200k window and compaction instructions for buildersBuilders never compact, and about half of a builder's context is its own thinking, which stays in context for the whole run., decided by the maintainer on 2026-10-22.

Why no builder compacted. ~/.claude/settings.json on the maintainer’s Mac has "autoCompactEnabled": false. In Claude Code 2.1.302 that setting gates every window. While it’s false, Claude Code ignores autoCompactWindow in settings and in agent frontmatter.

Where a builder’s context goes. A measurement on 2026-10-22 split the final context of the builders of I286I286 (closed): wb vm start, stop and status over a first wraithbox.hostd.v1 contractThe user can't start or stop a VM. and I374I374 (closed): Project resolution: a .git directory whose core.worktree names another project's treeThe security review of #372 (#292) found that a downloaded .git directory whose core.worktree names another project's working tree resolves to its own key, so SEC08-proj-isolation holds for the key and the identity. in run I384I384 (closed): Run 2026-10-22 (V1-M2-walking-skeleton, lane mac)/wave --waves 5 --lane mac --merge, and of six builders from the runs I314I314 (closed): Run 2026-10-16 (V1-M2-walking-skeleton, lane any)Size 4, 1 wave, lane any, milestone V1-M2-walking-skeleton (default: first open milestone in the version page's order with ready work for the lane). to I367I367 (closed): Run 2026-10-20 (V1-M2-walking-skeleton, lane mac)Approval: the maintainer typed /wave --waves 5 --lane mac --merge in this session (2026-10-20)., estimated as characters divided by 4.

Range over the eight
Final context 103k to 586k
Fixed start (system prompt, tools, AGENTS.md, agent file) 17k to 18k
Tool output 20% to 29%
The builder’s own commands and edit contents 9% to 20%
The rest, mostly thinking (inferred: transcripts keep only thinking signatures) 44% to 58%

Compaction replaces the history, thinking included, with a summary. mise and go test output is small, because builders already filter it with tail and grep, so tuning commands saves under 1%.

The plan.

  • .claude/settings.json sets "autoCompactEnabled": true and "autoCompactWindow": 500000. Main sessions, leads and reviewers compact at 500k. The decision in I392I392 (closed): Compaction: turn on auto-compaction for the project, a 200k window and compaction instructions for buildersBuilders never compact, and about half of a builder's context is its own thinking, which stays in context for the whole run. puts the leads and reviewers of these runs under about 60k when they end, a figure this note didn’t measure. If that holds, in practice the 500k window applies to main sessions.
  • .claude/agents/builder.md sets autoCompactWindow: 200000 in its frontmatter. Claude Code 2.1.302 describes that key as one that only lowers the window the subagent would otherwise inherit.
  • The body of builder.md has a ## Compact Instructions section, for builders only. The summary request tells the model to follow summarization instructions it finds in the context, with that heading as its example. It adds what the standard summary doesn’t already keep: the issue, branch, worktree and pull request, the issue’s decisions and the pull request’s “Choices made”, where each review finding stands, the “Done when” items still open, and not to revisit a choice a review approved. AGENTS.md doesn’t get the section, because only builders are expected to compact, and a lead needs other things kept.
  • No idleCompaction key. In 2.1.302 that setting can only turn idle compaction off, and true “does not turn idle compaction on”, so a true there would do nothing and mislead a reader.
  • The builder’s rule to stop after a compaction is gone. A builder carries on from the summary and reads back from the branch, the pull request and the issue what the summary doesn’t hold.

The PreCompact hook. Its input doesn’t name the subagent type in 2.1.302. The schema lists the common agent_id and agent_type fields, but the PreCompact input is built without the subagent’s context, so agent_id is absent and agent_type is set only in a main session started with --agent. A hook can’t add builder-only instructions, so the plan has none.

How to check it. Not yet confirmed: that the project setting overrides the user’s false, and that the summary request of a subagent includes its system prompt, which holds the section. The next builder that passes 200k shows both. Its transcript has a compact_boundary record, and its summary keeps the items of the section. A main session that passes 500k compacts. Whoever runs the next wave checks this and comments the result on I392I392 (closed): Compaction: turn on auto-compaction for the project, a 200k window and compaction instructions for buildersBuilders never compact, and about half of a builder's context is its own thinking, which stays in context for the whole run.. I392I392 (closed): Compaction: turn on auto-compaction for the project, a 200k window and compaction instructions for buildersBuilders never compact, and about half of a builder's context is its own thinking, which stays in context for the whole run. is closed only after that comment.

Status: Measured 2026-10-22 over 42 fix rounds of V1-M2-walking-skeletonV1-M2-walking-skeleton: Walking skeletonwb-vmd boots a fixture VM bundle in its confined process, wb-guestd answers over vsock, a data disk made on the host holds the homes, and wb shell opens a PTY as a project user, with its output through the terminal fi…. PR389PR389 (merged): docs(research): R03-fix-rounds-compaction, when to resume a builder and how agents compactAdds docs/research/R03-fix-rounds-compaction.md, measured from the session transcripts of runs #307, #314, #323, #340, #367 and waves 1 and 2 of #384, and the GitHub reviews of each pull request. applies the recommendations in commit 28ab7e2, and merging it accepts them. Follow-up 2026-10-22: I392I392 (closed): Compaction: turn on auto-compaction for the project, a 200k window and compaction instructions for buildersBuilders never compact, and about half of a builder's context is its own thinking, which stays in context for the whole run. turns compaction on, with builders at 200k, and is closed after the check that follows the merge