← All projects
Project record1 mention
Originally shared on Hacker News

Agent-email-guard

Open-source (MIT) blast-radius control for email sent by AI agents and applications, pulled out of AgentiSend's email API. Caps emails per hour/day/month and per minute, blocks near-repeats to the same inbox, provides a kill switch and holds marked recipients until a person approves; ships as a Claude Code PreToolUse hook, an MCP proxy for Cursor/Codex/Claude Desktop, and libraries for Node, Python, PHP, and Go wrapping nodemailer, SES, Resend, Postmark, or SMTP.

Last shared
01 / The problem

What it addresses

When an agent's send tool times out, the model retries and each retry changes a word, so idempotency keys never match — e.g. 400 attempts to send one customer the same receipt with 5 going out. Agent-email-guard limits the blast radius of runaway agent email sending.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. Agent-email-guard

    Open-source (MIT) blast-radius control for email sent by AI agents and applications, pulled out of AgentiSend's email API. Caps emails per hour/day/month and per minute, blocks near-repeats to the same inbox, provides a kill switch and holds marked recipients until a person approves; ships as a Claude Code PreToolUse hook, an MCP proxy for Cursor/Codex/Claude Desktop, and libraries for Node, Python, PHP, and Go wrapping nodemailer, SES, Resend, Postmark, or SMTP.

    Problem: When an agent's send tool times out, the model retries and each retry changes a word, so idempotency keys never match — e.g. 400 attempts to send one customer the same receipt with 5 going out. Agent-email-guard limits the blast radius of runaway agent email sending.

    Posted by @Iammnhamza · Original source ↗

    Story title · @Iammnhamza · · Source ↗

    Show HN: Agent-email-guard – agent tried to send 400 receipts, stopped at 5

    Submitted URL · @Iammnhamza · · Source ↗

    https://github.com/agentisend/agent-email-guard

    Source text · @Iammnhamza · · Source ↗

    I run AgentiSend, an email API for applications and AI agents. This is the part we pulled out and open-sourced (MIT).

    Source text · @Iammnhamza · · Source ↗

    It's blast-radius control, not a filter. Whatever the model decides: at most N emails per hour/day/month, M per minute, no near-repeats to the same inbox, a kill switch, and a hold for recipients you mark (e.g. anyone the agent hasn't emailed before) until a person approves.

    Source text · @Iammnhamza · · Source ↗

    - a Claude Code PreToolUse hook (npx agent-email-guard hook install) that checks every email-sending tool call, whichever MCP server it goes to - an MCP proxy (npx agent-email-guard mcp --wrap ...) for Cursor, Codex, Claude Desktop - a library for Node, Python, PHP and Go that wraps nodemailer, SES, Resend, Postmark or SMTP

    Source text · @Iammnhamza · · Source ↗

    The four libraries are one spec plus 49 shared test vectors, so they print the same decisions. npx agent-email-guard test runs 12 runaway scenarios (a prompt-injected forward, the 400-receipt loop, a recipient sweep, a reply-all storm) against a reference policy and shows what got through.

    Source text · @Iammnhamza · · Source ↗

    The failure it's for: an agent's send tool times out, the model retries, and each retry changes a word, so idempotency keys never match. In the demo, 400 attempts to send one customer the same receipt: 5 go out, 395 are refused.