martin1847/evolab / skills/agent-mail
agent-mail
Verified多编排者/长期 agent 身份之间的异步信箱总线——发信、收信、回信、归档、名册注册。每个身份一个 inbox,一封信只有一个去处(收件人 inbox),收信只查自己信箱。触发:给另一个编排者/CTO/agent 写信或提议、查我的信箱、跨编排者协调、看有哪些注册身份。不用于人类电子邮件(gmail/给真人同事或客户写信)或普通消息转发。可选伴随 cto-orchestration 使用(多编排者场景)。Use when writing to / reading mail from another orchestrator agent, coordinating across orchestrators, or managing the agent roster; NOT for human email.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.7 KB |
| agentmailexecutable | script | 16.9 KB |
| hooks.json | config | 885 B |
| mail-check.pyexecutable | script | 6.7 KB |
| mail-guard.pyexecutable | script | 3.7 KB |
mail-guard.py
View on GitHub#!/usr/bin/env python3
# mail-guard — PreToolUse guard: deliver mail through `agentmail send`, never by direct file writes.
# Wire in project settings (same way as mail-check.py; truth-source entry in sibling hooks.json):
# PreToolUse matcher "Write|Edit|MultiEdit" -> <abs>/mail-guard.py
# Rationale (2026-07-10 live): an orchestrator wrote several letters straight into recipient inboxes
# with the Write tool — bypassing every gate the helper carries (8KB hard size cap, >2KB brevity
# warning, atomic tmp/->inbox delivery) — and hand-rolled frontmatter got fields wrong (a letter
# shipped with the wrong `from:`). Prose said "use the helper"; prose that doesn't reach the
# decision point is net-negative -> promote to a tool-call hook (same conclusion as cto-guard).
# Scope: DENY only <bus>/<id>/inbox/... file writes. tmp/ is the helper's own staging area,
# archive/ moves go through `agentmail archive` (and this guard only sees Write/Edit, not mv),
# registry.md sits at the bus root — none of those match. Reading anything stays free.
# Deny/checker error = exit 2 + stderr (shown to the agent).
import json
import os
import sys
GUARDED_TOOLS = ("Write", "Edit", "MultiEdit")
def checker_error(message):
sys.stderr.write(f"CHECKER-ERROR: {message}\n")
return 2
def bus_root():
# $AGENT_MAIL_DIR wins over the default, mirroring agentmail / mail-check.py.
raw = os.environ.get("AGENT_MAIL_DIR") or "~/.agents/mail"
return os.path.realpath(os.path.expanduser(raw))
def inbox_target(file_path):
# file_path may be absolute, ~-prefixed, or relative; realpath also unifies the
# macOS /tmp -> /private/tmp symlink so prefix matching can't be dodged by spelling.
fp = os.path.realpath(os.path.expanduser(file_path))
bus = bus_root()
if not fp.startswith(bus + os.sep):
return False
rel = fp[len(bus) + 1:].split(os.sep)
# <bus>/<agent-id>/inbox/<...file> — exactly the delivery surface. tmp/ and archive/
# (rel[1] != "inbox") and bus-root files like registry.md (len < 3) fall through.
return len(rel) >= 3 and rel[1] == "inbox"
def main():
try:
data = json.load(sys.stdin)
except Exception:
return checker_error("invalid hook JSON.")
if not isinstance(data, dict):
return checker_error("hook payload must be an object.")
if data.get("hook_event_name") != "PreToolUse":
return 0
if data.get("tool_name") not in GUARDED_TOOLS:
return 0
ti = data.get("tool_input")
if not isinstance(ti, dict):
return checker_error("guarded mail write requires object tool_input.")
file_path = ti.get("file_path")
if not isinstance(file_path, str) or not file_path:
return checker_error("guarded mail write requires string tool_input.file_path.")
hit = inbox_target(file_path)
if not hit:
return 0
sys.stderr.write(
"DENY: direct Write/Edit into an agent-mail inbox. Direct writes bypass the helper's "
"gates — 8KB hard size cap, >2KB brevity warning, atomic tmp/->inbox delivery — and "
"hand-rolled frontmatter gets fields wrong (2026-07-10: letters written via the Write "
"tool shipped with a wrong `from:`). Deliver through the helper instead:\n"
" agentmail send <from> <to> <slug> <subject> <<'EOF'\n"
" <body: conclusion first, action items, evidence as paths/URLs>\n"
" EOF\n"
"Reading mail and the roster directly stays fine; only delivery must go through "
"`agentmail send`. Read: agent-mail/SKILL.md §agentmail helper.\n"
)
return 2
if __name__ == "__main__":
try:
sys.exit(main())
except Exception:
sys.exit(checker_error("internal guard failure."))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |