A Fresh Home for Every Run: Closing a Sandbox Escape We Built Ourselves
We run autonomous coding agents on our own hardware inside Linux kernel sandboxes (how the sandbox became a kernel rule). When a task arrives, the fleet starts an agent in an isolated worktree, applies Landlock and seccomp rules, checks the diff at a gate, and lands the commit when tests pass. The kernel enforces what a process can write and which network endpoints it can reach. However, the sandbox policy also decides which directories on the host are marked writable for an agent harness. In every public release from v0.6.0 to v0.12.1, our sandbox policy gave goose, opencode and claude-code write access to their own configuration directories in the operator’s home. We built that configuration into the fleet ourselves, creating a direct path out of the sandbox.
The writable directories in the sandbox policy
A coding harness expects to store configuration and package caches during execution. To meet those requirements, we defined writable state paths for each supported tool in src/fleet/plugins/harness_base.py and core/sandbox.py.
Under that configuration, a goose task received read-write access to ~/.config/goose. An opencode task received read-write access to ~/.config/opencode and ~/.local/share/opencode. Running claude-code without a lane token gave read-write access to ~/.claude. In addition, ALWAYS_RW granted every task read-write access to ~/.cache and ~/.npm. This directory policy shipped in every public release from v0.6.0 to v0.12.1.
Read as plain files, granting write access to configuration directories looked harmless. In modern agent harnesses, configuration directories contain instructions that specify executable commands.
Configuration files as command registries
In goose, the desktop application reads its configuration from config.yaml in ~/.config/goose. That file defines an extensions: section where each extension has a cmd: field. When the operator opens goose desktop, the application starts those extension commands on the host outside any sandbox. If a sandboxed agent modifies config.yaml and registers a command under extensions:, that command executes with the operator’s privileges the next time goose desktop opens.
Opencode follows the same pattern. Its configuration file, opencode.json in ~/.config/opencode, defines external tools as commands under mcp and plugin. When opencode runs on the host, it starts those commands. Opencode also stores provider keys in auth.json. An agent task with write access to ~/.config/opencode can alter command definitions or read provider keys.
Claude Code uses the same model. Its configuration file, settings.json in ~/.claude, holds hooks. When Claude Code runs on the host, it executes those hooks in the user shell outside any sandbox. A sandboxed task that writes to ~/.claude can append commands to that hook configuration.
An agent processing an untrusted issue, repository file, or web page can be guided through prompt injection to append a command to one of these files. The kernel allowed the write because our sandbox profile marked those directories writable. The command would then run later, outside the sandbox, under the operator account during desktop use.
Discovery during the coordinator review
We found this vulnerability on 2026-11-19 during an internal code review. We were examining an earlier finding about the coordinator agy process. In our setup, the coordinator agy runs continuously to orchestrate tasks, keeping its persistent memory across about 500 conversations in brain/ and knowledge/. The security review noted that a task running under the agy harness had write access to that state directory.
While updating that path, we audited the state directory definitions across all other harnesses. We checked the writable paths of the other harnesses the same way. Three of those directories, for goose, opencode and Claude Code, held files that name commands. We found no sign that these write permissions were ever used, but the capability existed across all releases from v0.6.0 to v0.12.1.
On 2026-10-26, we had commented on goose issue #12805 regarding operating system sandboxes for developer agents. We listed ~/.cache and ~/.npm among the writable roots that were enough, and stated that wrapping all of goose forces its config and state dirs to be writable too. We had accepted that requirement as an unavoidable constraint of CLI tools. In practice, treating a host configuration directory as a necessary write target creates a persistent escape path.
Static blocklists and their boundaries
One approach to protecting configuration files is maintaining a static deny list within allowed paths. Anthropic uses this design in sandbox-runtime. The runtime enforces mandatory deny paths that block writes to specific files even when an enclosing directory is writable.
Under sandbox-runtime, the mandatory deny list includes .bashrc, .bash_profile, .zshrc, .zprofile, .profile, .gitconfig, .gitmodules, .ripgreprc, .mcp.json, .vscode/, .idea/, .claude/commands/, .claude/agents/, .git/hooks/, and .git/config. Other paths require explicit entries in the user denyWrite configuration.
A static blocklist works for standard shell startup files where filenames are known in advance. It does not provide durable protection across a fleet running diverse third-party harnesses. Every harness invents its own directory layout, file names, and command execution primitives. When upstream tools add configuration keys or rename settings, a static list falls behind. An orchestrator cannot track every upstream schema change.
Instead of maintaining an expanding list of blocked files, we changed the boundary so that a sandboxed task never touches the operator home directory.
Fresh home directories for every run
In 0.13.0, we replaced shared host state directories with ephemeral home environments. Every CLI run and every verification gate starts with a fresh home directory at <fleet root>/homes/run/<harness>-<random>, created with mode 0700. The fleet runner points HOME and all XDG environment variables to this path. Nothing in the operator home directory is writable during a run.
Before starting an agent, the fleet harness seeds the temporary home with the minimum files needed for operation:
- For agy, the harness provides its three login files.
- For opencode, the harness writes provider configurations and model settings only, omitting
mcp,plugin, andinstructions. - For aider, the harness copies its configuration and model settings.
- For Pi, the harness writes a
models.jsonfile pointing to the local model server for that lane. - For goose and Cursor, the harness seeds nothing.
The daemon writes all seed files using open flags O_EXCL and O_NOFOLLOW. Files are created only if they do not exist, and the daemon never follows symbolic links planted by an untrusted process. When the task finishes, the daemon removes the temporary run directory.
We also changed the fallback behavior in Claude Code. In 0.13.0, if claude-code runs without a lane token, the runner refuses execution with exit status 126 instead of falling back to ~/.claude.
Package downloads no longer touch the operator home. Release 0.13.0 provides a shared fleet cache at <fleet root>/homes/cache for XDG cache, npm, uv, and pip. Tasks reuse downloaded packages without touching the operator’s own package directories.
Verification across harnesses
We verified the isolated home implementation through live execution tests in 0.13.0. We tested opencode, goose, aider, agy, and Pi on real tasks. In each test, the agent completed its work inside its isolated environment. Each one was denied when it tried to read the configuration files in the operator’s home. When each run completed, the temporary home directory was removed, leaving no files behind. Cursor started in its temporary home too, then stopped at the limit of its free plan.
Running in empty home environments revealed one operational quirk. When aider starts in a clean home directory without prior configuration, it treats the run as a first launch and opened a web browser to display its release notes. Sovereign Fleet now passes --no-show-release-notes to aider invocations.
The same day we also inspected the verification gates, and the routine that restores linked node_modules directories after gate execution. It followed paths that the gate itself could have rewritten. We updated the code to use directory file descriptors opened with O_NOFOLLOW, resolving paths one component at a time.
Cache tradeoffs and directory traversal
The transition to ephemeral home directories secures host configuration, but leaves one deliberate tradeoff in place. The fleet cache at <fleet root>/homes/cache is shared across fleet tasks to prevent redundant downloads. If a task writes a poisoned package into the cache, a subsequent fleet task installing that package could execute modified code.
We accepted this tradeoff deliberately. The shared cache is used only by tasks running inside the kernel sandbox. The operator’s own tools never read <fleet root>/homes/cache. A poisoned package would still run inside the sandbox of that later task, and it never reaches the operator’s own tools. The first run of any harness after an update downloads packages into the new cache, creating a one-time network delay.
In the nautical frame of the fleet, an agent sails under a letter of marque that sets its permitted operating bounds. In our earlier releases, our sandbox policy let the agent into the captain’s quarters. With ephemeral home directories, the agent works strictly inside a temporary cabin. The prize court inspects the resulting artifacts at the gate, and the cabin is cleared as soon as the ship returns to port.
Audit instructions for older releases
Operators running Sovereign Fleet releases from v0.6.0 to v0.12.1 should upgrade to 0.13.x. After upgrading, operators should inspect host configuration files to verify that earlier sandboxed tasks did not register unauthorized commands.
Review the following files and remove any unfamiliar entries:
- In
~/.config/goose/config.yaml, inspect theextensions:list and check eachcmd:definition. - In
~/.config/opencode/opencode.json, check for unexpected entries undermcpandplugin. - In
~/.claude/settings.json, inspect the hooks list for unauthorized commands.
These three commands print the entries to look at; each one only reads:
grep -n -A3 'extensions:' ~/.config/goose/config.yaml
grep -n -E '"(mcp|plugin)"' ~/.config/opencode/opencode.json
grep -n -A5 '"hooks"' ~/.claude/settings.json
If an entry exists that you did not add yourself, delete it before running those tools on your host machine.
Remote interfaces and signing
Closing host configuration writes was necessary before adding new intake channels in 0.13. As long as an agent task could modify host configuration files, expanding intake interfaces created unacceptable risks.
With home isolation in place, release 0.13 introduces (see the project page) scoped tokens and an MCP server accessible over HTTPS at /api/mcp, allowing callers to authenticate using individual tokens. It also introduces Pi Pocket on mobile devices, configured with a restricted token permitted only to propose tasks rather than approve or execute changes directly. On 2026-11-19 the first real kind 4910 signature from a phone approved a step of a task.
Every new interface brings a potential route for untrusted prompts. By isolating the home directory in every run and enforcing strict kernel confinement, Sovereign Fleet keeps untrusted input from writing the operator’s home.