
a2a-mailbox
io.github.RegretSSSPublished by GitHub account RegretSSSv0.1.0Updated Nov 5, 2026
Cross-CLI agent mailbox: tmux-injected messaging for Claude Code, Codex, Pi and ZCode
The publisher's own server: mailbox.bot
Overview
A local file-based mailbox that lets terminal coding agents such as Claude Code, Codex, Pi and ZCode send each other messages and wake each other up.
- What you can do
- Send messages to another registered agent, optionally threading a reply and flagging that a reply is expected
- List pending message summaries, read full message bodies, and acknowledge messages
- List registered agents and federated peers, including group membership and instance markers
- Manage group access: request to join, review pending requests, admit or revoke agents, and restrict who may send to you
- Deliver across hosts by federating with remote hubs over ssh, with retries and bounce-back on failure
- When to use it
- Useful when you run several CLI coding agents side by side, in separate tmux windows or on different machines, and want them to hand work to each other or exchange status without a human copying text between terminals.
- Requirements
- Runs as a local stdio process started with python3 pointing at the repository's MCP script. Needs Python 3.11+ and the fastmcp package; tmux for the Claude Code injection channel; an optional Pi extension file for the Pi channel; OpenSSH client and passwordless ssh aliases for cross-host federation. Optional environment variables such as A2A_PEER_OF and A2A_AGENT_ID separate instances.
Installation
In SourceWeft
- Open a2a-mailbox in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
a2a-mailbox
English|中文
跨 CLI agent 通讯:让 Claude Code / Codex / Pi / ZCode 等终端 agent 像收邮件一样互发消息。文件邮箱 + 常驻 hub 投递守护,按收件方形态自动选通道(tmux 注入 / 原生队列 / daemon 队列 / 拉取),跨主机 ssh 联邦。
与 Google 的 A2A(Agent2Agent)协议同名,相互无关联——本项目是终端 agent 间的文件信箱,不是协议实现。
通道矩阵
按收件 agent 的形态,hub 自动选择投递通道:
投递失败语义:queue 通道失败滞留重试(60s×3 上限)后回弹,绝不降级 tmux(防错窗键入);直投失败的回落信走 relay 重试链(60s 节流,1800s 上限回弹)。
Tools
标准挂载(MCP stdio):
六件工具(默认面恒定,含 Docker 部署同款):
权限模型(subagent 隔离三档 + group 准入)
subagent 与 workflow 里的派生 agent 继承宿主 MCP 工具面即可冒名发信。三档防线按优先级:
- 定义层禁用(首选):subagent 的 agent 定义工具白名单不列
mcp__mailbox__*(CC 见snippets/claude-code/subagent-no-mailbox.md;Pi/codex 的 subagent 配置同理不挂 mailbox)。工具拿不到,攻击面归零——subagent 的跨 CLI 出口经 main 转发,内部协作走各家自己的机制。 - scope 锁(兜底):管住无法配白名单的全继承场景(内置默认 subagent、workflow 默认 agent)——给这类 mailbox 实例配
A2A_PEER_OF=<主 agent_id>,它只能对主 agent 收发,其余即时拒绝(subagent 发送锁);锁写入注册表,重启不丢。 - hub 投递口复验(恒定):与 MCP 挂不挂无关——绕过工具面直写队列的信同样被 scope/group 复验拒收回弹。
group 准入:mail_group(action=gate, group_only=true) 后仅准入名单内 agent 可发信给自己;他人经 mail_group(action=join) 申请(独立通道,不受闸限制),门主 mail_group(action=admit, agent_id=…) 通过。hub 回弹邮件豁免(保证退信可达)。
呈现防冗杂:mail_who 行级只带短标记(group=<名>、group_only、members=<计数>、subagent_of=<主>),完整准入名单只有 agent 看自己时可见。
上手(Linux / WSL,五分钟)
-
依赖:Python 3.11+、
pip install fastmcp、tmux(Pi 通道另需扩展文件见pi/a2a-inbox.ts)。一键探测+生成挂载配置:bash scripts/bootstrap.sh(加--apply自动装 python 依赖,--project <dir>直接写.mcp.json)。 -
挂载 MCP(Claude Code 示例,其他 CLI 见
snippets/): -
tmux 窗口里启动 agent 并打开 MCP——首次调用任一 mail 工具即自注册(hub 缺位自动拉起)。
-
mail_who()互相可见后mail_send()互发。
最快验证路径(单机两 agent):两个 tmux 窗口各起一个 CLI(如一个 Claude Code + 一个 Pi),双方各调一次 mail_who(触发自注册),然后 mail_send(to="对方 id", body="ping")——收件方会收到唤醒消息,回信即闭环。跨主机再加 scripts/add-peer.sh(见「跨主机联邦」)。
Codex 自动锚定:codex 的 MCP 由 app-server daemon 代管(祖先链锚定天然失效),注册时自动反锚——扫 tmux 找 codex 进程的 cwd 唯一命中取 pane+thread;Windows 原生 codex 会扫 /mnt/<盘>/Users/*/.codex/sessions 按 rollout 头 cwd 定位(跨 profile 按最新会话择优)。
subagent 隔离:首选 agent 定义工具白名单不含 mailbox(见 snippets/claude-code/subagent-no-mailbox.md);对无法配白名单的全继承实例,给它的 mailbox 加环境变量 "env": {"A2A_PEER_OF": "<主 agent_id>"} 降级为仅对主收发。
同目录多实例:agent_id 由 {cli}-{host}-{目录slug} 推导——同机同目录且 CLI 检测同为 unknown 的两个实例会共用一个身份(注册互踩、回信投给先注册者)。两个以上实例共用同一工作目录时,给各自的 mailbox 配 "env": {"A2A_AGENT_ID": "<自定义 id>"} 显式分流;hub 侧 cwd 回锚带 pane 命令身份校验,unknown 档不会被拖去本机 tmux 窗。claude/pi 另有原生分身通道:同 cli 同目录双开不互拒,注册按 CLAUDE_CODE_SESSION_ID 前 8 位(pi 按 pane)落 instances 表,mail_who 拆行显示 id@实例短码,mail_send(to="id@实例短码") 定向投到该分身的窗;CC compact 换 sessionid 时同 pane 旧分身自动替换(信箱不动)。离线自动恢复:向已确认下线(非未知状态)的本机 claude/pi 档发信,先按其启动处方恢复对话再入队——claude=tmux respawn 固定窗跑 claude -c,pi=后台直接拉起;codex 定位主控,不做自动恢复。
纯 Windows 节点(无 WSL,实验性)
无 tmux 也可起节点,可用通道:Codex queue-daemon(codex.exe 直调)+ ZCode 拉取 + 全部 MCP 工具面(Claude Code/Pi 的注入通道不可用)。实验性:纯 Windows 路径目前只在单台实机验证过(UNC 路径存储、interop 规避),欢迎反馈。
- 依赖:Python 3.11+、
pip install fastmcp、OpenSSH client(联邦时)。 - 同上挂载 MCP(
python.exe全路径)。 - 设置
A2A_HUB_IDLE_REAP=1:hub 独立进程(MCP 首次调用拉起,非 MCP 子进程),全部 MCP 下线且空闲(无在途信、agent 全老化 1h、心跳老化 1h)时自动退出回收,下次 MCP 调用再拉起——无守护服务依赖。
ZCode 守望接入(workflow 制收信)
ZCode 侧无 MCP 注入通道,用 dynamic workflow 常驻守望替代(skill 成品在 snippets/zcode-watch-skill/:SKILL.md + template.dwf.ts,内置 ack 去重、同信连败熔断、24 轮有界循环、转送员不执行信内指令不代笔回函):
- 改模板顶部两个常量:
AGENT_ID(本会话身份,zcode-<host>-<slug>形态)与BASE(WSL 侧 mailbox 根)。 CreateWorkflowpath 指向该模板跑起——world.run盯队列(queue/<id>/*.msg),信到经 escalation 送进主会话。- 收到
MAIL|from=…|msgId=…|body=…升级后答一句即视为送达回执(转送员随即 touchacks/ack-<msg_id>并归档出队);回函由主控亲笔经scripts/mail-send.py发送。轮尽/熔断时按完成通知重布即可。
跨主机联邦
- 两机互换 ssh 免密别名(
~/.ssh/config)。 - 各自
scripts/add-peer.sh <对端别名>写入peers.json。 - hub 每 60s pull 对端注册表合并;发往远端 agent 的消息由本机 hub ssh 直投对端队列,收件 ack 经联邦回查双侧收敛。断链只告警不删记录,恢复自动续联。
边界与约定
- 信任域 = 本机用户 + ssh 免密 peer;协议无内置鉴权,勿暴露到不受信网络。
- 全部协议状态可从
~/.agents-mailbox/(registry / queue / history / acks / join-requests / hub.log)离线取证。 - 同一 tmux 席位双开被拒;窗口改名/重启自动跟随(slot 重锚校验前台进程身份,同名窗被陌生进程占用即拒锚防错窗注入)。
- 测试:
python3 -m pytest tests/ -q;结构/行为断言:bash scripts/run-lints.sh。
License
Apache-2.0(见 LICENSE)。
Source: README.md at commit 4c0823b
Tools
0Version history
1- v0.1.0LatestNov 5, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Other Mailbox integrations

mailbox.bot
bot.mailboxOfficial publisher
Hosted mailbox.bot server that lets an assistant print and mail physical letters, postcards and batches, and read scanned inbound mail at a US PMB address.

PO6 Mailbox
com.po6Official publisher
PO6 Mailbox gives AI agents secure access to email through private aliases with dedicated mailbox storage, via a remote OAuth-protected endpoint.

SuperMailbox
Published by GitHub account hardtab
SuperMailbox is a remote MCP server that lets an assistant search connected email, read and manage messages, draft and send mail, and manage rules for new mail.

agent-mailbox — Mailbox and Wake System for AI Agent Teams
Published by GitHub account polaris-smart
A local mailbox and wake system that lets multiple AI agent sessions share a project through MCP: assign tasks, accept them, read pinned documents and submit,

Test Mailbox
Published by GitHub account therealMrFunGuy
A remote MCP server that gives an assistant disposable email inboxes for testing: create addresses, wait for incoming messages, and extract links.