$SHELL to a policy-checking shim.
Usage
-- separator before the command.
How it works
- Starts an embedded policy engine + HTTP proxy
- Creates a shell shim that checks commands before execution
- Sets
$SHELLto the shim path - Runs your command with the wrapped environment
- Every shell command goes through Rampart first
Flags
Mode:
enforce (block denies) or monitor (log only)Directory for audit logs
Bearer token for proxy auth (auto-generated if not set)
Examples
Wrap any agent
Monitor mode
Custom audit directory
Output
Startup
During execution
Commands are evaluated silently. View events with:Blocked command
Shutdown
How shell wrapping works
Shell shim
Rampart creates a temporary script that:- Intercepts
bash -c "command" - Sends command to proxy for evaluation
- Blocks if denied (exit 126)
- Executes if allowed
PATH manipulation
Rampart also creates wrappers at/tmp/rampart-shells-*/ for:
bashzshsh
$SHELL).
Coverage
Covered:- Shell commands via
$SHELL - Hardcoded
/bin/bash -ccalls - Hardcoded
/bin/zsh -ccalls - Subprocess spawns that read
$SHELL
- Direct syscalls (use
rampart preloadinstead) - Statically-linked binaries
- Non-shell command execution (Python
os.system, Node.jschild_process.execSync)
Policy loading
Wrap loads policies from:--configfile (global flag)~/.rampart/policies/standard.yaml- Embedded standard policy (fallback)
Wrap vs. other integration methods
| Method | Coverage | Setup | Use case |
|---|---|---|---|
| wrap | Shell commands only | Zero config | Agents that read $SHELL (Aider, OpenCode, Continue) |
| preload | All syscalls | Requires librampart | Agents with no $SHELL support or hardcoded paths |
| setup | Depends on agent | One-time | Native hooks (Claude Code, Cline) |
| mcp | MCP tools only | Config update | MCP servers |
Troubleshooting
Commands still bypassing
Check if agent uses $SHELL:Wrap fails to start
Check port availability:Performance concerns
Each command adds ~4μs of policy evaluation overhead. Preflight checks use HTTP but are local (localhost loopback). Measured latency:- Policy check: 4μs
- HTTP round-trip (localhost): less than 1ms
- Total overhead: ~1ms per command
Exit codes
0- Wrapped command exited successfully1- Wrapped command failed126- Command was blocked by policy- Other - Wrapped command’s exit code
Examples
Wrap Aider with custom policy
Monitor mode for testing
Multi-terminal workflow
See also
- rampart preload - LD_PRELOAD interception
- rampart setup - Native agent hooks
- rampart mcp - MCP server proxy