Code: 02_ai-engineering-code/agent-gate/agent_gate/cli.py + README.md
Problem. Autonomous coding agents leak secrets, delete files, rewrite git history, and claim "done" without proof.
What I built. A portable, stdlib-only Python guardrail (no dependencies, drop into any repo), with 53 passing tests:
before-action — classifies a command/file-change into safe vs. dangerous lanes.verify — runs a built-in secret scanner (staged-diff regex for .env, *.pem, id_rsa, oversized files) plus configurable repo adapters.done-check — blocks completion claims unless required proofs are on record; in-progress wording isn't blocked.subagent open|close — scoped leases pinning a sub-agent to a goal + allowed paths + forbidden actions, refusing to close without returned evidence.hook PreToolUse — bridges into Claude Code to block red-lane commands (exit 2).Design stance. Off by default; fail-closed; never pretends an unprovable proof is satisfied. Hardened from a real incident where a prior agent leaked secrets via git add -A and silently killed a background job.
Why it matters. Direct evidence I understand agent failure modes and build proof-based, deterministic safety around them — squarely an AI-native infrastructure concern.
This one came from getting burned: an agent leaked secrets with git add dash A and claimed it was done without ever running the thing. So I built a fence. Before a dangerous action runs, it gets classified; commits get scanned for secrets and forbidden files; and done-check refuses a completion claim unless the required proofs are actually on record. It's stdlib-only Python, fifty-three passing tests, and it wires into Claude Code as a pre-tool hook. It fails closed and it never pretends an unprovable proof passed. If you care about deploying agents safely, this is how I think about it.
GG · Applied AI Engineering portfolio · synced to youdontneedmy.help design