Runs a coding agent, Codex or Claude Code, in an isolated Docker Compose
session for one project at a time. The agent can change only that project,
optionally reads a reference folder of your choice, reaches the Internet only
through an allowlisting proxy, and gets its own rootless Docker daemon instead of the
host's. A project needs only Docker with Compose 2.30 or newer and a
.sandbox/ folder; the images and the Compose file are published from this
repository.
ai-coding-sandbox/
├── AGENTS.md # Rules for agents developing this repository
├── CLAUDE.md # Imports AGENTS.md for Claude Code
├── sandbox/ # Images, Compose file, host tools, tests and documentation
└── src/ # Optional, ignored place for your own project checkouts
To install or update, run this in the bash or zsh terminal you use:
curl -fsSL https://raw.githubusercontent.com/bryanwieg/ai-coding-sandbox/main/install.sh | shIt downloads the shell functions (no clone needed), creates the shared state
volumes, and sources the functions once from that shell's startup file
(~/.zshrc or ~/.bashrc). Open a new terminal, or run the . command it
prints, to load them. After that, each agent launch keeps the installed
functions current and loads an update into the running shell; rerunning the
installer also updates them.
Then, from a project's root folder:
sandbox-init # once: create .sandbox/ (settings, egress policy, SSH);
# sandbox does this for you (and stages it in a Git repo)
sandbox # approve egress, unlock SSH if enabled, start Claude Code
sandbox codex # or Codex
sandbox-trust # review and approve egress; applies to running sessions at once
sandbox-unlock # manually unlock or reload SSH keys, when needed
sandbox-prune # remove superseded sandbox images; runs after each sessionsandbox prepares approval and SSH through Compose, then runs
docker compose --env-file .sandbox/env run --rm claude. The functions are
optional; direct Compose launches require manual approval and unlocking.
Each agent signs itself and GitHub in on first use.
Sign-ins, sessions, memory and plugins are shared by all projects.
Each project's services start with its first session and stop shortly after
its last, and you can inspect or stop the group with sandbox-status or
sandbox-stop.
sandbox/README.md covers project settings, the egress
policy, Docker and published ports, SSH, authentication, plugins, migrating
from the retired run-sandbox launcher, troubleshooting, releases, and
developing the sandbox. Agents in a session get the sandbox's guide and rules
from the image: sandbox/image/session-guide.md
and sandbox/image/session-rules.md.
sandbox/bin/check-sandbox # structural checks, before every commit
sandbox/bin/audit-sandbox # runtime audit, after boundary changes