Sandbox
The Short Version
aide status
This shows what capabilities are active, which sandbox guards are enforcing them, and whether the sandbox is enabled. For most users, that is all you need.
Capabilities and Sandbox
aide separates what the agent can access from how that access is enforced:
Capabilities handle WHAT the agent can access - network, filesystem paths, cloud credentials, toolchains, and more. You configure capabilities in your profile config and aide translates them into the right set of guards. See docs/capabilities.md for the full capability reference.
The sandbox handles HOW it is enforced - on macOS, aide generates a Seatbelt profile at launch that locks the agent process to exactly the permissions its capabilities describe.
A practical example:
# ~/.config/aide/profiles/work.yaml
capabilities:
- docker
- k8s
- aws
aide reads those capabilities and produces a sandbox profile that grants Docker config access, kubeconfig reads, and AWS credential reads - nothing more.
On by Default
If no sandbox: block appears in your config, aide applies a default policy automatically. With 13 guards active out of the box (9 always-on and 4 default across 14 built-in guards; see Guard inventory below), the sandbox covers filesystem, network, credentials, cloud providers, toolchains, aide control state, terminal multiplexers, and common development tools.
Run aide status to see what is active for the current profile.
The table below covers the two settings you can tune directly at the top level; everything else (filesystem, credentials, cloud provider, toolchain access) is controlled by which guards and capabilities are active.
| Category | Default |
|---|---|
| Network | Outbound allowed |
| Subprocesses | Allowed |
Agent Config Directories
aide auto-detects known agent config directories and adds them to the writable list so agents can store state, cache, and settings.
| Agent | Env Override | Default Path |
|---|---|---|
| Aider | (none) | ~/.aider |
| Amp | AMP_HOME | ~/.amp, ~/.config/amp |
| Claude | CLAUDE_CONFIG_DIR | Linux: ~/.config/aide/claude (aide-managed redirect; this is the only path in the Landlock writable allow-list). macOS: ~/.claude, ~/.config/claude, ~/Library/Application Support/Claude. Setting CLAUDE_CONFIG_DIR to a path outside the managed directory on Linux requires adding it to writable_extra. |
| Codex | CODEX_HOME | ~/.codex |
| Cursor | CURSOR_CONFIG_DIR | ~/.cursor (also $XDG_CONFIG_HOME/cursor on Linux when set) |
| Gemini | GEMINI_HOME | ~/.gemini |
| Goose | GOOSE_PATH_ROOT | ~/.config/goose, ~/.local/share/goose, ~/.local/state/goose |
| OMP | PI_CODING_AGENT_DIR | ~/.omp (~/.omp/natives, ~/.omp/logs, ~/.omp/run stay writable on profile launches; on Linux, aide creates the granted directories before Landlock or bubblewrap applies) |
| Pi | PI_CODING_AGENT_DIR | ~/.pi |
With the env override set (every profile launch sets it to the
profile’s own dir), only that dir is granted, on macOS and Linux: not
the default dir, Pi’s ~/.pi parent, or another profile’s dir. A Pi
profile’s auth.json (logins and saved keys) and a Codex profile’s
auth.json are therefore reachable only from that profile.
Codex also reads personal skills from ~/.agents/skills, a path
shared by every Codex profile (and by other harnesses that read it).
It holds no login state, so it is resource and policy sharing rather
than an authentication leak. The sandbox does not grant it on either
platform; if you grant it (readable_extra, or a symlink from a
profile’s skills dir), or run without the sandbox, every profile sees
the same skills. Keep per-profile skills in $CODEX_HOME/skills.
Claude Code’s files outside the config dir
When CLAUDE_CONFIG_DIR is set (every profile launch sets it to the
profile’s own dir), Claude Code keeps .claude.json (account and
project state), settings.json and .credentials.json inside that
dir, and keys its macOS Keychain entry to it. The sandbox then grants:
- the profile’s config dir, and on macOS its sibling lock
(
~/.claude-<profile>.lock) used while refreshing a login; - shared install and cache paths that hold no login state:
~/.local/bin/claude,~/.local/share/claude,~/.local/state/claude,~/.cache/claude(also inside the general~/.cachegrant) and~/.mcp.json; - read-only managed settings under
/Library/Application Support/ClaudeCode.
It does not grant the global ~/.claude.json, ~/.claude.lock,
~/.claude or another profile’s dir; Claude does not read them while
CLAUDE_CONFIG_DIR is set. Without CLAUDE_CONFIG_DIR (no profile),
macOS keeps granting ~/.claude.json and ~/.claude.lock.
Neither platform grants ~/.config/anthropic, where Claude Code
stores a keyless Claude Console sign-in and ant CLI profiles. Those
sign-ins live outside the config dir, so they are shared by every
profile that can read them. To keep one per profile, set
ANTHROPIC_CONFIG_DIR in the profile’s env: to a path inside its
config dir (for example ~/.claude-work/anthropic). See
profiles-verification.md for what is still
being verified.
Customizing Per-Profile
The preferred way to customize is through capabilities in your profile config. For fine-grained control, you can also work with guards directly:
# ~/.config/aide/profiles/work.yaml
sandbox:
denied_extra: ["~/sensitive-data"] # deny additional paths
unguard: [dev-credentials] # disable default guards
Guard configuration fields
| Field | Purpose |
|---|---|
guards | Override: use ONLY these guards (plus always guards) |
guards_extra | Extend: add guards to the default set |
unguard | Disable: remove guards from the active set |
denied | Explicit path denies (for one-off paths) |
denied_extra | Extend explicit denies without replacing defaults |
Template variables
| Variable | Resolves to |
|---|---|
{{ .project_root }} | Absolute path of the project directory |
{{ .runtime_dir }} | Agent runtime/state directory |
Network configuration
Network can be set as a simple string or a structured block with port filtering:
sandbox:
network: outbound
# or with port filtering:
sandbox:
network:
mode: outbound
allow_ports: [443, 80]
deny_ports: [22]
Named Profiles
Named sandbox profiles let you define a sandbox policy once and reference it by name across multiple aide profiles.
Manage profiles
aide sandbox create <name>
aide sandbox edit <name> \
--add-denied ~/.gnupg \
--network outbound
aide sandbox remove <name>
aide sandbox list
Reference a profile in config
# ~/.config/aide/profiles/secure.yaml
sandbox: strict
aide loads the strict sandbox profile (from ~/.config/aide/sandbox.yaml) and applies it to the secure aide profile.
Yolo Mode and Sandbox
yolo: true in config or --yolo on the CLI disables the agent’s own permission checks (e.g. Claude’s --dangerously-skip-permissions). The OS sandbox remains fully active. Yolo mode does not weaken the sandbox; it only removes the agent’s interactive approval prompts.
Use --no-yolo to override config-based yolo and restore agent permission checks.
Disabling Sandbox
Set sandbox: false in your profile config to disable sandboxing entirely for that profile. The agent runs with full filesystem and network access, subject only to OS-level user permissions.
# ~/.config/aide/profiles/local-dev.yaml
sandbox: false
Trust Gate
When a .aide.yaml file exists in a project, aide checks its trust status before applying it. This prevents untrusted project configs from modifying your sandbox policy.
| Status | Behavior |
|---|---|
| Trusted | Config applies normally |
| Untrusted | Config is shown but not applied; a warning prints |
| Denied | Config is silently skipped |
Manage trust with:
aide trust # trust the .aide.yaml in the current directory
aide deny # permanently block it
aide untrust # remove trust without blocking
To launch without applying .aide.yaml regardless of trust status:
aide --ignore-project-config
When aide itself modifies .aide.yaml (via aide cap enable, aide sandbox allow, etc.), it auto-re-trusts the file if the previous version was trusted.
Trust is keyed on the file’s canonical parent directory path and contents (a symlinked .aide.yaml is keyed on its own location, never via its target). When .aide.yaml is absent at launch, bubblewrap does not create a placeholder file on the host (keeping git status clean); any newly created or modified .aide.yaml is caught by internal/trust SHA-256 verification before launch or hot restart. When a symlinked .aide.yaml sits inside a writable ancestor such as projectRoot, bubblewrap binds the resolved target read-only and emits a warning on stderr because bubblewrap cannot prevent unlinking the symlink itself (internal/trust still catches replacement).
Under the Hood
Capabilities are the user-facing concept, but under the hood aide translates them into guards - small, composable policy modules that each protect a specific resource. Guards are the low-level mechanism that generates the actual sandbox profile.
Guard inventory
aide ships with 14 built-in guards across three tiers (13 active out of the box):
Always guards (9) - cannot be disabled, form the baseline policy:
base, system-runtime, network, aide-control, filesystem, git-integration, keychain, node-toolchain, nix-toolchain
aide-controlprotects aide’s own control, trust, and config state against tampering from inside the sandbox: full read+write deny on$XDG_STATE_HOME/aide(~/.local/state/aide, holdingctl/<pid>/,runtime/,ui-bridge.key,sessions/,preferences.json) and$XDG_CONFIG_HOME/aide/secrets; write-only deny on$XDG_DATA_HOME/aide(~/.local/share/aide),$XDG_CONFIG_HOME/aide,<projectRoot>/.aide.yaml, and<mainWorktree>/.aide.yaml. (filesystemno longer grants write access to~/.local/share/aide.)
Default guards (4) - active out of the box, can be disabled with unguard:
project-secrets, dev-credentials, aide-secrets, multiplexer
multiplexerisolates parent terminal multiplexers by blocking Unix control sockets,$XDG_RUNTIME_DIRglobs, state directories, and control environment variables across Rex (rex), Herdr (herdr), tmux (tmux), WezTerm (wezterm), Zellij (zellij), and Kitty (kitty). Enable the corresponding opt-in capability (--with rex, etc.) only when you explicitly want out-of-sandbox multiplexer access. Whenbivouacis active without--with herdr,multiplexerkeeps~/.local/state/herdr/client(saved-machine metadata) writable while blockingherdrmultiplexer control sockets and state.
Opt-in guards (1) - not active by default; enabled automatically when a capability that needs it is active (the ssh capability):
ssh
The git-remote guard is retired: it only re-allowed outbound HTTPS, which the network rules already decide, so it never restricted git remotes. A config that still lists it loads and gets nothing; remove it with aide sandbox unguard git-remote. Git Credential Manager’s config is now read by git-integration.
Guard commands
These commands are available for power users who want to inspect or adjust guards directly:
aide sandbox guards # List all guards with status
aide sandbox guard dev-credentials # Enable a guard
aide sandbox unguard dev-credentials # Disable a guard
aide sandbox types # List guard types
aide sandbox test # Preview generated sandbox profile
All commands accept --profile <name> to target a specific profile.
Quick CLI adjustments
# Add a path to the deny list
aide sandbox deny <path>
# Restrict outbound to specific ports
aide sandbox ports 443 8080
# Set network mode
aide sandbox network outbound
aide sandbox network none
aide sandbox network unrestricted
# Revert sandbox config for the profile to defaults
aide sandbox reset
# Save a change and hot-restart a matching active session (with confirmation)
aide sandbox allow ~/shared-docs --write --restart
aide sandbox network outbound --restart
aide sandbox allow, aide sandbox deny, and aide sandbox network (as well as aide cap enable|disable and aide gateway use) accept --restart, --ui-bridge-stdin, and target flags (--pid, --pane, --rex-block, --cwd) to hot-restart an active session after saving. Confirmation proof runs before mutating config, and a failed apply rolls back config and trust snapshots.
Platform Details
| Platform | Mechanism | Isolation tier | Notes |
|---|---|---|---|
| macOS | sandbox-exec (Seatbelt) | primary | Generates a .sb profile dynamically at run time |
| Linux (kernel ≥ 6.7) | Landlock (ABI ≥ 4) | primary | Full filesystem + TCP port enforcement |
| Linux (kernel 5.13–6.6) | Landlock (ABI 1–3) | primary / degraded | Filesystem isolation; TCP port filtering unavailable (degraded if port rules configured) |
| Linux (no Landlock) | bubblewrap (bwrap) | degraded | Filesystem namespace isolation; no per-port TCP control |
| Linux (no Landlock, no bwrap) | - | unavailable | Agent launches with a warning; no OS-level isolation |
Supported Linux tier (minimum system requirements)
For primary isolation on Linux:
- Kernel ≥ 6.7 (ships Landlock ABI 4 with TCP port enforcement)
- Landlock enabled in the kernel LSM list (
/sys/kernel/security/lsmcontainslandlock)
For degraded isolation (filesystem only, no port filtering):
- Kernel ≥ 5.13 (Landlock ABI 1) - or -
bwrapon PATH
When neither is available, aide logs aide: warning: OS-level sandboxing unavailable to stderr and launches the agent without restriction. Run aide sandbox show to confirm the active tier.
Linux vs macOS differences
- Filesystem: macOS Seatbelt enforces per-subpath rules including glob patterns. Landlock enforces directory- and file-level allow rules without native deny rules: aide enforces a deny nested inside a read-only grant by splitting that directory grant into per-entry file-read grants at launch while keeping directory listing (
LANDLOCK_ACCESS_FS_READ_DIR) on the split tree (denied file contents are unreadable, though directory entry names under the split tree remain listable, and entries created inside a split directory after launch are not readable until the next launch), whereas a deny nested inside a writable grant (such as the project directory) cannot be enforced by Landlock; bubblewrap enforces both. See thenever_allowplatform note in docs/capabilities.md. /runnarrowing andWriteDeniedseparation: On Linux,linuxSystemWritableincludes only/dev,/dev/pts, and/dev/shmand excludes blanket/run(explicitly mounting/run/systemd/resolveread-only for DNS) so/run/user/<uid>/multiplexer and session sockets are never exposed by default. ForWriteDeniedpaths (.aide.yaml,~/.config/aide,~/.local/share/aide),bwrapmounts existing write-denied files and covered directories read-only (--ro-bind-try) and re-binds strict agent-vouched writable descendants (such as~/.config/aide/claude) afterward, whereas Landlock marks write-denied paths inside a writable ancestor# not enforcedinaide sandbox test.- Network and Unix sockets: Both enforce mode (outbound / none / unrestricted). Port allow/deny lists require Landlock ABI ≥ 4 on Linux; all ports apply on earlier kernels. Abstract Unix sockets (
unix:@..., such asKITTY_LISTEN_ON=unix:@...) live in the kernel network namespace rather than the filesystem and requirenetwork: none(--unshare-netunderbwrap) to block. For filesystem pathname Unix sockets (multiplexerguard), macOS Seatbelt and Linuxbwrapblockconnect(AF_UNIX)at the kernel/namespace layer; Linux Landlock (ABI ≤ 5) blocksopen/readdiron multiplexer socket and state directories (paired withenvscrubstripping multiplexer env vars), whileaide’s ownapi.sockenforcesSO_PEERCREDpeer-PID ancestry rejection unconditionally. - Per-generation
memfdand Seatbelt profile lifecycle: On Linux, policy and seccompmemfds (ApplyResult.ExtraFiles) are tracked per generation and closed immediately after child launch (ApplyResult.Close()), avoiding fd leaks acrosssessionhosthot restarts. On macOS, generated Seatbelt profiles (sandbox.sb, secret-free) are written atomically to$XDG_STATE_HOME/aide/runtime/aide-<pid>/(0700dir,0600file, shielded from OS temp-dir reaping and denied to agents byaide-control), recreated/verified before each hot-restart generation, and removed on exit, signals, or next-launch stale cleanup. - Subprocess containment: macOS Seatbelt denies
process-execdirectly in the profile. Linux additionally layers seccomp BPF plus a PID namespace to block subprocess spawning (clone/fork/vfork/clone3) when a profile doesn’t allow subprocesses. - GPU: device nodes are reachable under Landlock but not under the bwrap fallback, which mounts a fresh
/dev. Thegpucapability adds the sysfs and driver-registry reads GPU libraries need on Linux, and two Metal/IOSurface rules on macOS. See GPU. - Diagnostics:
aide sandbox teston Linux prints a human-readable profile; on macOS it prints the raw.sbfile.
Control API and Restart Security
Interactive sessionhost runs expose a daemonless per-instance control endpoint at $XDG_STATE_HOME/aide/ctl/<pid>/{meta.json,api.sock} (0600 files in a 0700 directory) protected by three independent layers:
aide-controlguard: always-on, non-unguardable read+write deny on$XDG_STATE_HOME/aide(coveringctl/<pid>/,runtime/,ui-bridge.key,sessions/,preferences.json) and write-deny on aide config/trust/.aide.yamlpaths.- Kernel peer-PID ancestry rejection: every
api.sockconnection verifiespeerUID == os.Getuid()and walks the OS parent-PID chain viaLOCAL_PEERPID/LOCAL_PEERCRED(macOS) orSO_PEERCRED+/proc/<pid>/stat(Linux), returning403 ForbiddenifpeerPID == aidePID,aidePIDis an ancestor, or PID lookup fails (enforced even withsandbox: false). ui-bridge.keyHMAC confirmation proof:POST /v1/applyrequiresHMAC-SHA256(ui-bridge.key, "<aidePID>:<changeSetHash>")supplied via--ui-bridge-stdinor an interactive[y/N]prompt on a separate TTY. Non-TTY or same-TTY callers without--ui-bridge-stdinexit with code78(EX_CONFIG).
Debugging
Inspect the effective policy or validate the generated platform sandbox profile for an aide profile.
# Print the effective sandbox policy as aide resolves it
aide sandbox show
aide sandbox show --profile myproject
# Generate and display the platform-specific sandbox profile
aide sandbox test
aide sandbox test --profile myproject
aide sandbox show prints the merged policy including the Isolation tier and Backend lines on Linux, so you can confirm whether you are running primary (Landlock), degraded (bwrap), or unavailable.
aide sandbox test outputs the platform-specific profile - the raw Seatbelt .sb file on macOS, or the Landlock/bwrap path summary on Linux.
Linux troubleshooting
If aide sandbox show reports an unexpected tier, check the following:
# Confirm Landlock appears in the active LSM list
cat /sys/kernel/security/lsm
# Check the Landlock ABI version the kernel exposes
aide sandbox test # look for "# Tier:" and "# Backend:" in output
# Check kernel messages for Landlock-related entries
dmesg | grep -i landlock
# Verify bwrap is available as a fallback
which bwrap && bwrap --version
If dmesg | grep -i landlock shows nothing but /sys/kernel/security/lsm lists landlock, the LSM is compiled in and active - the ABI version determines which features are available. Kernels before 6.7 support filesystem isolation (ABI 1–3) but not TCP port rules (ABI 4 required).
Cursor agent troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
cursor-agent: permission denied on ~/.cursor/ writes | Config dir not in writable set | Confirm CURSOR_CONFIG_DIR is unset or points to the correct dir; run aide sandbox show (add --profile <name> if you have multiple profiles) to inspect granted paths. |
agent update fails inside aide | Auto-update writes to ~/.local/share/cursor-agent/versions/ which is not writable inside the sandbox | Run cursor-agent update outside of aide (this is by design). |
aide does not detect cursor-agent | cursor-agent not on PATH | Confirm which cursor-agent resolves; the shorter agent symlink is not registered - use cursor-agent explicitly. |
Using the Seatbelt Library
The macOS sandbox implementation lives in pkg/seatbelt, a standalone Go library. You can import it into your own projects to build Seatbelt profiles without using aide’s CLI.
import (
"github.com/jskswamy/aide/pkg/seatbelt"
"github.com/jskswamy/aide/pkg/seatbelt/guards"
)
// Get all default guards
activeGuards := guards.ResolveActiveGuards(guards.DefaultGuardNames())
p := seatbelt.New(homeDir).
WithContext(func(c *seatbelt.Context) {
c.ProjectRoot = projectRoot
c.GOOS = runtime.GOOS
c.Network = "outbound"
})
for _, g := range activeGuards {
p.Use(g)
}
profile, err := p.Render()
Available guard constructors: guards.AllGuards() returns all registered guards. Individual constructors follow the pattern guards.BaseGuard(), guards.DevCredentialsGuard(), guards.ProjectSecretsGuard(), etc.
Attribution
The Seatbelt rules in pkg/seatbelt port the shell scripts from agent-safehouse as a Go library by Eugene Goldin. agent-safehouse provides composable Seatbelt policy profiles for AI coding agents and has validated profiles for 14 agents. The Go port makes these rules available as a library for Go applications that embed sandbox enforcement.