Five months ago I stopped running Claude Code in its restricted mode, where it had to ask my permission before it executed anything, because I had become a confirm bot. Every few minutes it wanted to run some obscure command, often a complicated piece of Python or Bash. with a grep and a regular expression I couldn’t understand. I clicked yes because I wanted to get on with my work, even though I often had no idea what the command actually did. That made me uncomfortable, because technically one of those commands could have grabbed something from my keychain, or a private file. This way of working never did me any harm, but once I had to step in because it was looking through a folder that had nothing to do with the task it was working on, The folder was not harmful but I didn’t want it in there, opening and reading files that weren’t its business.
I was talking about it with my boss and he pointed me to Sandvault. Sandvault lets you run Claude Code with --dangerously-skip-permissions because the agent is contained enough that you don’t need to worry about it reaching things on your main system. Mike McQuaid, who leads Homebrew, has already written about this kind of setup and why sandboxing lets you stop babysitting permission prompts, so I won’t repeat that case here. What I want to look at is the other side of it: what the sandbox doesn’t stop.
Drift or attack, the same controls
When people talk about AI security they mostly talk about attackers from the outside. Like someone hiding instructions in a web page or a document, the agent reads them and starts working for someone else. Others point out that an agent doesn’t need to be attacked to do damage, because it can stay inside the permissions you gave it and still drift outside the role you had in mind. If this happens the agent will often chain commands and tools in ways nobody anticipated as a side effect of trying to finish its task. For defending yourself the difference matters less than you’d think, because the controls that contain a drifting agent are the same ones that contain a manipulated one, so you don’t need to know why an agent misbehaves to limit the damage it can do. The question that matters is what your agent can reach when it runs as you, on your machine and everywhere your tokens and tools let it go.
On your own laptop that damage is easy to picture, it can be a command that deletes the wrong folder or quietly reads a token from your environment or your keychain. But an agent rarely stops at your laptop, because every tool you connect gives it a way to act in the outside world. Every MCP server you add adds more capability without governing any of it. Tools call runs with your rights and the systems on the other end can’t tell the difference between you and your agent.
That is where the damage gets bigger: a database tool can run a DELETE without a WHERE, a file tool can be pointed at a wildcard path. An agent stuck in a loop can call a paid API thousands of times before anyone notices. So a small misunderstanding ends up as lost data or a large bill.
The more dangerous pattern is chaining, because an agent that can read private data can also send something out. Think about email, a web request or a comment on a pull request which can leak that data. The two calls can each look perfectly reasonable on their own. It rarely happens as one obvious mistake you would catch, it happens more gradually. Think about repeated calls, slightly broader actions and a little more capability at each step.
What I use: Sandvault
Sandvault is a small open-source tool that creates a separate, non-admin macOS user for your agents and runs them in that account, with macOS’s own sandbox-exec on top as a second layer. That user can’t read my home directory, which means no access to my .ssh folder, my keychain or my personal files, and it can’t modify system files or reach mounted drives. When the agent tries, this is what it gets:
$ ls /Users/myUser/.ssh
ls: /Users/myUser/.ssh: Operation not permitted
The only places it can write are its own home directory and a shared workspace at /Users/Shared/sv-$USER, which is where I keep the repositories I want it to work on. Because it is just another user account and not a virtual machine, switching is instant and there is no overhead.
I use it for my coding. Claude Code runs in the sandbox with permissions skipped, so it can browse the codebase and write code without me approving every grep or check. I combine it with Sanductor, Mike McQuaid’s macOS app that runs coding agents in parallel git worktrees as that sandboxed user. The tool keeps credentials and signing keys out of the agents’ reach, so signing and pushing stay under my own account.
It isn’t frictionless, and I’d be lying if I said it was. The sandbox user has its own keychain, so when the agent needs a secret or a token you either copy it over or, better, create new ones specifically for that user, because it really is a different user. I also regularly run into permission issues when I’ve edited a file as myself and the sandbox user then wants to change it, so now and then I have to run sv --fix-permissions before it can carry on. That is the price of the isolation, and for me it’s worth paying.
What Sandvault doesn’t cover
Sandvault decides where the agent runs, and it does that well, but when I put my own setup next to what a secure setup needs, I found five gaps.
The first is the network. A sandbox that can’t read your files can still send whatever it does read to anywhere on the internet, and from inside mine an outbound request goes straight through:
$ curl -sI https://example.com | head -1
HTTP/2 200
The safer default is to deny outbound traffic and allowlist only the destinations the agent actually needs. Anthropic’s own sandbox runtime does this by pairing OS-level sandboxing with a proxy that filters network traffic, which is exactly the part Sandvault leaves to you.
I haven’t closed this gap yet. Until now I’ve leaned on the fact that my agent has very little worth sending anywhere. I use narrow tokens and give it no access to my own files. However that is an argument about what it can reach, not a control on where it can send things. Putting an allowlisting proxy in front of the sandbox user is the next thing I’m building and I’ll write up how it goes.
The second is credentials, and it follows from my keychain friction. Every token you copy into the sandbox is a token the agent can read. A long-lived personal token with broad rights brings back exactly the risk you wanted to remove. Combine that with open network access plus content from the internet and you have what Simon Willison calls the lethal trifecta.
The third is the tools themselves. Sandvault protects my disk, but it does nothing about what an agent can do through an MCP server or an API. If a sandboxed agent has write access to your calendar, your task list or your email, it can still delete, send and change things in the real world. The same goes for the shared workspace, because everything in it is writable for the agent it can change any repository you put there.
The fourth is a policy check outside the model that decides whether a tool call happens at all. Think about dealing with budgets on calls and cost, allowlists, rules about which tools may not be combined in one run,human approval for irreversible actions and an audit log of everything. Sandvault isn’t built for that and doesn’t claim to be.
The fifth is the strength of the boundary itself. Sandvault shares the kernel with the rest of my Mac, which makes it a weaker boundary than a micro-VM, its environment persists between runs rather than starting clean each time.
What you can do about it
None of this means you shouldn’t use a sandbox, because it removes the biggest and most boring risk, which is an agent running as you with access to everything you have. It means you treat the sandbox as one layer and add the others where your work needs them.
- Give the sandbox its own tokens. Scope them as narrowly as possible, make them short-lived where the service allows it. Keep signing keys and anything that can push or publish outside the sandbox, which is what Sanductor does with signing and pushing.
- Close the network. Put an outbound firewall or proxy in front of the sandbox user and allow only the hosts the agent needs, such as your package registry, your Git host and the model’s API.
- Keep approval where it matters. Look at every MCP server you connect, find the tools that can change something outside your machine. x.
- Break the trifecta. Check whether any single agent run has private data, untrusted content and a way out at the same time. If it does, take one of the three away.
After the proxy, the next step is the tools: I’m diving deeper into the MCP protocol so I can write tools I actually trust and I already write my own plugins. Part of it is security, because a tool I built and understand is easier to trust than one I installed., Another part of it is that I want to understand the agentic world better, writing my own tools is how I learn.
What I’d tell you
An agent that runs as you has the same access you have is not of this time. With agents getting more powerful and more tools connected to it we need to provide proper controls and security measures to use things responsibly.
