This repository demonstrates a fully sandboxed, iterative Claude Code workflow that repeatedly improves a codebase (in this case, a small HTML game) using the Claude Code CLI with --dangerously-skip-permissions, while still maintaining strong isolation from the host system.
The key idea is:
- Claude can aggressively modify the project
- but cannot escape the repository boundary
- and runs with enterprise credentials (Anthropic + GCP/Vertex) in a controlled way
.
├── claude-iteration/ # The actual project Claude iterates on
│ ├── wizard-platformer.html # Original starting point (the game)
│ ├── *.md / *.txt # Auto-generated features, notes, summaries
│ └── YOLO_RUN_9_SUMMARY.md # Example iteration summary
├── Dockerfile # Container definition (non-root user + Claude Code)
└── run-yolo.sh # Driver script (outside the project itself)
Everything inside claude-iteration/ is treated as mutable input/output for the agent.
Everything outside it is control infrastructure.
-
Docker sandbox
- A Docker image installs:
- Node 18
@anthropic-ai/claude-code- git
- A non-root user is created (
llm) so Claude allows--dangerously-skip-permissions.
- A Docker image installs:
-
Strict filesystem boundary
- Only
claude-iteration/is mounted as/workspace(read/write). - The driver script (
run-yolo.sh) is mounted read-only. - Credentials are mounted explicitly (Claude + GCP), nothing else.
- Only
-
Iteration loop
run-yolo.sh:- Invokes Claude with a fixed prompt
- Lets Claude modify files freely inside
/workspace - Commits each change automatically
- Repeats for N iterations
-
Result
- A fast, autonomous “YOLO loop” that evolves a project over time
- Full git history preserved
- No risk of Claude touching unrelated host files
On the host machine:
- Docker
- Node 18+ (only needed if you want to run Claude locally)
- Claude Code CLI login completed once:
npm install -g @anthropic-ai/claude-code claude
- GCP credentials set up for Vertex:
gcloud auth application-default login
The Dockerfile must:
- Install Claude Code
- Run as a non-root user
This is required because Claude Code explicitly refuses
--dangerously-skip-permissions when run as root.
From the repo root:
docker build -t claude-code-yolo .Then run:
docker run --rm -it -v "$PWD/claude-iteration:/workspace" -v "$PWD/run-yolo.sh:/home/llm/run-yolo.sh:ro" -v "$HOME/.claude:/home/llm/.claude:rw" -v "$HOME/.claude.json:/home/llm/.claude.json:ro" -v "$HOME/.config/gcloud:/home/llm/.config/gcloud:ro" -w /workspace claude-code-yolo bash -lc "/home/llm/run-yolo.sh /workspace"What this does:
- Claude runs with your existing credentials
- GCP/Vertex works via Application Default Credentials
- Claude can only read/write
/workspace
Key properties:
- Lives outside the project being modified
- Never committed by Claude
- Fully deterministic loop
Typical flow per iteration:
- Call Claude with a fixed prompt
- Stage all changes
- Commit if anything changed
- Repeat
This setup intentionally uses --dangerously-skip-permissions.
Safety comes from:
- Docker filesystem isolation
- Non-root execution
- Explicit credential mounts
- No host home directory access
Claude cannot:
- Read arbitrary host files
- Access SSH keys
- Modify anything outside
/workspaceand mounted credential directories
- Clone the repo
- Create their own
claude-iteration/project (any codebase) - Log into Claude Code once on the host
- Ensure GCP ADC is configured (if using Vertex)
- Build the Docker image
- Run the container command above
That’s it.
- Rapid autonomous refactoring
- Game or prototype evolution
- Stress-testing ideas
- Generating alternative implementations
- Exploring “what if we let the agent loose?” safely
Use responsibly.