Two hooks that block destructive shell commands before they run — and keep a tamper-evident audit log of every tool call your agent makes.
$ agent: rm -rf ./build / ⛔ Blocked by agent-guardrails: recursive/forced file removal (rm -rf) $ agent: git push origin main --force ⛔ Blocked by agent-guardrails: git push --force $ agent: rm notes.txt ✓ allowed (~2 ms, no daemon, no network)
Agents run real commands on real machines. These guards sit between the model and your shell.
rm -rf /, rm -fr build, sudo rm -rf --no-preserve-root — caught, including the tricky flag orders.
DROP TABLE, TRUNCATE TABLE, and DELETE FROM with no WHERE clause.
git push --force, git reset --hard, git clean -f.
mkfs, dd of=/dev/…, fork bombs, world-writable recursive chmod.
Every tool call appended to a JSONL log — timestamp, tool, input, cwd. Great for review and compliance.
rm notes.txt, DELETE FROM t WHERE id=1, git push origin main run untouched.
| Blocked | Allowed |
|---|---|
rm -rf / | rm notes.txt |
git push --force | git push origin main |
DELETE FROM users | DELETE FROM users WHERE id=1 |
mkfs.ext4 /dev/sda1 | docker compose up -d |
Then merge settings.example.json into ~/.claude/settings.json.
Works with Claude Code hooks, and any agent that pipes tool-call JSON to a subprocess (OpenClaw, Codex-style shells).
The regex set avoids the classic false-negatives (-fr, --recursive,
sudo rm -rf), it returns the correct exit-code semantics so the agent actually stops,
it writes structured JSONL logs, and it ships with a passing test suite (17 assertions).
Instant download. No account required.
settings.json configMIT-licensed. Read every line before you trust it.
Any agent that runs shell commands through a hook or subprocess interface: Claude Code (native hooks), plus OpenClaw, Codex-style shells, and custom runners that pipe tool-call JSON to a command.
Python 3.8+. No third-party packages. One file per hook.
Yes — add or remove regexes in the _RULES list, and point logs elsewhere with the GUARDRAIL_LOG env var.
Roughly 2 ms per tool call, with no daemon and no network access.