A developer who once recommended approving every agent command by hand now runs OpenCode with no permission prompts at all. The reason is a coding agent sandbox built on nono and macOS Seatbelt, refined over 87 commits across about three and a half months.
The setup grew out of an incident a year earlier. Cursor’s sandbox let an agent run cat ~/.npmrc, and the npm token ended up in output that was sent to the model.
Why the boundary sits below the agent
Models can’t reliably tell instructions from data. A PR comment, a README line or a dependency’s stack trace lands in the same context window as the user’s prompt. If that text says to read AWS credentials and post them, some model will eventually try.
Simon Willison calls the risky mix the lethal trifecta: private data, untrusted content and a way to talk to the outside world. A coding agent has all three by default. Remove one and the attack fails.
Prompting didn’t fix this, and neither did hooks, which inspect the command string but never see what the command does. So the rule is enforced in the operating system. On macOS that means Seatbelt, the mechanism behind App Sandbox. The hard part is writing the policy.

What the agent can and can’t touch
Reads are denied by default, the opposite of Cursor’s setup. The SSH directory, AWS config, shell history and keychains are invisible. Each toolchain gets only the cache and config paths it needs, one module at a time.
- The working directory is writable, minus nested .env files and secrets directories.
- The clipboard is off, because Seatbelt can’t filter pasteboard contents. The commands pbcopy, pbpaste and mdfind are blocked.
- The network is an allowlist. GitHub, a model gateway and package registries respond. example.com returns nothing.
- The agent can’t read its own policy, since one that can read it can hunt for gaps.
OpenCode gets a disposable copy of its config in a cache-backed view, so the checked-in JSON stays read-only. A test fingerprints the full grant set, so any commit that widens the sandbox changes a golden file and shows up in the diff.
Phantom tokens keep credentials out
Environment variables are the weak spot, because Seatbelt does nothing about them and the agent can simply run printenv. Instead, nono keeps the real key on the host. Inside the sandbox, variables such as GITHUB_MCP_PAT and LITELLM_API_KEY hold a random 64-character phantom value. Outbound requests to approved endpoints pass through a proxy that swaps in the real credential.
If the agent leaks the phantom into a PR comment, an attacker gets a string that works only through a proxy on one laptop, for one session.
AWS needed a different route because SigV4 signs each request with the secret key. A host script runs the AWS MCP proxy with a read-scoped profile and exposes one loopback port. The sandbox gets a grant for that port only, and the aws CLI is blocked. Along the way the author lost time to 403 errors that looked like expired credentials. The requests were actually signed for the wrong region, so the bridge now derives the region from the endpoint URL. The proxy’s read-only flag also covers only documentation tools, so API limits have to come from IAM.
MCP tools get a second layer
The sandbox controls what the agent’s processes reach, not what an MCP server does on its behalf. In sandboxed profiles the shell runs freely, but MCP write tools stay denied: no Jira writes, no AWS changes, read-only GitHub toolsets. There’s a trap here. OpenCode treats a tool not covered by any rule as allowed, so renaming a server silently breaks a deny rule. The author now checks the effective tool list after every MCP config change.
Git gets similar care. Hooks run with an empty environment plus a short allowlist. The GPG home is denied, so the agent can commit but can’t sign, and a pre-push hook refuses unsigned commits.
The cost of getting there
Seatbelt denials surface as unrelated errors deep in a tool. Maven needed three commits, and Yarn took four in two days. Of 32 earlier commits to the profile directory, 19 were single missing-grant fixes.
One bug looked like slow software. Sandboxed launches took about 58 seconds because a wildcard deny for key files under the home directory made nono walk the whole tree. Removing that line cut startup to under a second. A deny glob under the cache directory later crashed nono 0.74’s supervisor with SIGILL, so the profile now denies specific paths only.
Work-only paths add another layer. A repo can list files that only approved model providers may see, and the launcher denies them otherwise. Because a deny doesn’t stop mv from moving a file elsewhere, it also sets the macOS chflags uchg flag for the session. A gap remains: git show can still read committed blobs.
What carries over
The author says the profile fits one machine, with its Homebrew paths, named loopback ports and per-repo rules. Registry profiles like nono’s packs are the suggested starting point. Once a third toolchain or an OAuth-based MCP server arrives, you maintain your own policy. OAuth sign-ins now happen in a plain session outside the sandbox and last a couple of days.
Source: Luca Becker