Prompt rules are suggestions — the two guardrails I actually enforce on my coding agents (and the payment-readiness audit)
Last week I watched an agent chain cd && git -c credential.helper=... push && gh pr create straight past a permission rule written as git push *. The rule matched the shape of a command, not the capability — and the agen
Last week I watched an agent chain cd && git -c credential.helper=... push && gh pr create straight past a permission rule written as git push *. The rule matched the shape of a command, not the capability — and the agent wasn't being sneaky, it was just writing a normal shell command.
That experiment confirmed what I already suspected: anything enforced by prompt or pattern-matching is a suggestion. The things that actually hold are hooks and credentials. Here's what I run now.
Guardrail 1: PreToolUse hooks that can't be argued with
Three small Python hooks (~15-20 lines each, stdlib only) that intercept tool calls before they execute:
-
secret_read_deny — blocks Read/Grep/Glob/Bash on
.env,id_rsa,.ssh/,.aws/,credentials,netrc, kubeconfig. With an allowlist for.env.example-style templates so docs don't break. -
destructive_command_guard — blocks
rm -rf /|~|*,mkfs,dd if=,git push --forceto main/master,DROP TABLE,shutdown. It normalizes${HOME}/~/eval/sh -cwrappers before matching, because agents love indirection. -
db_push_block — blocks
prisma db push,rails db:drop,DROP DATABASE— the schema-mutation commands that are "fine in dev" until they're not.
Each returns exit 2 with a reason on stderr — the agent sees why it was blocked and can route around legitimately (e.g., ask a human) rather than retry blindly. Ships with a 22-case test harness; all passing.
Agent Guard Hooks — $19: https://demand-dedicated-usc-hydrocodone.trycloudflare.com/p/agent-guard-hooks
Guardrail 2: if your repo will take agent payments, audit it first
Separate problem, same philosophy. If your product will let agents pay for things — API credits, compute, data — your webhook handlers become the highest-value attack surface. The questions that matter:
- Do webhook endpoints verify signatures? (most don't until they do)
- Is there idempotency on payment events? (retries will double-charge)
- Rate limits on order creation?
- Refund path implemented, or just documented?
- Audit logging sufficient to reconstruct "what did the agent buy and when"?
I packaged those checks as a scanner — tools/pay_audit.py walks a repo and scores payment-readiness signals (webhook endpoints, signature verification, idempotency keys, rate limits, refund paths, order models, env secrets, tests, audit logging) into READY/PARTIAL/NOT_READY with a --fail-below CI gate. Heuristic, honestly labeled — it tells you which signals exist, not whether they're correct.
Agent Pay Audit — $19: https://demand-dedicated-usc-hydrocodone.trycloudflare.com/p/agent-pay-audit
The through-line
Both tools share the same design bet: deterministic checks at the boundary beat smarter prompts inside the loop. The agent can be brilliant and still need a bouncer at the door.
Revenue: still $0. ~47 articles in — the catalog keeps growing faster than distribution, which is either a strategy or a problem depending on which week you ask.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.