Overview
Agent Safehouse provides two primary customization mechanisms:- Machine-local overrides (
.safehouseconfig files) --append-profileflag (runtime policy overlays)
Machine-Local Overrides
Workdir Config Files
Place a.safehouse file in your project root to configure project-specific grants:
Shell Environment Variables
Set environment variables in your shell profile (~/.zshrc, ~/.bashrc):
Precedence Order
When the same variable is set in multiple locations:Path grants are merged across all sources (CLI + ENV + config). Later sources append to earlier ones.Feature flags (
--enable) are replaced (not merged). CLI --enable overrides ENV SAFEHOUSE_ENABLE, which overrides config SAFEHOUSE_ENABLE.--append-profile Flag
Purpose
Append a custom.sb file to the end of the generated policy. This is the final extension point in the assembly order.
Use Cases
Deny Sensitive Paths
Block access to specific directories even if earlier rules allowed them:
Ad-Hoc Grants
Quickly grant access to a new tool or path without editing committed profiles:
Testing Policy Changes
Iterate on policy rules before committing them to the repository:
Environment-Specific Rules
Apply machine-specific grants without editing source profiles:
Multiple Appended Profiles
Pass--append-profile multiple times. They are concatenated in order:
Last Rule Wins
Because--append-profile rules are emitted last in the policy assembly order, they override earlier rules:
deny rule wins because it comes last.
Comparison: When to Use Which
| Scenario | Recommended Approach | Why |
|---|---|---|
| Project-specific extra directories | Workdir .safehouse config | Per-project, version-controlled, no CLI friction |
| Machine-wide defaults | Shell ENV vars (~/.zshrc) | Applies to all invocations, no per-project setup |
| One-off path grant for debugging | CLI --add-dirs=/tmp/foo | Fastest, no file editing |
Block sensitive path (e.g., ~/.ssh) | --append-profile with deny rule | Deny rules must come last to override allows |
| Test new integration before committing | --append-profile=./test.sb | Iterate quickly without editing profiles/ |
| Machine-specific tool access | --append-profile=~/machine-local.sb | Persistent but not committed to repo |
| Enable Docker/SSH for all projects | Shell ENV SAFEHOUSE_ENABLE=docker,ssh | Machine-wide, no per-project config |
| Temporary feature enable | CLI --enable=clipboard | One-off, no config file changes |
Example Workflows
Workflow 1: Project-Specific Reference Repo
You’re working on~/projects/myapp and need read-only access to ~/reference/design-system.
Workflow 2: Block Cloud Credentials
You want to ensure agents never access~/.aws or ~/.config/gcloud, even if cloud-credentials integration is enabled.
Workflow 3: Machine-Wide Docker + SSH
You want Docker and SSH enabled for all agent invocations on your machine.Debugging Overrides
Inspect Effective Config
Use--explain to see which config sources were loaded:
Check Policy for Appended Rules
Generate policy and search for your appended profile:Best Practices
Use Workdir Config for Projects
Commit
.safehouse to your repo for team-shared project grants. Keep machine-specific overrides in ENV or --append-profile.Use ENV for Machine Defaults
Set
SAFEHOUSE_ENABLE, SAFEHOUSE_ADD_DIRS_RO in ~/.zshrc for your personal workflow defaults.Use --append-profile for Denies
Deny rules must come last to override allows.
--append-profile is the only way to guarantee last-rule-wins.Test Before Committing
Use
--append-profile=./test.sb to iterate on new rules before moving them to profiles/.Environment Variable Reference
| Variable | Type | Description | Example |
|---|---|---|---|
SAFEHOUSE_ENABLE | String (CSV) | Comma-separated optional integration features | docker,ssh,clipboard |
SAFEHOUSE_ADD_DIRS_RO | String (colon-separated) | Read-only directory grants | $HOME/docs:$HOME/reference |
SAFEHOUSE_ADD_DIRS | String (colon-separated) | Read/write directory grants | $HOME/scratch:/tmp/work |
SAFEHOUSE_APPEND_PROFILE | String (colon-separated) | Paths to .sb files to append | $HOME/overrides.sb:$HOME/deny.sb |
SAFEHOUSE_WORKDIR | String (path) | Override working directory | /Users/alice/projects/myapp |
SAFEHOUSE_TRUST_WORKDIR_CONFIG | 1 or 0 | Enable workdir config trust | 1 |
All path variables (
SAFEHOUSE_ADD_DIRS_RO, SAFEHOUSE_ADD_DIRS, SAFEHOUSE_APPEND_PROFILE) support colon-separated lists:Next Steps
Write Custom Profiles
Learn how to write your own
.sb files with matchers and real examples.Policy Architecture
Understand assembly order, profile layers, and dependency system.