Ask every container to clean up test artifacts and build caches #88

Merged
jknapp merged 1 commits from feat/cleanup-instructions into main 2026-11-29 22:23:12 +00:00
Owner

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

## 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)
jknapp added 1 commit 2026-11-29 21:40:58 +00:00
feat(container): ask every container to clean up test artifacts and build caches
Secret Scan / scan (push) Successful in 15s
Build App (Preview) / compute-version (pull_request) Successful in 6s
Secret Scan / scan (pull_request) Successful in 7s
Build App (Preview) / create-release (pull_request) Successful in 2s
Build App (Preview) / build-macos (pull_request) Successful in 7m11s
Build App (Preview) / test (pull_request) Failing after 11m31s
Build App (Preview) / build-linux (pull_request) Successful in 26m2s
Build App (Preview) / build-windows (pull_request) Successful in 26m46s
Build App (Preview) / prune-previews (pull_request) Successful in 13s
479e2c1b5b
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 main 2026-11-29 22:23:12 +00:00
jknapp deleted branch feat/cleanup-instructions 2026-11-29 22:23:12 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CyberCoveLLC/Triple-C#88