Pinning your coding agent to a reproducible container
The fastest way to lose an afternoon is to let a coding agent accumulate state on a machine you can’t rebuild. Treat the agent’s home as cattle, not a pet.
Here’s the minimal container entrypoint — note the volume mount that survives a rebuild while everything else stays disposable:
#!/usr/bin/env bashset -euo pipefail
# Only this path persists. Wipe the container freely; config survives.docker run --rm -it \ -v "$HOME/.agent:/root/.agent" \ agent-image:latestThe flags do the work: --rm throws the container away on exit, and the single
-v mount keeps the one directory that actually holds configuration.
If you’re migrating an existing setup, the change is usually this small:
docker run -it -v "$HOME:/root" agent-image:latestdocker run --rm -it -v "$HOME/.agent:/root/.agent" agent-image:latestMounting your whole home directory feels convenient until the agent writes somewhere you didn’t expect. Scope the mount down and the blast radius shrinks to a single folder you can inspect in version control.