How local agents are isolated
mushi work and local workers fix reports with a coding agent on your own
machine: the Cursor CLI or Claude Code. The agent works without asking you
first, and its prompt holds report text that someone else wrote. So Mushi
Mushi treats the agent, and every piece of code it writes, as untrusted.
Decision record: ADR 0087 . Needs CLI 0.44.0 or later.
What runs in the sandbox
Everything that reads or runs the worktree after Mushi Mushi makes it:
| Step | Where it runs |
|---|---|
| The coding agent | Sandbox |
| Installing the repo’s packages | Sandbox |
| git in the worktree, and the repo’s commit hooks | Sandbox |
| The repo’s pre-push hook | Sandbox |
| Red-green test runs | Sandbox |
| Audit checks and conflict merges | Sandbox |
| Fetch, and the push itself | Your machine, with no repo code running |
What the sandbox can and cannot do
On Linux the sandbox is bubblewrap
(bwrap).
| It can | It cannot |
|---|---|
| Read and write the worktree | See your home folder: ~/.ssh, ~/.aws, ~/.config/gh, other projects |
| Read the system’s programs and the tools it needs (Node, the agent, pnpm), read-only | See /tmp, /run (your ssh agent, keyring) or /mnt (Windows drives in WSL) |
| Write the repo’s git objects and its own branch | Change the repo’s config, hooks or other branches. Mushi Mushi checks every branch after each run, puts back any it did not make, and stops the run |
| Reach allowed hosts over HTTPS | Reach any other host, any private address, or plain HTTP |
| Use the agent’s own sign-in for the sandbox | Read your ~/.cursor or ~/.claude sign-in, your GitHub token or your Mushi keys |
Each run starts with an empty home folder of its own. Nothing a run writes there reaches the next run or another repo. The only thing kept is the agent’s refreshed sign-in.
These homes are removed for you. An agent run’s home goes when the run ends. A worktree’s home goes when no step has used it for two hours. When a worker’s run folders pass 10 GB, the homes idle longest go first. When a worker starts, it also removes the folders that stopped workers left behind, for example after a crash. The worker’s card in the console shows how much disk its run folders use.
Allowed hosts
By default: the agents’ APIs and sign-in (Anthropic, Cursor), package
registries (npm, Yarn, PyPI, Go, crates.io), and GitHub for reading
(github.com, codeload.github.com, raw.githubusercontent.com, release
downloads). Add your own, such as a private registry, in
~/.config/mushi/worker.json:
{
"sandboxAllowHosts": ["npm.example.com", "*.registry.example.com"],
"sandboxPassEnv": ["NPM_TOKEN"]
}sandboxPassEnv names variables your repo’s code may see, such as a private
registry token. Mushi Mushi refuses names it uses itself (GH_*, GITHUB_*,
MUSHI_*, ANTHROPIC_*, OPENAI_*, cloud and SSH variables).
When a run fails because a host was blocked, its failure line names the host.
Proved before it is used
When the worker starts, it runs a small test inside the sandbox. The test tries to read a file planted in your home folder, write outside the worktree, see the worker’s own process, and reach the internet directly and through the proxy. If any of these works, the sandbox does not open.
No sandbox, no work. Without a working sandbox, lanes take no reports, unless you turn it off on purpose (below). The console’s Workers tab says so for that machine, with the reason.
| Console shows | Meaning |
|---|---|
| Sandbox: on | Agents run in the sandbox |
| Sandbox: off | You turned it off. Its lanes still take code work, and the console warns: agents can read this machine’s files |
| Sandbox: missing | No working sandbox, so no lane takes work. The line says why |
| Sandbox: not reported | The machine runs an older CLI. Update it |
Sign the agent in for the sandbox
The sandbox never sees your own sign-in. Sign each agent in once:
# Cursor: opens a sign-in link inside the sandbox
mushi worker sandbox-login --agent cursor
# Claude Code: make a long-lived token, then hand it over
claude setup-token
mushi worker sandbox-login --agent claudeThe Claude Code token is kept in ~/.cache/mushi/sandbox/claude.token (mode
0600), outside everything the sandbox shows. CURSOR_API_KEY reaches Cursor
runs only when you opt in with "cursorApiKey": true (or
--cursor-api-key). Claude Code runs never get it.
On a worker with several Cursor accounts (cursorAccounts), each run gets only
the key of the account it runs on, as CURSOR_API_KEY. The other accounts’
keys never reach it. Repo code gets none of them, and sandboxPassEnv refuses
every CURSOR_API_KEY* name. To read an account’s usage, the worker sends its
key only to Cursor (api2.cursor.sh), and only from the worker process. Cursor
does not document this usage call. If a reading fails, the account’s usage
counts as unknown. The reading is off unless an account sets "meter": true.
The heartbeat sends only each account’s id, its masked e-mail and its
percentages.
How the fix is pushed
The repo’s pre-push hook runs in the sandbox, with no credentials. Then your machine takes only the commit’s id, checks it builds on the commit the run started from, and pushes that id from a separate copy Mushi Mushi owns. Your GitHub credential is used only for that transfer, and no repo script runs beside it. Hooks are never skipped.
Audit lanes are read-only
A code-read audit shows the worktree read-only. Claude Code gets only its read, search and list tools. Cursor runs in ask mode, and a Cursor audit never runs without the sandbox.
Set it up
Linux
sudo apt install bubblewrap # or: sudo dnf install bubblewrap
git --version # needs 2.41 or laterUbuntu 24.04 and later block unprivileged user namespaces by default. If the
worker says the sandbox does not hold, allow them for bwrap with an AppArmor
profile.
Windows
Run the worker inside WSL2. Windows itself has no sandbox for agents yet.
- Install a WSL2 distro, and clone your repos inside it (not under
/mnt/c). - In the distro, write
/etc/wsl.conf:Then run[boot] systemd=true [automount] enabled=false [interop] enabled=false appendWindowsPath=falsewsl --shutdownin Windows and open the distro again. The sandbox does not open in WSL while interop is on. - Install bubblewrap, Node 20+, git 2.41+, the Mushi CLI and your agent inside the distro.
- Install the worker and sign the agent in (see above).
macOS
There is no sandbox on macOS yet. The worker refuses to take work unless you turn the sandbox off.
Turning it off
Only if you accept that agents can read this machine’s files:
{ "sandbox": "off" }or mushi work --sandbox off. Agents and repo code still get no tokens from
the environment and no git credential helper. The console shows off for
the machine.
A machine you turned off takes captures only until you allow code work without a sandbox on its card on the Workers page, with a reason (since release 8). Only the machine’s owner can, and only while they are an owner or admin of every app it serves; the decision and the reason go to the audit log. The card asks once; after that it shows your decision with Change. Once allowed, the console still warns on its card and on its lanes: “Runs its coding agents without the sandbox. Turn it on with the worker setting “sandbox”: “auto”.”
A machine with no working sandbox (missing) or an older CLI that does not say (not reported) takes captures and first-time user tests only, never code work: Mushi Mushi refuses it a fix, a conflict, an audit run or a review follow-up on an open pull request, whatever the report’s severity. A lane set to Takes: Captures only gets the same refusals on any machine. One server rule decides both, for the claim, the follow-up list and the worker’s heartbeat.
The rule is per machine. A worker names its machine when it asks for review follow-ups, so one machine without the sandbox does not stop another machine on the same key. An older CLI names none: then its key gets follow-ups when any of its live machines may take code work. Update the CLI so each machine is judged on its own.
What it does not cover
- An allowed host that accepts someone’s own credential (GitHub, a registry,
a model API) could carry out data the sandbox can see, such as the repo’s
source, if code inside brings that credential itself. Keep
sandboxAllowHostsshort. - The repo’s git objects are writable so commits work. Give the worker its
own clone (
mushi worker install --clone-root), not the copy you work in. - The agent and your repo’s code can still write wrong or harmful code. Every fix goes through review and your CI before it merges.