Claude Code sandbox runtime: isolate the whole session
The runtime wraps an entire process in the same Seatbelt or bubblewrap isolation the built-in Bash sandbox uses, so the boundary covers more than the shell.
Last checked against Anthropic's documentation on November 26, 2026. By the Omniscio team. Updated .
Why a whole-process sandbox
The sandboxed Bash tool constrains only shell commands: Bash, PowerShell and Monitor commands, and the processes they start. Claude's file and web tools follow permission rules instead, and MCP servers, command hooks and plugin monitors are separate processes that run unconstrained on the host.
To put built-in tools, MCP servers and hooks all behind one operating-system boundary, run the whole Claude Code process inside the sandbox runtime, a dev container, or a custom container.
The @anthropic-ai/sandbox-runtime package wraps an entire process in the same Seatbelt or bubblewrap isolation that the built-in Bash sandbox uses. Running Claude Code through the runtime constrains the session's tools, hooks and MCP servers as well as shell commands.
The runtime is a beta research preview, and its configuration format may change as the package evolves. The same srt command works for sandboxing standalone MCP servers or other helper processes.
For the built-in sandbox and the failures it causes, see the sandbox guide. For a Docker container that runs Claude Code, see the Docker and dev-container guide.
What you need first
On Linux and WSL2, the runtime relies on the same bubblewrap and socat packages as the built-in sandbox, plus ripgrep. Claude Code bundles ripgrep, but the standalone runtime resolves it from your PATH, so install it from your distribution's package manager.
On macOS, Anthropic's documentation says you need no additional packages and the runtime uses the built-in Seatbelt sandbox. The package README's dependency section separately lists ripgrep on macOS for deny-path detection, so install it if you rely on those denies.
Anthropic's setup steps are written for Linux, WSL2 and macOS. For a native Windows host, the docs point to a container or virtual machine, or the Bash sandbox inside WSL2, covered on the WSL setup page. The package README also documents alpha native-Windows support through a bundled srt-win.exe helper and a one-time windows-install step run as administrator.
Install it, then write the settings file
Install the runtime globally, under a prefix outside every path you allow writes to. Run npm config get prefix to see where that is on your machine:
npm config get prefix
npm install -g @anthropic-ai/sandbox-runtimeBy default the runtime denies network access and confines writes to a small set of built-in runtime paths, so configure it before launching Claude Code through it. Put your configuration in ~/.srt-settings.json, or in a file you pass with --settings. The package README documents the configuration schema.
Allow write access to at least these paths:
- Your project directory.
- Claude Code's configuration paths,
~/.claudeand~/.claude.json. - The directory where Claude Code writes runtime files. Unless you set
CLAUDE_CODE_TMPDIR, that directory is/tmpon Linux and WSL2, or/private/tmpon macOS. On macOS,/tmpis a symlink to that directory, and Seatbelt checks the resolved path.
Allow the network domains your session needs: api.anthropic.com or your configured provider's endpoint, and claude.ai and platform.claude.com for OAuth sign-in and token refresh. Runs authenticated with an API key can drop the last two. On a third-party provider, keep api.anthropic.com as well, because the WebFetch domain safety check still calls it by default unless you set skipWebFetchPreflight.
The settings file takes a filesystem object and a network object. This configuration for a Linux or WSL2 project also denies writes to the settings and configuration folders a sandboxed session could use to persist hooks, commands, agents or skills:
{
"filesystem": {
"denyRead": [],
"allowWrite": [".", "~/.claude", "~/.claude.json", "/tmp"],
"denyWrite": [
"~/.claude/settings.json",
"~/.claude/settings.local.json",
"~/.claude/hooks",
"~/.claude/commands",
"~/.claude/agents",
"~/.claude/skills"
]
},
"network": {
"allowedDomains": ["api.anthropic.com", "claude.ai", "platform.claude.com"],
"deniedDomains": []
}
}The . in allowWrite is the directory you launch the runtime from, so start srt in the project root. On macOS, use /private/tmp in place of /tmp. denyWrite takes precedence over allowWrite.
The other two lists work differently. Reads are allowed everywhere by default, so denyRead narrows them and a more specific deny still wins inside a re-allowed region. Network access is denied by default, so allowedDomains is the only way in; deniedDomains subtracts from that list.
On Linux and WSL2, the runtime applies write grants only to paths that already exist. In a fresh environment, create Claude Code's configuration paths before the first launch:
mkdir -p ~/.claude && { [ -f ~/.claude.json ] || echo '{}' > ~/.claude.json; }Launch Claude Code inside it
Once the settings file is in place, launch Claude Code through the runtime from your project directory:
srt claudeClaude Code starts inside the sandbox with the filesystem and network boundaries you configured. To use a different settings file, pass srt --settings /path/to/srt-settings.json claude. Add --debug to watch the runtime's own decisions.
What the runtime blocks on its own
The runtime blocks the highest-risk writes without any configuration from you, and denyWrite takes precedence over allowWrite. At the project root it denies .git/hooks, denies .git/config unless you set filesystem.allowGitConfig: true, and denies .mcp.json, .claude/commands, .claude/agents and shell startup files.
Set filesystem.allowGitConfig when a tool inside the session has to write .git/config, such as a git config change or a command that adds a remote. Without it, those writes are refused. The README's mandatory deny list is broader than the paths above; it also covers shell startup files, .gitconfig, .gitmodules and IDE folders such as .vscode and .idea.
On macOS, these denies are checked when a write happens, so they also cover nested files and repositories created during the session. On Linux and WSL2, the runtime builds the deny list once at launch. It reliably covers the project root, makes a best-effort shallow scan for nested copies that exist at that point, and does not cover anything the session creates later, such as git init, git clone or scaffolding.
Your write grants include other paths Claude Code loads configuration from, so deny those with denyWrite. A sandboxed session that can write them can persist hooks, permission rules or MCP servers that run unsandboxed the next time you launch Claude Code.
The defaults, and when it refuses to start
If ~/.srt-settings.json does not exist and you do not pass --settings, the runtime starts anyway. It blocks network access and confines writes to built-in runtime paths such as /tmp/claude, ~/.npm/_logs and ~/.claude/debug. A clean start is not proof that your settings loaded.
If the settings file exists but is empty, unreadable or invalid, the runtime refuses to start, whether it is ~/.srt-settings.json or a file you pass with --settings. It also refuses to start if the --settings file does not exist. With no settings file at all, the defaults apply: no network access, no writes outside the default write paths, and unrestricted reads.
After an unattended run
Review the paths you kept writable. On Linux and WSL2, also review anything the session created, because the deny list was built once at launch.
An isolation boundary is what protects the machine when a session runs with --dangerously-skip-permissions. On Linux and macOS, Claude Code refuses to start with that flag as root, so run the container, virtual machine or sandbox runtime as a non-root user.
Auto mode uses a classifier that reviews actions. The classifier is a per-action control, so an isolation boundary still adds defense in depth for unattended runs, and it is not required the way it is for --dangerously-skip-permissions.
Common mistakes
- Launching before writing the settings file. The runtime starts with its own defaults, not yours, and a clean start does not prove your file loaded.
- Allowing write access to a path that does not exist yet on Linux. Write grants apply only to paths that already exist there, so create the Claude Code configuration paths first.
- Leaving
~/.claudewritable without denying the settings inside it. A session that can write the configuration paths can persist hooks, permission rules or MCP servers that run unsandboxed next time. - Assuming the deny list covers files created later on Linux. The list is built once at launch, and a nested repository created during the session is outside it.
- Installing the runtime under an allowed write path. Install it under a prefix outside every path you allow, so the session cannot rewrite its own sandbox.
How to confirm it is running
srt --debug claudeprints the runtime's decisions as the session starts.- Inside the session,
toucha path outside the ones you allowed. The operating system refuses it, which is the boundary working. - Inside the session,
curl -sS https://example.comfails whilecurl -sS https://api.anthropic.comanswers, which shows the network allowlist is in force.
Where these answers come from
- Anthropic's sandbox environments page, read November 26, 2026: what the built-in sandbox covers, the runtime's scope and beta status, its requirements, the paths and domains to allow, the built-in denies, the Linux and macOS differences, and the defaults and refusals.
- The sandbox-runtime repository README, read November 26, 2026: the
filesystemandnetworksettings shape, the--settingsand--debugflags, and the behavior when the settings file is absent or invalid.
Common questions
What does the sandbox runtime add over the built-in Bash sandbox?
The built-in sandbox constrains only Bash, PowerShell and Monitor commands. The runtime wraps the whole Claude Code process, so its tools, hooks and MCP servers run inside the same operating-system boundary.
How do I launch Claude Code through the sandbox runtime?
Install the package globally with npm install -g @anthropic-ai/sandbox-runtime, write ~/.srt-settings.json, then run srt claude from your project directory.
What happens if the settings file is missing or invalid?
With no ~/.srt-settings.json the runtime starts with built-in defaults: no network access and writes confined to its own runtime paths. A settings file that exists but is empty, unreadable or invalid makes the runtime refuse to start.
Does the sandbox runtime work on Windows?
Anthropic's setup steps are written for Linux, WSL2 and macOS; for a native Windows host the docs point to a container or virtual machine, or the Bash sandbox inside WSL2. The package README also documents alpha native-Windows support through a bundled srt-win.exe helper and a one-time windows-install step run as administrator. On Linux and WSL2 it needs bubblewrap, socat and ripgrep; on macOS it uses the built-in Seatbelt sandbox.