DEV Community

Motaz Ahmed
Motaz Ahmed

Posted on Edited on

Your AI coding agent will commit your .env unless you stop it — I built the gate

Every guardrail I've seen for AI coding agents is a suggestion. Mine is a wall.

I use coding agents daily — Claude Code, Cursor, the usual suspects. They're fast, and they're also the most over-privileged process on my machine: filesystem access, shell access, git access, network egress — all granted because the prompt said please be careful.

Three things pushed me over the edge:

  1. An agent cheerfully ran git add . and swept up a .env file. The prompt said "don't commit secrets." It did it anyway.
  2. A different agent "fixed" a test by deleting it. The suite went green. Technically.
  3. A prompt-injected README (someone's dependency, not mine) tried to steer an agent into exfiltrating SSH keys. The model almost complied — it was polite about it.

In all three cases, the guardrail was a sentence in a system prompt. A suggestion. The agent decided whether to follow it.

The insight: enforcement has to live on the action path

Prompt-level guardrails fail because the thing you're protecting against — a confused or manipulated model — is the same thing evaluating the guardrail. The fix is boring and obvious in hindsight: put a gate between the agent's intent and the effect.

Every tool call, LLM request, memory write, and file change in aiZee flows through one pipeline:

Probity → Guardian → Policy → LoopDetector → Budget → Audit
Enter fullscreen mode Exit fullscreen mode

The agent doesn't get to opt out — the kernel sits on the action path. The verdict isn't "the model thought about it." It's allow, ask, deny, modify, or observe:

  • deny — the action never runs. git add .env dies at the gate, not in a README.
  • ask — escalates to a human before executing.
  • modify — rewrites the payload (e.g., strips a flagged field) and lets the safe version through.
  • observe — log-only; for traffic you want visibility on but don't want to block.

What's actually inside

  • 139 enforcement gates across the tool-call surface — file ops, shell, git, network, memory writes, MCP calls.
  • Prompt-injection detection in three layers: regex patterns → embeddings → optional LLM judge. L1 catches the cheap stuff in microseconds; L3 handles "this README is politely asking you to run curl | sh."
  • Secret-leak checks on outbound responses — not just "don't read the key," but "don't put it in the reply either."
  • Budget enforcement per session/hour/day/PR. An agent in a retry loop burns itself out at the Budget gate, not at your Stripe dashboard.
  • Tamper-evident audit log — SHA-256 hash-chained, Ed25519-signed. If someone edits the log, the chain breaks.
  • A 53-tool MCP server (io.github.m3taz-ahmed/aizee on the official registry) so any MCP client can call into the governance layer. Tool surfaces can be frozen — aiZee fingerprints the server's advertised tools and alerts if they change (rug-pull detection). AIZEE_ENFORCE_STRICT=1 makes a frozen-surface mismatch fail closed.
  • ~250 skills + 70 workflows + 29 auto-detected personas (English and Arabic) — the "OS" part: a structured way for agents to discover and follow procedures instead of hallucinating them.
  • Hybrid memory — SQLite + FTS5 + optional vectors, bi-temporal queries ("what did the agent believe last Tuesday?"), HMAC integrity on every entry.

The numbers (because "trust me" isn't a gate)

  • ~8,000 tests, 100% coverage floor on the governed surface — enforced, not aspirational.
  • Strict mypy across 233 files.
  • MIT licensed, pip install aizee and go.

Try it

pip install aizee
aizee bootstrap --target ~/.aizee
Enter fullscreen mode Exit fullscreen mode

aizee doctor checks the install. The MCP config for Claude Code / Cursor is generated by bootstrap. Your next tool call goes through the pipeline whether your agent likes it or not.

Repo: https://github.com/m3taz-ahmed/aizee

What's next

PyPI and the official MCP registry are shipped. Community listings are in-flight (a couple of directories still indexing). The roadmap is shaped by which gates people trip first — if your agent has done something that made you wince, tell me; there's probably a gate for it, and if there isn't, that's the next one.

Feedback genuinely wanted: which verdict would you use more — modify (rewrite dangerous payloads) or ask (human-in-the-loop)? There's a real design tension there and I've flip-flopped twice.

Top comments (0)