by PACHAKUTlQ
Claude Code running in sandbox. Packed as single portable executable with no dependency. Has better performance than official version.
# Add to your Claude Code skills
git clone https://github.com/PACHAKUTlQ/ClaudeCageRun the SOTA AI coding agent in a portable, secure sandbox.
Claude Code is a state-of-the-art AI coding assistant. Unfortunately, its CLI is distributed as closed-source and obfuscated javascript. You don't know what it's doing. Is it reading your SSH keys? Is it indexing your photos? Is it planning some Skynet world domination from your ~/Downloads folder?
Probably not... but why risk it?
ClaudeCage solves this by packaging the Claude Code CLI into a fully isolated, single-file container. It cannot access any part of your system except for the single project directory you are currently working in.
Breaking change: the build output is now named
claude(plusclaude.rcfg), so it can act as a drop-in replacement for the originalclaudeCLI (but sandboxed).
claude process is heavily restricted and cannot access your home directory, network information, or other processes.claude binary, the bun runtime, and all dependencies—is packed into a single executable file. Download it, make it executable, and run it.node, , or anything else installed on your system.No comments yet. Be the first to share your thoughts!
bun/usr, /etc, /opt) are mounted read-only so Claude can use your existing compilers/tools without being able to modify them.ClaudeCage is built using the RunImage project, which leverages Bubblewrap to create lightweight, unprivileged containers. This project provides a simple build script to automate the creation of a custom RunImage container specifically for Claude Code.
Download claude binary and claude.rcfg config file, copy both files to a location in your ${PATH}, like ~/.local/bin/.
First, clone the repository. The build script has no dependencies other than curl and standard coreutils.
git clone https://github.com/your-username/ClaudeCage.git
cd ClaudeCage
./build.sh
The script will download the necessary components and create two files in the current directory:
claude: The portable executable.claude.rcfg: The sandbox configuration file.Move both the claude executable and the .rcfg file to a location in your ${PATH}, like ~/.local/bin/.
mv claude claude.rcfg ~/.local/bin/
Now, you can use it just like the regular claude command. Navigate to any project directory and run it. It will only have access to that directory.
cd /path/to/my/awesome-project
claude "Refactor this function to be more efficient." # Claude now has access to this directory only
claudeBecause the output is named claude, installing it into your ${PATH} will likely override your original claude. (Not necessarily replace, as the recommendation is put claude and claude.rcfg in ~/.local/bin instead of /usr/bin.)
If you want to keep both, rename the pair to the same basename (the .rcfg must match the executable name):
mv claude claude-cage
mv claude.rcfg claude-cage.rcfg
./claude-cage "Hello from sandbox"
You can edit claude.rcfg to customize what the sandbox can see. The default config is designed to be usable out-of-the-box while keeping sensitive host data out.
Persisted Claude state (host):
${HOME}/.claude/ (mode 700)${HOME}/.claude.json (mode 600)${HOME}/.claude.json (read-write)${HOME}/.claude/ (read-write)Project directory:
Host system/tooling (read-only):
/usr, /opt, /etc/lib, /lib64, /bin, /sbinSSH (safe-by-default):
SSH_AUTH_SOCK is set, ClaudeCage forwards only the agent socket into the sandbox (no direct access to your ${HOME}/.ssh by default).CLAUDECAGE_ALLOW_SSH_KEYS=1 claude "Clone and inspect this repo."
Extra isolation knobs enabled by default:
If you want to route Claude Code requests to other providers/models (OpenRouter, DeepSeek, Ollama, Gemini, etc.), use the external project Claude Code Router:
This is not part of ClaudeCage. Please refer to its README for full configuration details.
Minimal usage:
npm install -g @musistudio/claude-code-router
ccr code
Because ClaudeCage installs a claude binary into your ${PATH} (drop-in replacement), when Claude Code Router runs claude, it will automatically invoke the sandboxed ClaudeCage claude.
claude-code-router ccr code auto configures env variables and invokes Claude Code. If you like the manual way or don't want to use claude-code-router, you can make Claude Code use a custom API endpoint by setting the following environment variables before running ClaudeCage:
export ANTHROPIC_BASE_URL="http://localhost:3456/"
export ANTHROPIC_AUTH_TOKEN="not-needed-when-using-local-proxy"
export ANTHROPIC_MODEL="anthropic/claude-sonnet-4"
export ANTHROPIC_SMALL_FAST_MODEL="google/gemini-2.0-flash"
claude "What is the capital of Nebraska?"
See the official claude-code settings documentation for more details.
This project would be impossible without the fantastic work of the following open-source tools: