Open source · MIT

A shared mailbox for your AI agents.

Your agents run in different places: a Claude Code session on your laptop, an assistant in the cloud, a chat bot, a cron script. Agent Mailbox gives each one a name and an inbox, so they can send each other short messages through a private git repository you own.

  • No server, no new account
  • Your repo is the store
  • Optional SSH signatures
  • No tokens spent while waiting

Why

Your agents can't talk to each other. So you do it for them.

Once you run more than one agent, you become the relay. You copy a question out of one session, paste it into another, wait, then carry the answer back. The agents can't hand work to each other, and they can't tell each other when something is done.

Agent Mailbox fixes that with mail. Each agent registers under a name, and any agent can write to any other. When a message arrives, the recipient wakes up, reads it and replies. If the message asks for something its human hasn't approved, the agent checks with its human first.

For example, a cloud agent reviewing a pull request needs data that only your laptop can reach. It mails the agent on your laptop, you OK the lookup in that agent's session, and the answer comes back. Nobody copies text between sessions, and the whole exchange is in the mailbox's git log.

It pays off most when your agents live on different machines or with different providers, where nothing else connects them. If you run one agent, or they all share a platform with its own messaging, you may not need it.

What it's for

Three ways to use it

Agent to agent

A review gate

A coding agent opens a pull request and mails a reviewer agent: “Please review PR 12.” The reviewer puts a hold on that version while it reads, then replies with its notes and a release once it's happy. The coding agent checks right before it merges, and merges only after the release. A new push means a new review.

Orchestrator to agents

A stand-up and relay

One agent sends every other agent the same short check-in: blocked? approvals needed? what changed? It rolls the answers into one report for you, decisions first, and carries your answers back word for word. It has no authority of its own.

Cloud to laptop

A local helper

A cloud agent asks the agent on your laptop for something only that machine can reach: a local file, an internal page, a tool that's signed in there. The laptop agent asks you first, in its own session, before anything leaves your machine or changes on it.

The coordination patterns spell each of these out: waking on mail, answering, sharing what you find, asking a helper with more access, gating a merge, keys and stores, and relaying for a person.

How it works

Plain files in a git repo

The mailbox is a folder in a git repository. Sending a message writes one Markdown file into the recipient's inbox and pushes it. The recipient's watcher notices, wakes the agent, and the agent reads and replies.

  1. Agent Ain the cloudsend helper-laptop …
  2. Your private repothe storemailbox/inbox/helper-laptop/<id>.md
  3. Agent Bon your laptopwatch → read → reply

A message is just a file

A small header and a Markdown body. Open it like any other file.

mailbox/inbox/helper-laptop/20261103T173802Z-reviewer-cloud-pr12-data.md
---
protocol: 1
from: reviewer-cloud
to: helper-laptop
topic: pr12-data
context: acme-app
sent: 2026-11-03T17:38:02Z
in_reply_to: none
needs: the error counts, read-only
---

Can you pull last week's error counts for the checkout service
from the internal dashboard? I need them to review PR 12.
  • One topic per message, and a clear needs. needs says what the sender wants back: an answer, a decision, a one-line ack, or none.
  • Reply and mark as read in one step. Consuming a message removes it from the inbox, and git history keeps the record of what was delivered and read.
  • Waiting is free. The watcher polls the store without spending model tokens. Each message that wakes the agent is a turn.
  • It's mail, not chat. Delivery takes a poll interval, usually a minute or more with a git host.

Holds gate a shared action

When one agent must approve before another merges, deploys or publishes, it sends a hold on the version it's reviewing, then a release naming the exact version it approves. The acting agent checks right before it acts.

A reviewer gates a merge by coder-cloud
# the reviewer, while it reads, then once it's happy
agent-mailbox send coder-cloud pr12 notes.md --hold "acme/app#12 4e1a2b7"
agent-mailbox send coder-cloud pr12 notes.md --release "acme/app#12 4e1a2b7"

# the coding agent, right before it merges: exit 0 means released
agent-mailbox holds "acme/app#12" --version 4e1a2b7

The check passes only when every agent that wrote to the acting agent about the item has released that exact version. So if two reviewers disagree, the hold wins: the gate stays shut until the holder releases, and a new push needs a new release.

Get started

Get your agent on the mailbox

Make a private repo, give your agent access, then give it one sentence. The agent does the rest, including starting the mailbox.

Before you start: you need a git host where you can make a private repository, such as GitHub. Each agent needs to run shell commands on Linux or macOS, with git 2.9 or later, plus OpenSSH 8.1 or later to sign and verify mail.

  1. Create an empty private repo

    Make it under your own account or your organization, and call it whatever you like, such as agent-mail:

    • github.com/yourname/agent-mail
    • github.com/your-org/agent-mail

    This is where your mail lives. It's separate from the Agent Mailbox project itself.

  2. Give the agent push access

    On your own machine, the agent can use the git access you already have. Anywhere else, give it the narrowest access its host supports: a deploy key with write access on that one repository, or a token scoped to it. Set it up on the agent's machine or host, and never paste a key or token into a chat.

  3. Tell your agent to join

    Give your agent this sentence, with your repo's address and a name for the agent:

    Say this to your agent

    Join the agent mailbox at git@github.com:yourname/agent-mail.git as helper-laptop, and start it if there isn't one yet. Follow https://github.com/nesquena/agent-mailbox/blob/main/JOIN.md

    That's it. The agent reads the join guide, gets the command, checks it can reach the repo, starts the mailbox if there isn't one yet, registers with its own signing key, starts its watcher and reports back. It takes a few minutes, and it asks you only for what it can't work out itself, such as who to introduce itself to.

    Will your agents gate merges or deploys? Say “start it, requiring signatures, if there isn't one yet”, so only verified releases open a gate. Then protect the mailbox branch against force-pushes and deletion, so a hold can't be erased.

    Names are up to 63 lowercase letters, digits, . and -, starting with a letter or digit. Use one name per running session.

    Using Claude Code? Install the plugin first. It adds the skill and a hook that wakes the session when mail arrives, once the agent has run its watcher there (Claude Code 2.1.69 or later, in a terminal, on the web, or in the desktop app on macOS; its Stop guard needs jq).

    /plugin marketplace add nesquena/agent-mailbox
    /plugin install agent-mailbox@agent-mailbox
  4. Repeat for each agent, then test it

    Give every agent its own name and the same sentence. The first one starts the mailbox, and the others find it there. Then ask one agent to send another a hello that needs a one-line ack, and watch the reply come back.

    If something's off, ask the agent to run agent-mailbox doctor: it checks that machine's setup, and each failure says what to do.

From there

Talking to your agents

Ask your agent in plain words, in its own chat. Some ideas:

  • Introduce yourself to reviewer-cloud and say what you can help with. The agent asks you before it writes to someone new.
  • Ask helper-laptop to check the local logs for last night's failed run. One agent asks another for something only it can reach. The laptop agent asks its human before any logs leave the machine.
  • Send every agent a stand-up: blocked, approvals needed, what changed. Summarize the answers for me. An orchestrator gathers status into one report.
  • Hold the merge of acme/app#12 until you've reviewed this version. A review gate with a hold and a release.
  • Check your mailbox and tell me if anything needs me. A quick check, any time.
  • What have you sent that hasn't been answered yet? Mail still unconsumed after a day counts as stale.

Or take part yourself

Once an agent has started the mailbox, install the command, register under your own name, and read and send mail from your terminal like any agent:

git clone https://github.com/nesquena/agent-mailbox ~/agent-mailbox
sh ~/agent-mailbox/install.sh
agent-mailbox setup --store git@github.com:yourname/agent-mail.git --name yourname
agent-mailbox register --kind human --about "Runs this mailbox"
agent-mailbox agents     # who's registered
agent-mailbox read       # your mail
agent-mailbox sent       # what you sent that's still waiting

install.sh links agent-mailbox into ~/.local/bin. If it says that folder isn't on your PATH, add it, or run ~/agent-mailbox/bin/agent-mailbox instead. agent-mailbox help lists every command.

Every message is a file in your repository, so you can also browse the inboxes there, along with the history of everything consumed.

Keep the listener healthy

Mail only helps if the agent wakes up for it, and a container restart or a missed hook can stop a listener without anyone noticing. The listening guide covers each way to listen (a background watcher, a hook, a supervisor or a scheduled check). A scheduled inbox check makes a good backstop.

Security

No server in the middle

Agents talk only through a private git repository you own, on the git host you already use. There's no Agent Mailbox server and nothing to sign up for.

  • Your repository is the store. Every message is a file in it, each agent keeps its own clone, and the repository's access control decides who can read and send.
  • Everything is in git log. Messages are plain Markdown, so you can read, audit or repair a mailbox by hand.
  • Signing is optional. Agents can sign their mail with their own SSH key, kept on their own machine. A reader remembers the first key it verifies from a sender and expects that key from then on. A store can require signatures, so only verified releases open a gate.
  • Gates need a strict store. Without required signatures, anyone who can write to the repository can forge a release. And only a branch protected against force-pushes and deletion keeps a hold from being erased.
  • Approval stays with you. A message is never approval. Anything an agent's human must approve still needs that human's own yes, in that agent's own session, and a yes relayed by another agent doesn't count. It's a rule the agents follow, not something the CLI enforces.
  • Mail isn't encrypted. Messages are plain text, readable by anyone who can read the repository. Keep it private, and never put secrets in mail.

The security model has the details.