All pages
Protect
Shell jail and sandbox
A kernel jail around every shell command an agent runs, and a throwaway VM for work that reads what a stranger wrote.
Rules decide whether a call runs. These two decide what a call can reach once it does. The shell jail wraps every shell command your agents run (Claude Code, Codex, Gemini CLI, Cursor, Copilot CLI, Antigravity, Hermes and OpenClaw), so a command an agent was talked into still cannot read your keys or switch Golem off. The sandbox gives an agent somewhere else to do the riskiest work: reading a page from an issue, running a repository from a pull request, opening a download nobody vetted.
| Shell jail | Sandbox | |
|---|---|---|
| Runs | every shell command an agent runs: Claude Code, Hermes and OpenClaw on every system, and Codex, Gemini CLI, Cursor, Copilot CLI and Antigravity on macOS and Linux (details) | when an agent calls sandbox_browse, sandbox_run or sandbox_open |
| Boundary | the operating system's own kernel sandbox (Seatbelt on macOS, Landlock and seccomp on Linux, a restricted token on Windows), around the command and everything it starts | a throwaway Linux VM per task, on the same machine |
| Keeps | your real toolchain, repositories, ssh, git signing, Docker, cloud CLIs | nothing of yours beyond what the agent hands over |
| Needs | macOS, Linux 5.13 or later, or Windows (Git for Windows for Claude Code) | Apple silicon with macOS 26 or later, Linux with KVM, or Windows with Hyper-V; Claude Code installed |
| Default | on | on, once installed |
The shell jail#
What you do#
Nothing, on a Mac or with install.sh on Linux. (To use the jail without the Golem agent, see Free tools.) The installer puts Golem's shell into ~/.golem/bin and points Claude Code at it by setting CLAUDE_CODE_SHELL in the env block of ~/.claude/settings.json (to golem-zsh, or golem-bash if your login shell is bash). If you already set CLAUDE_CODE_SHELL to something else, Golem leaves it alone and the jail does not apply; golem doctor is the place to check. Restart Claude Code after installing so it picks the setting up.
The other agents have no setting that names their shell, so golem setup-client reaches them another way: the Golem hook it already installs in Codex, Gemini CLI, Cursor, Copilot CLI and Antigravity rewrites each shell command to run through Golem's shell, and the Golem plugin does the same in Hermes and OpenClaw. What the jail does not cover lists where each agent is covered.
On Windows, Claude Code runs its Bash tool with Git Bash, so the jail needs Git for Windows. The installer puts Golem's shell beside golem.exe, and golem setup-client, which the installer runs for you and each other person runs in their own session, copies it to ~\.golem\bin\bash.exe and sets CLAUDE_CODE_GIT_BASH_PATH to it. It also turns Claude Code's PowerShell tool off (CLAUDE_CODE_USE_POWERSHELL_TOOL=0), because commands run through PowerShell would never reach the jail. If you set either variable yourself, Golem leaves it alone.
How it works#
Before each command starts, Golem's shell asks the Golem agent on the machine for this session's policy, turns it into the kernel's sandbox rules (a sandbox profile on macOS, a Landlock ruleset and a seccomp filter on Linux, a restricted token on Windows) and applies them to the shell process itself. The command string is never parsed or rewritten. Because the jail is on the process, everything the command starts inherits it: an absolute /bin/bash, nohup … &, python -c, a script piped to sh.
flowchart TD
A["An agent's shell command"] --> S["Golem's shell"]
S -- "session policy?" --> G["Golem agent"]
G -- "clean or locked down, grants" --> S
S --> Z["the command, inside the kernel sandbox"]
Z -. "refusals" .-> G
G --> L[("Signed record")]
What a command cannot do#
| Read | Private keys, judged by their contents rather than their names, so a key called google_compute_engine or a deploy key is covered. Shell history (~/.zsh_history, ~/.bash_history, ~/.zsh_sessions), ~/.netrc, ~/.git-credentials, GnuPG private keys and ~/.golem. |
| Still read | The rest of ~/.ssh: config, included files, known hosts and public keys, so ssh keeps working. |
| Write | Your shell profiles (~/.zshrc, ~/.bashrc, ~/.profile and the rest), ~/.gitconfig, ~/Library/LaunchAgents (on Linux ~/.config/systemd, ~/.config/autostart and ~/.config/environment.d; on Windows the Startup folder, PowerShell profiles and the Run, RunOnce, Environment and cmd.exe AutoRun registry keys), ~/.ssh, ~/.golem, Claude Code's settings and hooks, Cursor's hooks and MCP files, the other agents' hook files the jail is attached by, VS Code's user settings, and on macOS and Windows the agents' hook, MCP and settings files at the root of the repository and in each folder down to where the command runs (.claude/settings.json, .mcp.json, .cursor/, .gemini/settings.json, .devin/, .codex/, .agents/, .github/hooks, .github/copilot, .vscode/settings.json), whose folders can't be created or renamed there either; on Linux, wherever the jail can make its own namespace (on Ubuntu after sudo golem-exec apparmor install), the ones that exist, any missing inside their folders, which then take nothing new, and each agent's folder (.claude, .cursor, .github, …), made empty when it is missing. A hijacked command cannot switch Golem off or leave something behind to run at the next login. |
| See | Environment variables whose names look like secrets (containing TOKEN, SECRET, PASSWORD, API_KEY, CREDENTIAL, ACCESS_KEY, COOKIE and similar, or starting GH_, GITHUB_, ANTHROPIC_, OPENAI_) are stripped before the command starts. |
What keeps working#
Three grants, each on by default, keep normal development working. An owner or admin can turn each one off.
| Grant | What it allows | Turned off |
|---|---|---|
| SSH agent and keychain | git push, gh, commit signing, through the ssh agent and keychain. The key files stay unreadable either way. | The agent socket, the keychain and gh's token file are denied. |
| Docker | The Docker socket (Docker Desktop, OrbStack, Rancher, Colima). | Denied. Worth considering: a container can mount the machine, which gets around the jail. |
| Cloud credentials | ~/.aws, ~/.config/gcloud, ~/.kube, ~/.azure, registry credentials in ~/.docker/config.json, ~/.npmrc, ~/.pypirc, and their environment variables. | Denied, and the variables are stripped. |
Two lists adjust the stripping: Let these variables through (for example NPM_TOKEN, or a prefix like MYCO_*) and Always strip these variables. Strip wins over let through.
Lockdown#
A rule can respond by locking a session down. From then until a fresh session starts, every shell command in it runs with:
- no network at all, localhost and DNS included;
- no grants: no ssh agent, keychain, Docker or cloud credentials, and the let-through list ignored;
- writes only inside the repository it is working in and its own temporary directory, with the repository's git hooks and git config still unwritable.
On Windows a locked-down session's shell commands don't run at all: without administrator rights Windows can only take the network away inside an app container, which can't use your toolchains.
Lockdown only tightens. Nothing inside the session can lift it. /safely and a quarantined machine also lock the shell down.
Three starter rules can lock a session down, and all three ship off, because people sometimes ask their agent to read the web or edit ~/.zshrc on purpose:
- Lock down the shell after a web fetch.
- Lock down the shell after a prompt injection (the prompt-injection check scores a result at 0.98 or higher; the check itself must be on).
- Lock down the shell after a jail denial.
They are listed on the Sandbox settings under Lock down a session. See Rules and CEL for writing your own.
Settings#
In the console, Sandbox, then Settings at the top right, card Shell commands:
- Jail agent shells turns the jail on or off for every Mac, Linux and Windows machine in the workspace.
- The three grants, and the two variable lists.
To change them for one group of machines or one machine, set the Sandbox: shell commands section on a profile under Fleet. Only owners and admins can change these, and a change reaches machines in about 30 seconds.
Cost, and if Golem stops#
A jailed command starts about 30 ms later than it would bare on a Mac, about 3 ms later on Linux and about 8 ms later on Windows. Golem's shell waits at most 250 ms for the session's policy. If the Golem agent does not answer in time, it uses the last policy it had for this session, then the machine's last known policy, then a baseline. In every case credential stores and persistence writes stay denied. It never runs a command unjailed because the Golem agent is down. The network is open in that fallback unless the session's cached policy was a lockdown.
On the record#
Each command is recorded, and on a Mac each operation the kernel refuses is signed into the session as a shield_denied entry naming the command that tried it. Linux and Windows don't log refusals where Golem can read them, so there they are not recorded and the jail-denial lockdown rule does not fire. A lockdown is signed as shield_tainted, with the rule that caused it. The console's Sandbox page shows, per day: coverage (sessions whose shell commands ran jailed), jailed commands, refusals, sessions locked down, commands run without the Golem agent, and commands that ran outside the jail. Refusals also appear in Events under the Sandbox: shell lens.
What the jail does not cover#
- It covers Claude Code on macOS, Linux and Windows. On macOS and Linux it also covers Codex, Gemini CLI, Cursor, Copilot CLI and Antigravity through their pre-tool hooks, and Hermes and OpenClaw through the Golem plugin. On Windows those agents run PowerShell: the jail covers OpenClaw's and Hermes's there (Hermes runs Git Bash). It covers Codex's, Gemini CLI's and Copilot CLI's only when you turn on Also jail agents that would approve the jail under Sandbox → Settings → Shell commands, because their own approval prompts would then see only the jail's wrapper instead of the command, and one "always allow" could approve every later one. The same switch jails Devin, whose
Exec(…)rules may also see only the wrapper. With the switch on, the Golem agent also points VS Code's agent at the jail through its terminal profile (chat.tools.terminal.terminalProfile.osx,.linuxor.windowsin VS Code's settings), unless you set one yourself. That is one jail per terminal rather than per command, with the machine's policy rather than the chat session's, but VS Code's own approval rules still see each command as typed. - If the hook fails, Cursor, Copilot CLI, Hermes and OpenClaw refuse the command, but Codex and Gemini CLI run it unjailed.
- On a Mac, a command an agent runs inside its own sandbox (Codex's default, or Cursor's or Gemini CLI's when turned on) stays in that sandbox, because macOS can't nest one inside another. On Linux the two stack.
- The Linux
.deband.rpmpackages do not include it; install withinstall.shto get it. - An agent's hook, MCP and settings files are protected at the root of the repository and in each folder down to where the command runs. A copy in a folder off that way, which an agent started there would read (Gemini CLI, Codex and Devin do), can still be written.
- On Linux the jail is coarser in a few places, because Landlock can only allow, not deny:
- A command cannot create a new file or folder directly in your home directory,
~/.configor~/.claude. Folders that already exist there stay fully writable, so a tool only notices the first time it ever runs (for example~/.npmon a machine that never ran npm). - The repository's
.claude/settings.json, the other agents' hook, MCP and settings files there, git hooks and git config stay writable, even in a lockdown. - With the SSH agent or Docker grant off, every local socket is refused, not only those two, so a local database socket or D-Bus goes too.
- The names of files in
~/.sshcan be listed. Their contents cannot be read.
- A command cannot create a new file or folder directly in your home directory,
- On Windows:
- A command cannot create a new file or folder directly in your home folder. Folders that already exist there stay writable.
- Golem makes each agent's folder that is missing (
.claude,.cursor,.gemini,.github,.vscodeand the rest) at the root of the repository and in each folder down to where the command runs, empty, so it can be held. Git doesn't list empty folders. - While such a folder lacks one of the protected files, a command cannot create files directly in it (
.vscode/launch.jsonin a repository without.vscode/settings.json), and while.githublackshooksorcopilot, it cannot create folders in it, so a first.github/workflowshas to be made outside the jail. - A missing
.mcp.jsoncan be created. Claude Code still asks before it starts a server from one, and a command can't answer for you. - Claude Code run as administrator ("Run as administrator") can still register a scheduled task. Run it normally.
- The SSH agent and Windows Credential Manager stay reachable with the SSH agent and keychain grant off.
- If you have
~/.bashrcbut no~/.bash_profile, Git Bash tries to create one at every login and warns when the jail refuses. Create~/.bash_profileonce yourself to stop it.
- Claude Code's own Read, Write and Edit tools do not go through a shell, so the jail does not see them. Rules on those tools still apply.
- Commands you type in your own terminal are not jailed.
- A clean session has open network access. Only a lockdown takes it away.
- Programs that need setuid (rare in agent work) fail inside the jail.
The sandbox#
What you do#
On a Mac with Apple silicon and macOS 26 or later, the installer installs Apple's open-source container tool, checked against a pinned checksum and Apple's signature, and asks for your password once. Under MDM, running as root, it installs without asking, and GOLEM_SANDBOX_NO_PROMPT=1 keeps a user-context install from asking at all (see Roll out to a fleet). To skip it, set GOLEM_NO_SANDBOX=1 when installing; to add it later, run:
golem install sandboxOn Linux nothing needs installing. The sandbox needs /dev/kvm, which most Linux desktops and laptops have and many cloud VMs don't. If your user can't open it, the installer says so; add yourself to the kvm group (sudo usermod -aG kvm $USER, then log in again).
On Windows nothing needs installing either: install.ps1 sets the sandbox up, and the Golem service runs each VM on Hyper-V. It needs Windows's Virtual Machine Platform feature and virtualization turned on in the firmware. If Hyper-V can't run, the installer says how to turn it on (Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform, then restart). Skip it with GOLEM_NO_SANDBOX=1.
On any other machine (an Intel Mac, for one) it reports that the sandbox is not supported and does nothing.
The installer does not download the sandbox's images. The Golem agent does, once the workspace switch is on, ahead of the first run rather than during it: on a Mac it starts Apple's container service and pulls Golem's images, about 500 MB; on Linux it downloads Firecracker, a Linux kernel and a disk per role into ~/.golem/sandbox, about 1.5 GB; on Windows a Linux kernel and the same disks into %ProgramData%\Golem\sandbox, readable only by the service and administrators. Each is checked against the digest this Golem release pins. While the switch is on, the agent keeps the sandbox ready on its own: it starts Apple's container service after a restart and downloads new images after an upgrade. To download them now rather than wait, run:
golem install sandbox --nowThe child agent is a Claude Code session on your own subscription, signed in with your Claude Code login from the keychain, not with the session that called the tool. So Claude Code must be installed and signed in; Golem does not install it. The Golem agent runs as a background service that doesn't see your shell's PATH, so it looks for claude in /usr/local/bin, /opt/homebrew/bin, ~/.local/bin (where Claude Code's own installer puts it), ~/.claude/local, ~/.npm-global/bin and ~/.bun/bin. If that login has expired, every sandbox run comes back login_required until you run:
claude /loginOn Windows the Golem agent is a service that works for whoever calls it, so the child runs as your Windows account, with your PATH and your Claude Code login, and opens only files you can open.
Golem checks that login without spending tokens, once the sandbox is switched on and its VM runtime is ready. On Windows, where each run signs in as the account that asked, there is no one login to check ahead of time: a run that can't sign in comes back login_required. If your organization's Claude Code settings send it to another API, such as Amazon Bedrock or Google Vertex AI, the check is skipped, because there it would spend tokens. When the login is the last thing missing, Golem tells you at the start of a session, at most once a day until it works.
Golem also installs a golem-sandbox skill for Claude Code, Cursor, Codex, Copilot and Antigravity, which tells the agent when to reach for these tools: before fetching a URL from an issue or chat, before reading a repository or package it did not write, before opening a file from outside the project. You can ask for it directly too. A golem-phishing skill builds on it: asked whether a link is phishing, the agent captures the page's source in the sandbox and reports where credentials are sent, how the page hides from scanners, what to block and what to do next.
Check it is ready#
golem sandbox doctorlists the five things a run needs, with the command that fixes each one missing:
| Check | Ready when | Fix |
|---|---|---|
| Platform | macOS 26 or later on Apple silicon, Linux with KVM, or Windows | update macOS; on Linux or Windows, golem update |
| VM runtime | Apple's container is installed and running; on Linux, your user can open /dev/kvm; on Windows, the Golem service can start a Hyper-V VM | golem install sandbox when it is missing, golem install sandbox --now when it is stopped; on Linux, the kvm group; on Windows, Virtual Machine Platform and firmware virtualization |
| Sandbox images | Golem's pinned images are on the machine | wait, since the Golem agent downloads them while the switch is on, or golem install sandbox --now |
| Workspace switch | the sandbox is on for the workspace | Sandbox → Settings in the console |
| Claude Code login | Claude Code is installed and the child can sign in | install Claude Code, then claude /login |
It exits non-zero until the machine is ready, and golem doctor warns while it isn't. An agent can ask the same thing with the sandbox_status tool before it hands work over, at no cost. In the console, the Machines card on the Sandbox page lists every machine that reports: first the ones that can run the sandbox but aren't ready, then the ones that can't run it, then the ready ones, each with what is missing and the command to copy.
The three tools#
| Tool | Hand it | Network | Returns |
|---|---|---|---|
sandbox_browse | a url and a question | the URL's host by default; hosts adds up to 20 more | an answer to the question |
sandbox_run | a task, and a local path or an https repo to work on | none by default; hosts opens named hosts | an answer, and a patch for the agent to review before applying |
sandbox_open | up to 20 file paths and a question | none by default | what it found |
Every result also carries a deviations list: each thing the child tried that it was not allowed to. An egress_denied entry names the method, host and port and why it was refused, for example host_not_in_lockdown. Other kinds are browse_denied, guard_blocked (the child tried a tool it does not have) and token_cap. The answer is marked as written by an agent that read untrusted content.
How it is isolated#
- The pages it loads, commands it runs and files it reads run in a fresh Linux VM with no network of its own, a read-only root, no capabilities and an unprivileged user. Its one way out is Golem's egress proxy, which allows only the hosts named and ports 80 and 443, and refuses private addresses.
- No credentials. Files go in read-only, and Golem refuses to hand over your home directory or a credentials directory. A repository is cloned inside.
- The child agent is fenced to the sandbox's own tools: no Bash, file, web fetch or search tools of its own. It runs on your Claude Code sign-in, capped at 200,000 tokens per task.
- Each VM is discarded when its work is done.
Isolation does not detect an injection. It limits what one can reach. So the child is watched like any other agent: its calls and every network request its VM makes are signed into the same record, linked to the session that handed the work over.
Limits#
sandbox_open | 20 files, 100 MB each, 500 MB in all |
A command inside sandbox_run | 2 minutes by default, 10 at most |
| A whole task | 5 minutes by default for browse and open (10 at most for open), 10 for run (30 at most) |
| A returned patch | about 100 KB |
Settings#
The sandbox is one switch for the workspace: Sandbox, then Settings, card Sandbox. It is on by default, so every machine that can run the sandbox downloads its images soon after it enrolls, and again after an upgrade that changes them. Turned off, the three tools disappear from every agent's tool list, and no machine downloads the sandbox's images unless someone runs golem install sandbox --now on it. To keep the images off a fleet, turn the switch off before machines enroll.