Quick Setup
Install Rampart service
Start the background policy server:Runs on port 9090 with token at
~/.rampart/token.Install Codex wrapper (Linux)
Create a wrapper script at This installs a shell script that wraps the real codex binary with
~/.local/bin/codex:rampart preload.Ensure wrapper is on PATH
Verify Add to
~/.local/bin is before the real codex in your PATH:~/.bashrc or ~/.zshrc to make permanent.How It Works
Wrapper Flow (Linux)
The wrapper ensureslibrampart.so is preloaded for Codex and all its children. Every exec-family syscall goes through the library.
Direct Preload (macOS)
On macOS, userampart preload directly:
DYLD_INSERT_LIBRARIES and execs codex with the Rampart library loaded.
Wrapper Script
The installed wrapper (~/.local/bin/codex) looks like:
Intercepted System Calls
The preload library intercepts all exec-family functions:Policy Configuration
~/.rampart/policies/custom.yaml
Monitoring
Live Dashboard
Audit Trail
Example Session
Terminal output with wrapper active:Platform Support
- Linux
- macOS
- Windows
Coverage: ~95% of dynamically-linked binariesMechanism: How it works:
LD_PRELOADSetup:- Wrapper at
~/.local/bin/codexshadows real codex - Calls
rampart preload -- /usr/bin/codex LD_PRELOAD=~/.rampart/lib/librampart.sointercepts all exec calls
- Static binaries cannot be intercepted
- Codex must be dynamically linked (check with
file $(which codex))
Troubleshooting
Wrapper not intercepting
-
Check wrapper is being used:
-
Verify PATH order:
-
Test wrapper directly:
Library not found
-
Check librampart.so exists:
-
Build library if missing:
-
Test library loads:
Service connection errors
-
Check service is running:
-
Check token:
-
Test with debug:
Commands not being blocked
-
Verify enforce mode:
-
Test policy directly:
-
Check audit logs:
Uninstalling
Remove Codex wrapper:~/.local/bin/codex wrapper. The real codex binary remains untouched.
Complete removal:
Advanced: Custom Agent Name
Tag Codex events with a custom agent identifier:Performance
Preload overhead:| Operation | Without Rampart | With Rampart | Overhead |
|---|---|---|---|
echo hello | 2ms | 3.5ms | +1.5ms |
git status | 45ms | 47ms | +2ms |
npm test | 3.2s | 3.202s | +0.002s |