docs DocsCapabilitiesGitHub
Guides / Sandbox
Guides / Sandbox

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:

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.

CategoryDefault
NetworkOutbound allowed
SubprocessesAllowed

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.

AgentEnv OverrideDefault Path
Aider(none)~/.aider
AmpAMP_HOME~/.amp, ~/.config/amp
ClaudeCLAUDE_CONFIG_DIRLinux: ~/.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.
CodexCODEX_HOME~/.codex
CursorCURSOR_CONFIG_DIR~/.cursor (also $XDG_CONFIG_HOME/cursor on Linux when set)
GeminiGEMINI_HOME~/.gemini
GooseGOOSE_PATH_ROOT~/.config/goose, ~/.local/share/goose, ~/.local/state/goose
OMPPI_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)
PiPI_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:

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

FieldPurpose
guardsOverride: use ONLY these guards (plus always guards)
guards_extraExtend: add guards to the default set
unguardDisable: remove guards from the active set
deniedExplicit path denies (for one-off paths)
denied_extraExtend explicit denies without replacing defaults

Template variables

VariableResolves 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.

StatusBehavior
TrustedConfig applies normally
UntrustedConfig is shown but not applied; a warning prints
DeniedConfig 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

Default guards (4) - active out of the box, can be disabled with unguard:

project-secrets, dev-credentials, aide-secrets, multiplexer

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

PlatformMechanismIsolation tierNotes
macOSsandbox-exec (Seatbelt)primaryGenerates a .sb profile dynamically at run time
Linux (kernel ≥ 6.7)Landlock (ABI ≥ 4)primaryFull filesystem + TCP port enforcement
Linux (kernel 5.13–6.6)Landlock (ABI 1–3)primary / degradedFilesystem isolation; TCP port filtering unavailable (degraded if port rules configured)
Linux (no Landlock)bubblewrap (bwrap)degradedFilesystem namespace isolation; no per-port TCP control
Linux (no Landlock, no bwrap)-unavailableAgent launches with a warning; no OS-level isolation

Supported Linux tier (minimum system requirements)

For primary isolation on Linux:

For degraded isolation (filesystem only, no port filtering):

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

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:

  1. aide-control guard: always-on, non-unguardable read+write deny on $XDG_STATE_HOME/aide (covering ctl/<pid>/, runtime/, ui-bridge.key, sessions/, preferences.json) and write-deny on aide config/trust/.aide.yaml paths.
  2. Kernel peer-PID ancestry rejection: every api.sock connection verifies peerUID == os.Getuid() and walks the OS parent-PID chain via LOCAL_PEERPID/LOCAL_PEERCRED (macOS) or SO_PEERCRED + /proc/<pid>/stat (Linux), returning 403 Forbidden if peerPID == aidePID, aidePID is an ancestor, or PID lookup fails (enforced even with sandbox: false).
  3. ui-bridge.key HMAC confirmation proof: POST /v1/apply requires HMAC-SHA256(ui-bridge.key, "<aidePID>:<changeSetHash>") supplied via --ui-bridge-stdin or an interactive [y/N] prompt on a separate TTY. Non-TTY or same-TTY callers without --ui-bridge-stdin exit with code 78 (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

SymptomCauseFix
cursor-agent: permission denied on ~/.cursor/ writesConfig dir not in writable setConfirm 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 aideAuto-update writes to ~/.local/share/cursor-agent/versions/ which is not writable inside the sandboxRun cursor-agent update outside of aide (this is by design).
aide does not detect cursor-agentcursor-agent not on PATHConfirm 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.