Sandboxing
Fencing in the files and that commands can reach. See what it is, how it works, how it is used and what to watch for, with pictures and examples.
What it is
Sandboxing puts a fence around the commands runs, and the itself guards that fence. You decide which folders the commands can write to and which domains they can reach. By default, commands can write only in the working folder, a temp folder and folders you added, and network traffic goes through a whose allowed-domain list starts empty. Because the operating system holds the fence even if a command does more than its name suggests, can run sandboxed commands without asking you each time. It works on , and WSL2, and it is off until you turn it on.
How it works
-
Run /sandbox in a session
-
Pick auto-allow or regular
-
Commands run inside the fence
-
Approve new network domains when asked
How to use it
-
/sandboxopens the sandbox panel with Mode, Overrides and Config tabs.
-
sandbox.enabledset totruein~/.claude/settings.jsonturns the sandbox on for all your projects.
-
sandbox.network.allowedDomainsthe domains Bash commands may reach.
sandbox.filesystem.allowWriteadds folders they may write to. -
"allowUnsandboxedCommands": falsestrict sandbox mode. Claude can no longer retry a failed command outside the sandbox.
Watch out
The sandbox covers shell commands only. Claude's Read, Edit and WebFetch tools, and hooks run outside it and follow permission rules instead, which are a separate layer. It is also not the same as auto mode, and it is not a complete wall — allowing a broad like github.com can open a path for to leak, and if the sandbox can't start, commands run unsandboxed unless you set sandbox.failIfUnavailable.
Related terms
Original and official docs
This page explains the term in plain words. The original is the authority: if they differ, follow the original.
- See this term in the originalClaude Code Docs — Glossary Anthropic · checked 2026-10-19
- Anthropic — Claude Code docs: Configure the sandboxed Bash tool — What the sandbox restricts(opens in a new window)
- Anthropic — Claude Code docs: Configure the sandboxed Bash tool — Sandbox modes(opens in a new window)
- Anthropic — Claude Code docs: Configure the sandboxed Bash tool — How sandboxing relates to permissions and permission modes(opens in a new window)
- Anthropic — Sandboxing(opens in a new window)
Loading…
Choose a pending booking to cancel. Each cancellation requires confirmation.
Your :