Overview
Agent Safehouse is a macOS sandbox wrapper for LLM coding agents that restricts filesystem access using Apple’s built-insandbox-exec mechanism. It allows agents to work productively while reducing the blast radius of potential mistakes or malicious behavior.
What It Does
Safehouse wraps your coding agent commands (likeclaude, cursor, aider, or any CLI/app-hosted agent) with a strict filesystem policy:
Deny by Default
Starts from
(deny default) and only allows what’s explicitly grantedSelective Access
Grants access to system paths, toolchains, and your selected workdir
Composable Policies
Builds final policy from modular
.sb profiles based on your needsLow Overhead
Native host execution with minimal performance impact
How It Works
Sandbox-Exec Wrapper
At its core, Safehouse is a Bash script that:- Assembles a policy from layered
.sb(Sandbox Profile Language) files - Replaces placeholders like
HOME_DIRwith actual absolute paths - Invokes
sandbox-execwith the composed policy and your command
Policy Model
Safehouse uses a layered policy assembly model:Optional Integrations
Adds capabilities like
clipboard, docker, kubectl only when explicitly enabledAgent-Specific Profiles
Loads agent config directories based on the command being wrapped (e.g.,
.aider, .claude)Later rules win in the policy assembly. This means
--append-profile can override any earlier allow or deny rules.What Gets Protected
Blocked by Default
Without explicit grants or opt-ins, agents cannot access:- SSH private keys under
~/.ssh - Cloud credentials (AWS, GCP, Azure config files)
- Browser data (cookies, sessions, profiles)
- Clipboard contents
- Shell startup files (
.zshrc,.bashrc, etc.) - Other projects outside your workdir
- Personal files (Documents, Downloads, etc.)
- Host process inspection (ps, kill, etc.)
Allowed by Default
For normal coding workflows to function:- System paths:
/usr/bin,/bin,/usr/lib, etc. - Toolchain runtimes: Node, Python, Go, npm, pip, cargo, etc.
- Package manager caches: npm, pip, cargo, gem caches
- Git integration:
.git,.gitconfig,~/.ssh/config(for remote URLs) - Selected workdir: Read/write access to your project directory
- Network access: APIs, registries, git remotes, MCP servers
- Temporary directories:
/tmp,/var/tmp, user temp dirs
Why Not Just Use a VM?
Safehouse is not a VM replacement. It’s a different tool for a different threat model:Safehouse Strengths
- Native host tooling (no duplication)
- Zero overhead
- Works with GUI apps
- Same shell environment
- No workspace syncing
VM Strengths
- Stronger isolation boundary
- Separate kernel
- Protects against escapes
- True adversarial defense
Example: What Safehouse Prevents
Scenario: Prompt Injection
An attacker embeds a malicious instruction in a file that gets into the agent’s context:/tmp.
With Safehouse: The sandbox denies read access to ~/.ssh/id_rsa. The command fails with:
Scenario: Confused Deputy
The agent misinterprets a vague request and tries to “clean up old projects”:~/old-project even though it’s unrelated to your current task.
With Safehouse: The sandbox only grants access to the current workdir. Access to ~/old-project is denied.
When to Use Safehouse
✅ Good Fit
- Daily coding with AI assistants
- Experimenting with new agents
- Working with sensitive repos on the same machine
- Running agents on production data
- Testing agent reliability
⚠️ Not Enough Alone
- Defending against sophisticated attackers
- Preventing network exfiltration
- Protecting against sandbox escapes
- Running untrusted third-party code at scale
Next Steps
Philosophy
Understand the design principles behind Safehouse
Isolation Models
Compare Safehouse to VMs and containers
Default Assumptions
Learn what’s allowed and denied by default
Getting Started
Install and run your first sandboxed agent