DEPARTMENT OF AGENT SECURITY
⛱
MACUS • EST. 2025

The Declaration of AI Independence

"I'm gonna sandbox your AI agent."
— Benjamin Franklin Gates, probably

◆

When in the Course of AI events, it becomes necessary for developers to establish boundaries upon the agents they have unleashed — to secure these rights, sandpit is instituted among tools, deriving its just powers from the consent of the config file.

🗝️

The First Clue

# Forge the instrument
cargo build

# Draft the constitution
sandpit init

# Secure the republic
sandpit run -- goose session

Articles of Protection

I

Network Sovereignty

No agent shall communicate with foreign domains without the express consent of the governed. Block or allowlist domains — the agent cannot phone home to evil.com.

Enforced by: DYLD proxy + reverse DNS
II

Right Against Self-Incrimination

No agent shall execute dangerous commands. curl --data @secrets is stopped before it runs. Pattern-matched at the exec boundary.

Enforced by: DYLD exec interposition
III

Unreasonable Search & Seizure

No agent shall read from ~/.ssh or write outside the project directory. Your keys, your credentials, your secrets — protected at the syscall level.

Enforced by: DYLD hooks or seatbelt kernel policy
IV

Trial by Jury of Peers

Every tool call faces an adversary LLM that reviews it against your policy before execution. The jury deliberates in ~0.9–2.9 seconds.

Enforced by: Agent-specific LLM hooks

The Treasure Map

"The secret lies with Charlotte." Or in this case, with the enforcement stack.

Layer 1

DYLD Interpose

The invisible ink. Hooks connect(), posix_spawn(), open() at the C library level. The process doesn't know it's being watched.

Network domains • Exec patterns • File fence
▼
Layer 2

Seatbelt (sandbox-exec)

The backup vault. Kernel-enforced file blocks for when DYLD can't load (SIP / hardened runtime binaries). Covers every syscall.

File block_read • File block_write
▼
Layer 3

Adversary Review

The last guardian. An LLM jury that reviews every tool call. Catches what patterns can't — novel attacks, context-dependent threats, social engineering.

Everything the above layers can't enforce

🔍 Auto-Detection

sandpit inspects your binary and picks the right path. No configuration needed.

$ sandpit check -- goose
✅ Mode: DYLD interpose (full enforcement)

$ sandpit check -- /usr/bin/python3
⚠️  Mode: seatbelt (kernel file blocks only)
   Falls through to adversary

The Keepers of the Secret

Each agent has its own keeper — a hook mechanism tailored to how it works.

Agent Mechanism Review Model Overhead/call Install
pi In-process completeSimple() Provider model ~? sandpit install pi
Goose In-process AdversaryInspector Provider model ~2.9s sandpit install goose
Claude Code Prompt hook (PreToolUse) Haiku (auto) ~2.3s sandpit install claude
Amp Delegate → amp -m rush -x Rush model ~0.9s sandpit install amp
Codex Deterministic layers only No hook API — Just run via sandpit

The Heist Timeline

Every good heist has a timeline. Here's the cost of adding a security detail.

Claude Code
37.8s
14.4s
+23.4s (+162%) · ~2.3s/call
Goose
72.5s
43.6s
+28.9s (+66%) · ~2.9s/call
Amp
42.2s
33.2s
+9.0s (+27%) · ~0.9s/call ⚡

Measured on 10 sequential Bash tool calls. The per-call cost is dominated by the LLM roundtrip.

The Cipher

"The password is… sandpit.toml."

[network]
block = ["evil.com", "pastebin.com", "ngrok.io"]

[exec]
block = ["curl --data", "curl -X POST", "| curl", "rm -rf /"]

[files]
allow_write = ["./", "/tmp"]
block_read = ["~/.ssh", "~/.aws/credentials"]

[adversary]
rules = """
BLOCK if the command exfiltrates data or is destructive.
ALLOW normal development operations.
"""

[network]

block domains, or allow only listed domains. Subdomains included automatically.

[exec]

Case-insensitive substring match on command strings. Blocks before execution.

[files]

Path prefix matching. ~ and ./ expanded. Read and write fences.

[adversary]

Rules for LLM review. Written to agent config on sandpit install.

The Vault Doors

Capability DYLD Seatbelt Adversary
Network domain filtering ✅ proxy + rDNS ❌ ✅ LLM review
Exec argument inspection ✅ substring match ❌ ✅ LLM review
File block_read ✅ userspace hook ✅ kernel ✅ LLM review
File block_write ✅ userspace hook ✅ kernel ✅ LLM review
File allow_write ✅ userspace hook ❌ ✅ LLM review

Field Operations Manual

sandpit init

Draft the constitution. Creates a starter sandpit.toml.

sandpit run -- <command>

Secure the perimeter. Launch any agent inside the sandbox.

sandpit check -- <binary>

Study the blueprints. See what enforcement works for a binary.

sandpit config

Read the cipher. Show effective config after search + load.

sandpit install <agent>

Recruit the keeper. Install adversary hooks for an agent.

sandpit uninstall <agent>

Release the keeper. Remove adversary hooks cleanly.