.sb) policy modules. Contributions should maintain least-privilege security boundaries while prioritizing agent productivity and developer experience.
Project Layout
bin/ and bin/lib/
Runtime CLI and policy assembly logic (Bash)
profiles/
Authored policy modules (
.sb), organized by numeric stagetests/
Policy behavior tests and helpers
scripts/generate-dist.sh
Deterministic packaging pipeline
dist/
Generated distribution artifacts (do not edit directly)
docs/
VitePress documentation site and Cloudflare deploy tooling
Development Setup
To test your local changes (not an installedsafehouse on PATH):
Contribution Rules
- Do not hand-edit
dist/* - Make functional changes in
bin/andprofiles/, then regeneratedist/when required - Keep policy changes least-privilege; avoid broad grants unless needed
- Preserve stage ordering semantics (later rules win)
- Keep each
.sbmodule standalone for its capability
Contribution Philosophy
Agent Safehouse balances security and developer experience:- Follow least-privilege boundaries, but prioritize agent productivity
- Prefer the narrowest rule that unblocks real workflows
- If adding access to sensitive paths/integrations, document why it is needed and why narrower alternatives were insufficient
- Avoid policy churn that improves theoretical security but breaks common agent/toolchain behavior without clear benefit
Authoring .sb Profiles
File Organization
Profiles are organized by numeric stage prefix:| Stage | Purpose | Examples |
|---|---|---|
00 | Base policy structure | 00-base.sb |
10 | System runtime fundamentals | 10-system-runtime.sb |
20 | Network access | 20-network.sb |
30 | Toolchains | node.sb, python.sb, rust.sb |
40 | Shared utilities | http-clients.sb |
50 | Core integrations (always on) | git.sb, scm-clis.sb |
55 | Optional integrations | docker.sb, ssh.sb, 1password.sb |
60 | Agent profiles | claude-cli.sb, cursor.sb |
65 | App profiles | claude-desktop.sb |
Later rules win. A deny rule in stage
60 overrides an allow rule from stage 10.Profile Header Template
Every.sb file should start with:
profiles/55-integrations-optional/docker.sb
- Category: Profile classification (Base, System Runtime, Toolchain, Integration, Agent, App)
- Integration/App: Human-readable name
- Description: Brief summary of what access is granted
- Source: Relative path to this file
- Test ID marker (optional):
#safehouse-test-id:*#for ordering tests
Dependency Metadata
Use$$require=path/to/profile.sb$$ when implicit optional integration injection is needed:
profiles/60-agents/cursor.sb
$$require=...$$ is machine-read by policy assembly. ;; Requires: comments are documentation only.Rule Snippets
Local Validation
If tests cannot run because your session is already sandboxed, call that out in your PR and include static validation details instead.
Required Steps by Change Type
| Change Type | Steps Required |
|---|---|
Profiles or runtime (profiles/*.sb, bin/safehouse.sh, bin/lib/*.sh) | 1. Update/add tests 2. Run ./scripts/generate-dist.sh3. Include regenerated dist/ files in PR |
Tests only (tests/**) | 1. Run ./tests/run.sh |
Docs only (docs/**, README.md) | No dist regeneration needed |
Adding Tests
When adding new policy behavior:Use existing helpers
Leverage helpers from
tests/lib/common.sh:assert_allowed/assert_deniedassert_policy_contains/assert_policy_not_containsassert_policy_order_literal
Prefer precise tests for ordering and policy-shape regressions when changing assembly logic or module dependencies.
Pull Request Checklist
Before submitting:- Explain what changed and why
- Describe security/least-privilege impact (especially for new allow rules)
- Include test evidence (
./tests/run.shoutput) or state why tests were not runnable - Confirm whether
dist/was regenerated and committed (when required) - Verify CI passes on your branch
Design Guidance for Reviews
When reviewing contributions:- Prefer narrow path matchers (
literal>subpathwhen possible) - Avoid introducing new sensitive-path exposure unless justified
- Keep optional integrations opt-in unless required by selected profiles
- Treat policy assembly order as a first-class behavior constraint
Reference Material
For Sandbox Profile Language examples:- Primary source: Authored modules under
profiles/(style/source-of-truth for this project) - Assembled examples:
dist/profiles/safehouse.generated.sbanddist/profiles/safehouse-for-apps.generated.sb - macOS built-in profiles:
/System/Library/Sandbox/Profiles/and/usr/share/sandbox/ - External prior art: Listed in
README.mdunder Reference & Prior Art
Next Steps
Testing
Run the test suite and validate behavior
Debugging
Learn how to diagnose sandbox denials