Agent Safehouse – macOS-native sandboxing for local agents
TL;DR Highlight
Wrapping agents in sandbox-exec makes the kernel block writes outside your project
Who Should Read
Developers running Claude Code or Codex in --yolo mode on a Mac who worry about an agent wiping their home directory
Core Mechanics
- The kernel blocks writes outside the project
- Safehouse denies write access outside the project directory.
- The kernel blocks the syscall before any file is touched.
- Everything is denied by default
- Agents normally inherit your full user permissions.
- Safehouse only opens paths you explicitly grant.
- Only the workdir gets read/write
- The workdir (git root by default) gets read/write and installed toolchains get read access.
- ~/.ssh, ~/.aws and other repos are blocked.
- Setup is simple
- Install via brew or grab one shell script.
- There is no build step and no dependency beyond Bash and macOS; just prefix the agent, e.g. `safehouse claude --dangerously-skip-permissions`.
- Shell functions keep agents sandboxed by default
- Define claude(), codex() and similar functions in .zshrc so they always run in the sandbox.
- Use `command claude` to bypass the sandbox.
- An LLM can generate your profile
- The provided prompt asks about your home directory and toolchain, then generates a least-privilege sandbox-exec profile.
- You can also use only the Policy Builder to produce one policy for your dotfiles.
Community Reactions
- The creator says what it is and where the effort went
- The creator says it is just a policy generator for sandbox-exec.
- He says it took many hours to find the minimum permissions for auto-updates, keychain and image pasting.
- A counterpoint: agent CLIs already have sandboxes
- One commenter notes agent CLIs already use sandbox-exec with granular permissions.
- They ask why use this over editing the CLI's settings file directly.
- Filesystem is only part of the risk
- One commenter says the real danger is an agent using your credentials to run destructive commands on production systems or databases.
- They say the fix is specific to each system, so filesystem sandboxing is just one piece.
- Blocked agents tend to try to get around it
- One commenter found that blocked agents assume something is wrong and try hard to bypass the block without asking the user.
- They suggest adding 'this is deliberate, don't try to get around it' to the error message.
- VMs, separate user accounts and containers came up as alternatives
- One commenter argues a macOS VM is safer, since it can keep the agent away from your keychain.
- Sandvault gives agents their own unprivileged user account and layers sandbox-exec on top.
How to Apply
- Verify the sandbox really blocks access
- After brew install eugene1g/safehouse/agent-safehouse, run `safehouse cat ~/.ssh/id_ed25519` and confirm Operation not permitted.
- Then run `safehouse ls .` to confirm the current project still works.
- Wrap your agent commands in shell functions
- Add safe() and claude() to ~/.zshrc so --dangerously-skip-permissions runs always go through the sandbox.
- Add any needed read-only folders with --add-dirs-ro.
- Put a generated policy in your dotfiles
- Generate a least-privilege sandbox-exec profile for your toolchain and save it at a path like ~/.config/sandbox-exec.profile.
- When the agent fails from a block, read the log and add allowed paths one at a time.
Try It
# Paste into Claude or ChatGPT (simplified version of the Safehouse guide prompt)
You are a security helper that writes macOS sandbox-exec profiles.
Goal: write a least-privilege profile to run the agent {{agent name: claude/codex/gemini}}.
Rules:
1. Default is deny; allow only paths I name.
2. Allow read/write on the working directory {{project path}}.
3. Allow read-only on installed toolchains ({{node, python, brew, etc.}}).
4. Always deny sensitive paths such as ~/.ssh and ~/.aws.
First ask me about my home directory layout, whether I use global dotfiles, and my toolchains.
After I answer, output:
- the full sandbox-exec profile (to save at ~/.config/sandbox-exec.profile)
- a wrapper function that grants the current directory
- zsh shortcut functions for my agentTerminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques
Related Resources
- https://agent-safehouse.dev/
- https://github.com/eugene1g/agent-safehouse
- https://agent-safehouse.dev/docs/agent-investigations/
- https://agent-safehouse.dev/policy-builder.html
- https://github.com/webcoyote/sandvault
- https://nono.sh/
- https://github.com/carderne/pi-sandbox
- https://github.com/GreyhavenHQ/greywall
- https://github.com/srid/sandnix
- https://github.com/hsaliak/sacre_bleu
- https://multitui.com/