cd /news/ai-agents/i-built-hookguard-a-50ms-local-guard… · home › topics › ai-agents › article
[ARTICLE · art-178583] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

I built HookGuard: A <50ms Local Guardrail & Loop Detector for AI Coding Agents

A developer open-sourced HookGuard, an MIT-licensed, fully local guardrail and loop detector for AI coding agents that runs with under 50ms of overhead. A single `hookguard init` command configures hooks for Claude Code, Antigravity, Cursor, and Codex CLI, enforcing a `hookguard.yaml` ruleset that blocks destructive commands like `rm -rf`, `git push --force`, `git reset --hard`, and `curl | bash`, plus reads and writes of `.env` and key files while still allowing `.env.example`. The tool tracks agent activity in a local SQLite database with warning and hard-cap thresholds at 80% and 100%, and ships a UI for reviewing that data.

key takeaway

HookGuard enforces a local YAML ruleset across Claude Code, Cursor, Codex CLI and Antigravity to block destructive commands and .env access at under 50ms overhead, with loop detection capping repeated actions at 80% warning and 100% hard stop.

by read1 min views6 publishedNov 30, 2026

Got tired of coding agents getting stuck running the same failing command over and over or trying to read .env / run git reset --hard, so I open-sourced HookGuard (MIT, 100% local, <50ms overhead).

One command (hookguard init) configures hooks for Claude Code, Antigravity, Cursor, and Codex CLI:

hookguard.yaml): rm -rf / Remove-Item -Recurse -Force, git push --force, git reset --hard, curl | bash, and .env/key reads & writes (while allowing .env.example).~/.hookguard/data.db, native node:sqlite, zero C++ deps) with 80% warning and 100% cap. hookguard ui):

GitHub: https://github.com/hediem/HookGuard Would love any feedback on rules, adapters, or features you'd want in v0.2!

── more in #ai-agents 4 stories · sorted by recency
── more on @hookguard 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-hookguard-a-…] indexed:0 read:1min 2026-11-30 · —