jskswamy/aide 是一个托管在 GitHub 上的开源项目,主要使用 Go 编写,采用 MIT License 许可证,目前获得 20 个 Star、2 次 Fork。
仓库全名
jskswamy/aide
README 摘要
aide OS-native sandbox and profile launcher for coding agents on macOS and Linux. Sandbox - Kernel-enforced filesystem and network boundaries with zero config. Capabilities - Grant scoped tool access (docker, aws, k8s, ssh, and 30+ more) only when a task needs it. Profiles - Isolate work and personal agent accounts, history, plugins, and MCP servers per repository. Gateways - Configure corporate proxies, OpenRouter,…
Coding agents run shell commands, read files, and invoke external tools using your user account’s full privileges. Running them without OS sandboxing and profile isolation creates four common risks:
Accidental credential exposure - Debugging a build or deployment can cause an agent to read ~/.aws/credentials, ~/.kube/config, ~/.ssh, or .env and send those secrets to the model context and provider logs.
Prompt injection and repo tampering - Untrusted code, READMEs, dependencies, or MCP (Model Context Protocol) tool responses can steer an agent to exfiltrate files outside the repository or modify .git/hooks to execute code on your next commit.
Approval fatigue - Reviewing hundreds of per-command permission prompts leads developers to stop reading them or pass --dangerously-skip-permissions, exposing the entire home directory.
Cross-account leakage - Sharing one agent home directory (such as ~/.claude/) across jobs and personal repos exposes work MCP servers, session history, and API keys inside personal projects, and vice versa.
aide enforces a deny-by-default sandbox natively on macOS (Seatbelt) and Linux (Landlock + seccomp, with a bubblewrap fallback on older kernels), paired with profile isolation, encrypted secrets, gateways, provisioning, and diagnostics behind one command. Your existing agent config stays untouched, and you can still run claude, codex, or any other agent directly whenever you want.
Sandbox - OS-enforced boundaries by default
With aide, your agent starts inside OS-enforced boundaries with no config required (using your default agent setup until you configure profiles; example below shows a configured work profile):
In default code-only mode, your agent can read and edit your project, run tests, and make outbound network requests, while 13 default guards (out of 14 built-in) enforce the policy and block access to SSH keys, cloud credentials, browser data, .env files, .git/hooks writes, other terminal panes, and aide’s own config. (On Linux, project-local exclusions such as .env and .git/hooks inside writable directories require bubblewrap rather than Landlock; see Platform details for the full guard list and kernel matrix.)
Need cloud or container tools for a task? Enable named capabilities:
aide --with docker # build and push images
aide --with docker,k8s # deploy to your cluster
aide --with docker,k8s,gcp # debug cloud infra too
Each capability unlocks only the paths and environment variables that tool needs—for example, Docker registry credentials, Kubernetes kubeconfig, or gcloud auth—while everything else stays blocked. Some capabilities also have to expose a credential as an environment variable rather than a scoped file path - aide flags those explicitly (see the ⚠ above) so you know what the agent can see.
Protect what matters:
aide cap never-allow ~/.kube/prod-config
aide cap never-allow --env PRODUCTION_DB_PASSWORD
Now no capability—not even k8s—can read your production kubeconfig. Because never-allow paths are added to the OS sandbox deny list, broader capabilities cannot override them. (On Linux, this holds under bubblewrap; Landlock cannot block a single file inside an already-writable directory—see docs/capabilities.md for the platform-specific workaround.) The agent can access dev and staging clusters while production remains blocked:
🔧 aide · work (🤖 claude → /usr/local/bin/claude (dir: ~/.claude-work))
📁 remote match: github.com/acme/*
🛡 sandbox: primary (Seatbelt), network outbound only
✓ k8s ~/.kube ← --with
✗ denied /Users/you/.kube/prod-config (never-allow)
Make it permanent for a project:
# .aide.yaml in your repo root
capabilities: [docker, k8s, gcp]
No flags needed next time - aide picks up the capabilities from your config.
The first time aide encounters a .aide.yaml, it shows the contents and asks you to trust it:
aide trust # approve the project config
aide deny # block it permanently
Create your own:
aide cap create k8s-dev --extends k8s --deny ~/.kube/prod-config
aide --with k8s-dev,docker # dev clusters only, production blocked
35 built-in capabilities: aws, gcp, azure, docker, k8s, helm, terraform, vault, ssh, npm, go, rust, python, ruby, java, github, gpg, gpu, terminal-browser, 6 opt-in multiplexer capabilities (rex, herdr, tmux, wezterm, zellij, kitty), and more. Or define your own.
Unified launcher - one command, any agent
Without aide, each agent requires its own CLI flags, config format, and environment variables:
claude # Anthropic API key
CLAUDE_CODE_USE_BEDROCK=1 AWS_PROFILE=work claude # or Bedrock?
codex --provider anthropic # different CLI entirely
aider --model claude-3.5-sonnet # yet another interface
With aide, you configure each profile once:
cd ~/work/project && aide # Claude with work Bedrock credentials
cd ~/oss/repo && aide # Aider with personal Anthropic key
cd ~/scratch && aide # auto-detects agent on PATH, zero config
Same command everywhere. aide resolves the right agent, credentials, and sandbox from your project directory.
Session visibility - live status in your terminal
When aide hands off to the agent, the terminal switches to the agent’s full-screen TUI. Any info aide printed before the handoff disappears. One command pins it back:
aide statusline claude --install
From that point, a compact status bar appears at the bottom of Claude Code on every update:
🔒 | 🌐 | ⚡ k8s,docker
Each indicator reflects live session state - sandbox mode, network mode, active capabilities, trust status, and matched profile - passed via environment variables at launch.
What it shows by default:
Module
State
🔒 / 🔓
Sandbox on / off
🌐 / 🌍
Network outbound only / unrestricted (hidden or 🚫 when none)
⚡ k8s,docker
Active capabilities (hidden when none)
⚠️
Untrusted .aide.yaml (hidden when trusted)
📁 work
Matched profile name (hidden when none)
🚨
Auto-approve active (always shown when set)
If you already have a statusline configured, --install wraps it instead of replacing it - your existing tool keeps running and aide’s output appears alongside it.
Configurable: reorder modules, swap icons, or silence individual states in ~/.config/aide/config.yaml or .aide.yaml. See CLI Reference and Configuration.
Mid-session permission controls (Ctrl+B m / Ctrl+]) and --resume
On interactive terminals, aide runs a lightweight supervisor around the agent (pass --no-session-host to disable):
Press Ctrl+B m (works in any terminal, no tmux required; use Ctrl+] if tmux uses Ctrl+B) to open a 4-tab menu for permissions and sandbox rules, runtime routing, usage and redacted diagnostics, and active sessions. Press Ctrl+B twice to send a literal Ctrl+B to the agent.
Quick-stage denied paths: aide detects permission denials in recent output and lets you press Tab to stage the matching capability or path grant.
Human-confirmed restart: Running sandboxes are never weakened in place. Applying staged changes validates the policy, asks for keyboard confirmation, and restarts the agent into a fresh sandbox via aide --resume across all 12 supported agents.
Standalone dashboard (aide config, aide init --ui) and aide usage
Run aide config (or aide init --ui, or aide setup on an interactive terminal, or press Ctrl+O inside the mid-session menu) to open an interactive configuration dashboard covering onboarding, profiles and match rules, capabilities and sandbox, provisioning sync, aide doctor, and cross-profile spend reporting.
Run bare aide usage on an interactive terminal to open the 4-view usage dashboard (overview KPIs, trend charts and calendar heatmap, agent/model/profile breakdown, and searchable sessions). Pass --raw, pipe output, or pass explicit subcommands like aide usage daily for plain-text output.
Multiplexer control and integrations (aide session, aide restart, aide mux)
Inspect, stage, apply, or restart a running session from another pane with aide session and aide restart. Install native keybindings for Rex, herdr, tmux, WezTerm, Zellij, or kitty with aide mux <tool> install. Control sockets are isolated from the sandboxed agent and its subprocesses, and applying permission changes always requires human confirmation. See docs/multiplexers.md and DESIGN.md for protocol and security details.
Storing plaintext API keys in .env files or wrapper scripts risks accidental commits and requires manual setup on every new machine.
With aide, secrets are encrypted at rest with the age encryption tool (via SOPS) and never exist as plaintext on disk:
aide secrets create personal --age-key age1abc... # encrypted with your key
Config and encrypted secrets live in git. Clone your config on a new machine and you’re done. No shared secrets, no plaintext on disk.
Quick Start
curl -sSfL https://raw.githubusercontent.com/jskswamy/aide/main/install.sh | sh
Then run aide in any repository (or aide --agent codex to select a specific agent):
cd your-project && aide
Other install methods (Homebrew, Nix, Go, release binaries), verifying the install, first commands, and upgrading are in docs/install.md.
Passing args to your agent
Everything after -- is forwarded directly to the agent:
# Add an MCP server through aide's sandbox
aide -- mcp add --transport http 1mcp "http://127.0.0.1:3050/mcp" --scope user
# Run a one-shot prompt
aide -- -p "fix the failing tests and commit"
# Start with a specific model
aide -- --model sonnet
# Resume the last conversation
aide -- --resume
# Combine with aide flags
aide --with docker -- -p "build and push the image"
This works with any agent - aide resolves profile and sandbox, then execs the agent with your args appended.
How It Works
Run aide in any project directory.
aide matches the git remote URL and directory path against your config.
It resolves the profile: agent, credentials, capabilities, and sandbox policy.
Secrets decrypt in-process via sops (Mozilla’s secrets-encryption tool) using age keys. Secrets are never written to disk.
Capabilities translate to sandbox rules - each --with flag unlocks specific tool access while keeping everything else locked.
aide applies the sandbox via the platform-native enforcer - macOS Seatbelt, or Linux Landlock + seccomp (kernel ≥ 5.13, with full network port enforcement on kernel ≥ 6.7) - and execs the agent inside it. When Landlock is unavailable, bubblewrap provides filesystem-only isolation. If neither Landlock nor bubblewrap is available, aide logs a warning and launches the agent without OS-level isolation rather than refusing to run - run aide sandbox show to confirm your active tier before trusting it. See Supported Linux tier for details.
No config file? aide detects your agent on PATH and launches it directly.
Capabilities
Capabilities are task-oriented permission bundles. Instead of configuring low-level sandbox rules, you declare what you’re doing:
Need something not in the list? Create your own in one command:
# Grant access to your Bazel cache
aide cap create bazel --writable ~/.cache/bazel --env-allow BAZEL_HOME
# Extend a built-in with project-specific restrictions
aide cap create k8s-dev --extends k8s --deny ~/.kube/prod-config
# Bundle capabilities for a workflow
aide cap create my-deploy --combines docker,k8s,aws
Custom capabilities work the same as built-ins. Use them with --with, persist them in .aide.yaml, or share them across projects via your global config:
# ~/.config/aide/sandbox.yaml
capabilities:
bazel:
writable: ["~/.cache/bazel"]
env_allow: [BAZEL_HOME]
# .aide.yaml in a repo (shared with the team)
capabilities: [docker, k8s, bazel]
aide cap show bazel # inspect what it grants
aide cap check bazel,docker # preview composition before launching
Global protection:
aide cap never-allow ~/.kube/prod-config # no capability can ever read this
aide cap never-allow --env VAULT_ROOT_TOKEN # this env var is always stripped
Configuration
All config lives under ~/.config/aide/ (or $XDG_CONFIG_HOME/aide/), split by concern into config.yaml, sandbox.yaml, provisioning.yaml, and one flat file per profile under profiles/<name>.yaml.
Minimal config:
# ~/.config/aide/config.yaml
agent: claude
secret: personal
env:
GITHUB_TOKEN: "{{ .secrets.github_token }}"
Multi-profile config:
# ~/.config/aide/config.yaml
default_profile: personal
Profiles match git remote URL patterns and directory path globs. The most specific match wins. default_profile is the fallback. See docs/configuration.md for the full reference.
Gateways
Point Claude, Pi, Oh My Pi, OpenCode, or Codex at a hosted service, a company proxy, or a local model server without hand-editing YAML:
aide gateway add corp --url https://llm.example.com --profile work
aide gateway use corp --agent claude --profile work # choose it; aide never picks for you
aide --gateway none # this launch uses Claude's own login
The key is stored age-encrypted, each agent’s config gets an aide-<name> entry that names a variable and never the key, and gateway_choice: records which gateway each agent uses. By default a custom gateway serves all five gateway agents (claude, pi, omp, opencode, codex); pass --agents to restrict it. Adding a gateway never changes how existing launches authenticate. When claude or codex has gateways marked and no choice, aide opens a picker on a terminal and exits with code 78 in a script. Upgrading migrates older gateway config automatically (with backups; preview with aide config migrate). See Gateways in docs/configuration.md.
Secrets
Secrets are sops-encrypted YAML files using age keys. aide handles the full lifecycle without requiring the sops CLI at runtime.
aide secrets create personal --age-key age1abc... # Create (opens $EDITOR)
aide secrets edit personal # Decrypt, edit, re-encrypt
Secrets decrypt in-process at launch and never exist as plaintext on disk. See docs/secrets.md.
Provisioning - stop reinstalling your plugins on every machine
New machine means reinstalling every plugin by hand - miss one (say, commit-tools) and you won’t notice until your commit messages look different from your other machine. Across a team it’s the same drift, compounded: onboarding docs go stale, and six months later nobody’s plugin set matches anyone else’s.
Declare it once in provisioning.yaml and reconcile with one command:
# ~/.config/aide/profiles/work.yaml
agent: claude
config_dir_name: work # → CLAUDE_CONFIG_DIR=~/.claude-work
aide sync --plan # preview the diff
aide sync # apply (plugins land in ~/.claude-work/)
aide plugin list # declared / installed / managed view
aide adopt # bring hand-installed items under management
The state file managed.json in aide’s state directory
($XDG_STATE_HOME/aide, default ~/.local/state/aide) is per-profile,
so syncing your work profile never disturbs your personal plugin
set. aide which shows a drift banner whenever your config drifts
ahead of what’s installed, so the gap doesn’t go unnoticed.
The other half: per-profile config dirs
The reason you can declare different plugin sets for different
projects is that each profile can carry a config_dir_name:.
Without it, every claude invocation reads from one shared ~/.claude/ directory—work and personal plugins collide, client A’s session history appears in client B’s repository, and experimental MCP servers load in production projects.
config_dir_name: work tells aide’s claude driver to set
CLAUDE_CONFIG_DIR=~/.claude-work everywhere: at launch, during
aide sync, during aide adopt, during plugin/MCP list. The
agent reads from and writes to that directory and that directory
only. Your personal claude state in ~/.claude/ stays untouched.
Switch profile and it’s a different dir entirely.
The same idea works for gemini (GEMINI_HOME), codex
(CODEX_HOME), copilot (COPILOT_HOME) - different env-var name,
same shape from your point of view. You write config_dir_name: <name>,
aide handles the per-agent env quirks.
cd ~/.config/aide
git init && git add -A && git commit -m "aide config"
Encrypted secrets are safe to commit. Only holders of the age private key can decrypt.
Docker / CI: copy the config into the image, but inject the age key at runtime, not build time - an ENV or ARG with the key becomes part of the image’s layer history. Requires the agent binary (e.g. claude) to be installed and on PATH.
COPY aide-config/ /root/.config/aide/
docker run -e SOPS_AGE_KEY="$(cat ~/.config/sops/age/keys.txt)" your-image \
aide --agent claude -- -p "run tests"
Same idea in CI: store the key as a repository secret and pass it via env at job-run time. See docs/deployment.md for the full GitHub Actions example.
Diagnosing a failed run
When the agent exits with a cryptic message (or with no message at all), re-run aide with --diagnose:
aide --diagnose
aide will:
Run the agent normally with stdin/stdout passthrough.
Capture the agent’s stderr (last 200 lines / 64 KB by default).
On exit, print a short summary and write a full markdown report to ~/.cache/aide/diagnose/<timestamp>-<id>.md (or $XDG_CACHE_HOME/aide/diagnose/... if set).
The report is redacted - no secret values, no hostnames - and is suitable to paste into a GitHub issue.
For sandbox-related failures on macOS, add --diagnose-trace to additionally capture sandbox-deny events from log show:
--diagnose switches the exec strategy from syscall.Exec (process replacement) to fork+exec so aide can stay alive to gather post-mortem data. Default runs are unaffected. --diagnose-trace is macOS-only in v1.
Supported Agents
Launchable harnesses (12): Agy (Antigravity), Aider, Amp, Claude, Codex, Copilot, Cursor (cursor-agent), Gemini, Goose, OMP, OpenCode, Pi. (hermes is also supported for hook provisioning.) Any binary on PATH works as an agent target.
Development
nix develop # Full dev environment (Go 1.26, Zig 0.17.1, pkg-config, linters)
make libghostty-vt # Build static libghostty-vt with Zig 0.17.1
make build # Build ./bin/aide (CGO_ENABLED=1 against libghostty-vt)
make test/unit # Run tests
make lint # Run golangci-lint
Allow or deny network access by domain, port, and MIME type. Today the sandbox controls network at the transport level (outbound yes/no, port filtering). Planned: domain-level rules so an agent can reach github.com but not arbitrary hosts, and MIME-type filtering to block binary downloads while allowing API calls.
Command deny list
Block dangerous commands by name - rm, sudo, chmod, kill, etc. Instead of requiring users to know the binary path, aide resolves each command name through $PATH at sandbox build time and denies process-exec on the resolved binaries. One line in config:
评论