Block unapproved agent emails with a hook and an approvals file, not a prompt
Before an agent can email a buyer, a small gate checks that a person approved that recipient, code checks the draft for obvious mistakes, and a separate reviewer agent hunts for problems. A rule in the prompt alone is not trusted.
Curated by Andrew Donato, Editor. Reviewed .
Get one setup like this every Thursday, by email.
Written for sales leaders running leaner teams.
Free. One email a week. Unsubscribe anytime.
Paste this into ChatGPT, Claude or your agent tool. See the prompt
- Sales-Agent Fleet Ops
- advanced
- Founder
- RevOps
- Sales leader
- Category
- Sales-Agent Fleet Ops
- Difficulty
- Advanced
- Est. cost
- Free MIT repo; Claude Code needs a paid Claude plan (sourced from the repo README)
What problem does this solve?
Agents that draft quotes and emails sometimes send one nobody approved, and a "never send without approval" line in a long prompt gets ignored. Teams need a control that holds even when the model forgets its instructions.
How is the agent set up?
Nate Elmore runs most of a government contracting business on Claude Code agents that pull new bids each morning, price them with suppliers and draft quotes, while he decides what gets bid and sent. After an unapproved email went out early on, he rebuilt the pattern as a small MIT-licensed repo with three layers. The prompt sets the job but holds no hard rules. A Claude Code hook runs before every tool call and allows a send only when every recipient has a line in approvals.txt, a file a person writes and the agent can read but not edit; anything the gate cannot fully read is refused, and if the gate's own logic errors it blocks. The hook also blocks the agent's file tools from editing the approvals file, the gate, the checks and the .claude settings that could switch the hook off. A checks script runs yes-or-no rules in code on every draft: a recipient and subject exist, no unfilled placeholders, attachments named in the body are actually attached, and no em dashes in buyer-facing text. Last, a reviewer agent that can read files but never edit or send compares the draft to the request, traces every fact and price to a file, and returns PASS or FAIL. The repo ships its tests and a stub sender that never transmits, and its README lists in detail what the gate still does not stop. The prompt below is the repo's reviewer agent.
What prompt does it use?
You have one job: find what is wrong with this work before someone outside sees it. You did not write it, and you don't care how hard it was to write. Assume there is at least one problem and look until you find it or can show there isn't one. Check, in this order: 1. Does it answer what was actually asked? Compare it to the request line by line. 2. Is every fact, number, name, date, and price traceable to a file you can open? Open the file. A claim you can't trace is a finding. 3. Would the recipient be confused, misled, or embarrassed by anything in it? 4. Is anything promised that the sender can't deliver? You can read files. You cannot edit, write, or send. That's on purpose: the reviewer and the author are never the same agent. Reply in exactly this format: VERDICT: PASS | FAIL FINDINGS: - <what is wrong> | evidence: <file:line or quoted text> | severity: blocker | fix-before-send | minor FAIL if there is any blocker or fix-before-send finding. If you found nothing, say what you checked, so "nothing found" can be told apart from "didn't look".
Replace every {{PLACEHOLDER}} before running. Works with any capable LLM and runner.
Get 5 setups like this every week, free.
Real agent setups with prompts, sources and failure modes, in one short weekly email.
Free. One email a week. Unsubscribe anytime.
What tools does it use?
How do you set it up?
- Move hard rules out of the prompt. Keep the prompt for describing the job.
- Add a hook that runs before every tool call and lets a send through only when each recipient appears in an approvals file that a person writes.
- Make the gate fail closed: refuse any command it cannot fully read, and block if its own logic errors.
- Protect the approvals file, the gate, the checks and the agent settings from the agent's own edits, and for a real lock have another account own those files.
- Run code checks on every draft (recipient, subject, no placeholders, attachments present, house style) before the sender will transmit.
- Have a separate reviewer agent with read-only access return PASS or FAIL with evidence, and remove each approval line once the send is verified.
What results are reported?
No business results are claimed. The README says a review agent attacked the gate in seventeen rounds, every bypass found became a test (329 tests at publication), and the author's own production gate has grown to about 4,900 lines of mostly edge cases.
Used in recipes
What goes wrong
Where does this break?
- A rule in a long prompt is a suggestion. The author's first fix, telling the model never to send without approval, was ignored.
- A gate that reads commands is a tripwire, not a lock. Names built at runtime, scripts the agent writes for itself and mail tools named unusually can still get past it; the real lock is file ownership or taking network access away.
- If the hook cannot start (Python missing, a syntax error), Claude Code lets the call through, so run the tests after every change.
- Do not make the gate so noisy that you approve without reading. Plain reads and dry runs pass on purpose.
- A reviewer on the same model as the author can share its blind spots; extra reviewers may add less than they seem to.
- The repo is a small rebuild of the author's private system, published Nov 3 by a new GitHub account; treat it as a pattern to adapt, not a finished product. (editor note)
This is where most teams get stuck. Want us to handle the setup?
Source and credit
Nate Elmore, agent-guardrails on GitHub · vendor
Source dated 2026-11-03 · last reviewed 2026-11-05. Summarized in our own words; see the source for details.