Compare Updated

Claude Code's sandbox vs Stashbase

They solve different problems. Claude Code's built-in sandbox is containment: it limits what shell commands can write and which hosts they can reach. Stashbase is access control for coding agents: an agent profile decides which credentials the agent can use, for which API requests, and which MCP tools it can call with which arguments. The agent only ever holds placeholders.

1.0At a glance

Claude Code's sandbox vs Stashbase

Purpose
Claude Code's sandbox Contain shell commands
Stashbase Control what the agent can access
Credentials
Claude Code's sandbox Removed, or masked (experimental) per host
Stashbase Placeholders, real value added per matching request
API rules
Claude Code's sandbox Per host
Stashbase Host, method, path and JSON body
MCP tools
Claude Code's sandbox On or off by name
Stashbase Allowed tools plus rules on arguments
Secret scanning on agent commits
Claude Code's sandbox No
Stashbase Yes, blocks the commit
Where agents run
Claude Code's sandbox Where Claude Code runs
Stashbase Your laptop, your server or a VM for agents
Sandbox
Claude Code's sandbox Shell commands, off by default
Stashbase Whole agent, every run, can't be switched off
Agents
Claude Code's sandbox Claude Code
Stashbase Claude Code and Codex

2.0In detail

Where they differ

This comparison is based on Anthropic’s sandboxing and permissions docs as of December 2026.

What Claude Code’s sandbox does

Claude Code ships with an OS-level sandbox for shell commands, using Seatbelt on macOS and bubblewrap on Linux and WSL2. It’s off by default; you turn it on with /sandbox or in your settings.

When it’s on, writes are limited to the working directory and folders you add, shell network traffic goes through a local proxy with a host allow list, and credentials in environment variables can be removed, or experimentally masked, for sandboxed commands. Permission rules such as Read(./.env) and mcp__server__tool control Claude Code’s own tools.

It’s a real improvement over running with nothing. But it’s built to contain commands, and the docs are clear about what it leaves to you:

  • File tools, MCP servers and hooks run outside the sandbox.
  • Claude can step outside it. A command that fails in the sandbox can be retried unsandboxed unless you set allowUnsandboxedCommands to false.
  • Network rules are per host. Once api.stripe.com is allowed, every method and path is: a key allowed to look up customers can also issue refunds.
  • MCP tools are on or off by name, and the servers run with your full access.
  • Nothing checks what the agent ships, like a hard-coded key in its commits.

What Stashbase adds

You write an agent profile once, and every run is held to it. Swap claude for codex and the same profile applies:

stashbase agent run --profile local -- claude

Credentials the agent never sees

The agent holds a placeholder. The Stashbase Agent Proxy adds the real credential only when a request matches a rule on host, method, path and values in the JSON body:

[[secrets.STRIPE_API_KEY.rules]]
effect = "allow"
hosts = ["api.stripe.com"]
methods = ["GET"]
paths = ["/v1/customers/*"]

GET /v1/customers/cus_123 goes through with the real key. POST /v1/refunds is blocked, and the placeholder is useless anywhere else.

MCP rules down to the arguments

For HTTP and stdio MCP servers, the agent sees only the tools you allow, and a tool can be allowed only with specific arguments:

[[mcp_servers.linear.tool_rules]]
effect = "allow"
tools = ["save_issue"]
arguments = { team = ["Engineering"], id = { absent = true } }
allow_fields = ["title", "description", "priority"]

The agent can create Linear issues in the Engineering team with a title, description and priority. It can’t edit existing issues, post to other teams or set any other field.

Every agent commit scanned for secrets

With allow_hooks = ["secret_scan"] in the profile, every commit the agent makes is scanned with AI-based secret detection and blocked if it contains a key. Package installs through npm, Bun, pnpm and Yarn can be checked for vulnerable packages the same way.

Run it anywhere, keys off the machine

The same profile runs on your laptop, your own server over SSH, or a VM for agents: a managed machine with Claude Code and Codex preinstalled that keeps working after you disconnect. With the remote proxy, real keys are added on Stashbase servers and never reach the machine the agent runs on.

Enforced on every run

Every run is sandboxed, natively or in Docker. The agent can’t go around the proxy, can’t read files the profile denies, and can’t switch the sandbox off. If no sandbox is available, Stashbase refuses to start. Metadata-only audit logs record every allowed and blocked request.

For everything else, including per-secret history, personal credentials and repository scans, see how Stashbase works or read why coding agents need access control.

3.0Which to use

Pick the tool for the job

Use Stashbase when

  • Your agent uses real API keys and you want reads allowed but writes blocked.
  • You connect MCP servers and want limits on which tools and arguments the agent can use.
  • The agent runs unattended, on your laptop, a server or a VM for agents.
  • You don't want real keys on the machine the agent runs on.
  • You run Claude Code and Codex and want one policy for both.

Use Claude Code's sandbox when

  • The agent has no credentials worth protecting.
  • You're watching the session and approving its steps.
  • You only want shell commands kept away from the rest of your machine. You can still add Stashbase later: it doesn't turn off Claude Code's own settings.

Let your agents do more, starting today.

Sandboxing, the local proxy, unlimited profiles and code and package scans are free forever. VMs for agents come with a 10-hour free trial.

More comparisons: HashiCorp Vault