Sandbox Configuration
Happy supports OS-level sandboxing to restrict what Claude Code can access on your system. This adds an extra security layer by limiting file system access, network access, and other system resources.Sandboxing is powered by
@anthropic-ai/sandbox-runtime and provides process-level isolation using OS security features.Quick Start
Configure sandboxing interactively:- File access scope - workspace-wide or per-project
- Workspace root - directory containing all your projects
- Network mode - allowed, blocked, or custom
- Localhost binding - allow binding to localhost ports (for dev servers)
Sandbox Commands
Configure
Run the interactive configuration wizard:~/.happy/settings.json.
Status
View current sandbox configuration:Disable
Disable sandboxing without removing configuration:happy sandbox configure again.
Sandbox Modes
File Access Scopes
Control which directories Claude can read and write:Workspace Mode
Workspace Mode
Best for: Developers with a dedicated workspace directoryAccess:Configuration:
- Full read/write to workspace root and subdirectories
- Read/write to current project directory
- Shared agent state (
~/.claude/,~/.codex/) - Extra write paths (e.g.,
/tmp)
Per-Project Mode (Strict)
Per-Project Mode (Strict)
Best for: Maximum isolation, separate projectsAccess:Configuration:
- Only current project directory (read/write)
- Shared agent state (
~/.claude/,~/.codex/) - Extra write paths (e.g.,
/tmp)
Custom Mode
Custom Mode
Best for: Advanced users with specific requirementsAccess:
- Manually specified directories (read/write)
- Shared agent state
- Extra write paths
Network Modes
Control network access from Claude:Allowed (Default)
Allowed (Default)
Best for: General development workAccess:
- All outbound network connections allowed
- Can download dependencies, API calls, etc.
- Localhost binding enabled (configurable)
Blocked
Blocked
Best for: Maximum security, offline workAccess:
- All network connections blocked
- No outbound requests
- Localhost binding configurable
Custom
Custom
Best for: Selective network accessAccess:
- Allowlist specific domains
- Denylist specific domains
- Localhost binding configurable
Configuration Schema
Full sandbox configuration structure:Default Configuration
When you runhappy sandbox configure, defaults are:
Path Resolution
Sandbox paths are resolved at runtime:Tilde Expansion
~ expands to user’s home directory:
Relative Paths
Relative paths resolve from session’s project directory:Absolute Paths
Absolute paths used as-is:Protected Paths
Always Readable
These paths are always accessible for reading:- Shared agent state:
~/.claude/,~/.codex/ - System libraries and binaries
- Node.js installation
- Project directory
Recommended Deny Paths
Protect sensitive data by adding todenyReadPaths:
Recommended Deny Write Paths
Prevent accidental modification:Runtime Configuration
The sandbox configuration is converted to@anthropic-ai/sandbox-runtime format at runtime:
buildSandboxRuntimeConfig() in src/sandbox/config.ts.
Bypassing Sandbox
Temporarily disable sandbox for a single session:When to Bypass
- Testing sandbox configuration
- Troubleshooting permission issues
- One-off tasks requiring broad access
- Development in non-standard directories
Workspace Detection
Happy automatically detects common workspace directories: macOS:~/Developer~/Develop~/Workspace
~/Workspace~/Developer~/Develop
- First existing directory is suggested
- If none exist, falls back to first option
- You can manually specify any directory
Examples
Example 1: Secure Web Development
Example 2: Offline Development
Example 3: Restricted Network Access
Example 4: Multi-Workspace Setup
Troubleshooting
Permission Denied Errors
If Claude reports permission errors:-
Check current configuration:
-
Verify paths are in allowed list:
-
Temporarily disable to test:
-
Reconfigure if needed:
Network Connection Failures
If Claude can’t access network:-
Check network mode:
-
Verify domain is allowed (custom mode):
-
Temporarily allow all:
Localhost Binding Issues
If dev servers won’t start:-
Check
allowLocalBindingis enabled: -
Reconfigure to allow:
Configuration Not Applied
If changes aren’t taking effect:-
Verify settings file:
-
Restart session:
-
Check for override flags:
Security Best Practices
Related Commands
happy --no-sandbox- Bypass sandbox for one sessionhappy doctor- Diagnose sandbox issueshappy daemon- Daemon respects sandbox config