LOCAL RUST KERNEL · ZERO CLOUD API KEYS
How to Stop Claude Code From Running rm -rf
Native PreToolUse Rust blocking closes bash -c wrappers, backslash bypasses, and fail-open Python hook blind spots in under 10 ms.
Why Default Mitigations Fail
- Prompt instructions in CLAUDE.md are advisory tokens, not an execution firewall.
- Simple 40-line Python or Node hook scripts often fail open on parse errors or miss quoted bash -c subshells, backslash-escaped binaries, and short flag clusters.
- Ad-hoc shell regexes rarely record tamper-evident receipts of what was attempted and stopped.
How Vestige Solves It Locally
- Vestige wires the compiled Rust binary vestige-hook into Claude Code PreToolUse before any command touches the shell.
- Segment splitting unwraps nested shell wrappers, backslash escapes, and flag clusters across 102 deterministic rules including OP-001 through OP-114.
- Every allow and deny decision appends a hash-chained GateReceipt to local Strata storage at zero runtime API cost.
One-Command Setup Across Claude Code, Cursor, Windsurf, Codex, and Antigravity
npx @vestige/init
MCP config or verification reference:
{"mcpServers":{"vestige":{"command":"npx","args":["-y","vestige-mcp-server"]}}}
Step-by-Step Hardening Checklist
- Install Vestige hooks and MCP server locally: Run npx @vestige/init in your project or home environment so vestige-hook registers as your local PreToolUse gate across Claude Code and companion editors.
- Verify fail-closed blocking on recursive deletes: Open the live Vestige Playground firewall tab to inspect how OP-001 and OP-CLOUD-INFRA halt recursive root or home deletion before shell execution.
- Inspect blocked attempts via precedent: Call precedent inside Claude Code to inspect recorded gate stops and verify no destructive command bypassed the local safety kernel.
Documented Production Incidents & References
Frequently Asked Questions
How do I stop Claude Code from running rm -rf automatically?
Install a deterministic PreToolUse binary hook with npx @vestige/init so vestige-hook intercepts destructive recursive deletion and shell wrappers before bash executes the command.
Why do regex-only Claude Code hooks miss bash -c bypasses?
Naive string regex checks evaluate outer tokens or fail open on parsing exceptions. Compiled Rust parsing in vestige-hook normalizes wrapper commands, escapes, and bundled short flags deterministically.
Does Vestige send commands or source code to an LLM API to check rules?
No. All 102 operator rules evaluate locally in compiled Rust in single-digit milliseconds at $0.00 runtime cost.