The Docker daemon every container uses is the host's. It is shared with the user's other work, and nothing prunes it. On one machine it reached about 1.35 TB: 511 GB volumes, 496 GB container layers, 203 GB images, 140 GB build cache. A single project home volume held 258 GB of ~/.cache/go-build, and test images from finished PRs were left behind, about 5 GB each.
What
New built-in CLEANUP_INSTRUCTIONS section in docker/container.rs. It is appended to every container's CLAUDE.md, next to the file-link section, whatever the global or project instructions say.
It asks Claude to remove the Docker test containers, images, volumes and networks it created, to prune the build cache after builds, to clear language caches (go clean -cache, cargo clean, npm), and to remove finished worktrees and temp files.
It names what must never be touched: triple-c-* containers, triple-c-snapshot-* and triple-c-sandbox images, and triple-c-home-* and triple-c-claude-config-* volumes. It also says not to remove anything Claude didn't create, and to ask when unsure.
The section is part of the instructions fingerprint, so each container is recreated once on its next start (the same as when the file-link section was added).
The app-side gaps (orphaned home volumes, cache growth, old tagged sandbox images) are tracked separately in the companion issue.
cargo test --lib docker::container::tests: 77 passed.
## Why
The Docker daemon every container uses is the host's. It is shared with the user's other work, and nothing prunes it. On one machine it reached about 1.35 TB: 511 GB volumes, 496 GB container layers, 203 GB images, 140 GB build cache. A single project home volume held 258 GB of `~/.cache/go-build`, and test images from finished PRs were left behind, about 5 GB each.
## What
- New built-in `CLEANUP_INSTRUCTIONS` section in `docker/container.rs`. It is appended to every container's CLAUDE.md, next to the file-link section, whatever the global or project instructions say.
- It asks Claude to remove the Docker test containers, images, volumes and networks it created, to prune the build cache after builds, to clear language caches (`go clean -cache`, `cargo clean`, npm), and to remove finished worktrees and temp files.
- It names what must never be touched: `triple-c-*` containers, `triple-c-snapshot-*` and `triple-c-sandbox` images, and `triple-c-home-*` and `triple-c-claude-config-*` volumes. It also says not to remove anything Claude didn't create, and to ask when unsure.
- Test: `every_container_is_asked_to_clean_up_and_to_spare_the_apps_own_resources`.
## Effect
The section is part of the instructions fingerprint, so each container is recreated once on its next start (the same as when the file-link section was added).
The app-side gaps (orphaned home volumes, cache growth, old tagged sandbox images) are tracked separately in the companion issue.
`cargo test --lib docker::container::tests`: 77 passed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The host's Docker daemon is shared and never pruned for the user. Leftover
test images, build cache and language caches from finished work reached
~1.35 TB on one machine (one home volume held 258 GB of go-build cache).
Add a built-in CLEANUP_INSTRUCTIONS section, appended to every container's
CLAUDE.md like the file-link section, naming what to clean and the app's own
resources (triple-c-* containers, snapshot/sandbox images, home/config
volumes) that must never be touched.
Part of the instructions fingerprint, so each container is recreated once on
its next start.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jknapp
merged commit 31641eaf51 into main2026-11-29 22:23:12 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
The Docker daemon every container uses is the host's. It is shared with the user's other work, and nothing prunes it. On one machine it reached about 1.35 TB: 511 GB volumes, 496 GB container layers, 203 GB images, 140 GB build cache. A single project home volume held 258 GB of
~/.cache/go-build, and test images from finished PRs were left behind, about 5 GB each.What
CLEANUP_INSTRUCTIONSsection indocker/container.rs. It is appended to every container's CLAUDE.md, next to the file-link section, whatever the global or project instructions say.go clean -cache,cargo clean, npm), and to remove finished worktrees and temp files.triple-c-*containers,triple-c-snapshot-*andtriple-c-sandboximages, andtriple-c-home-*andtriple-c-claude-config-*volumes. It also says not to remove anything Claude didn't create, and to ask when unsure.every_container_is_asked_to_clean_up_and_to_spare_the_apps_own_resources.Effect
The section is part of the instructions fingerprint, so each container is recreated once on its next start (the same as when the file-link section was added).
The app-side gaps (orphaned home volumes, cache growth, old tagged sandbox images) are tracked separately in the companion issue.
cargo test --lib docker::container::tests: 77 passed.🤖 Generated with Claude Code