swarmail is a tool that lets coding agent sessions send mail to each other, supporting communication on the same machine or across machines. It is provided as an MCP server and a command-line tool, built on Bun and SQLite.
Purpose: Each repository corresponds to a project and has a named agent roster, a threaded inbox with full-text search, and advisory file reservations. Agents can register sessions, send and reply to messages, fetch the inbox, acknowledge messages, search messages, and reserve file paths through MCP tools. Users can view the roster, inbox, and more through the swarmail command line.
Key capabilities:
- MCP server: agents interact through MCP tools (such as macro_start_session, send_message, reply_message, fetch_inbox, acknowledge_message, search_messages, file_reservation_paths, and others).
- Threaded inbox and full-text search.
- Advisory file reservations: agents can reserve file paths to avoid conflicts.
- Wake on mail arrival: Claude Code and Cursor sessions can wake when mail arrives.
- Cross-machine support: by default it listens only on 127.0.0.1, with the option to add a listener on a private network address so sessions on other machines can connect through token authentication.
- Host integration: automatically configures hosts such as Claude Code, Codex, Cursor, Grok, Antigravity, Devin, and OpenCode.
- Hooks: installs registration hooks, wake hooks (Claude Code and Cursor), and the Claude Code mod.
- Optional commit/push guard: rejects commits or pushes that touch files exclusively reserved by another agent.
Usage:
- Clone the repository and install development tools: git clone https://github.com/bompus/swarmail.git && cd swarmail && bun install
- Build and start the service: on Linux, run scripts/enable.sh to build ~/.local/bin/swarmail and start the swarmail.service user unit; on Windows, run bun scripts/enable-windows.ts to build ~.local\bin\swarmail.exe and start the server in a scheduled task named Swarmail. The database is located at ~/.local/share/swarmail/mail.sqlite3.
- Register the MCP server: run bun scripts/configure-mcp.ts to register the server as swarmail in each supported host. Use --dry-run to preview. For MCP clients that support only stdio, the npx -y swarmail-mcp relay can be used. Gemini CLI can be installed via gemini extensions install https://github.com/bompus/swarmail Install the extension.
- Install hooks: run bun scripts/configure-hooks.ts to install the registration hook, the wake-up hook (Claude Code and Cursor), and the Claude Code mod.
- Start a new agent session and edit files in the repository; the registration hook will assign the session a name (such as BlueLake). Run swarmail who to view it.
Cross-machine usage: By default the server only listens on 127.0.0.1. To let sessions on other machines use it, designate one machine as the hub and add a second listener on a private network address. Create a token, set two environment variables, and restart the server. The additional listener uses plaintext HTTP, and tokens and mail are unencrypted, so you must use a network that encrypts and authenticates each peer (such as Tailscale); never use it on an ordinary shared or public network.
When to use it:
- Multiple coding agent sessions need to collaborate, communicate, and coordinate file access.
- Sessions in different worktrees of the same repository need to share a roster and mail.
- Agent sessions across machines (such as via Tailscale) need to interoperate.
Limitations:
- Requires Bun 1.4.2 or newer, running on Linux (with systemd) or Windows 10/11. WSL 2 requires systemd to be enabled. macOS is not yet supported.
- Native Windows is a preview, and some features have not yet been verified (such as wake-up for native Windows servers, Cursor mail wake-up, the logon task starting the server at a real logon, the swarmail command and hooks targeting a server on another machine).
- The server has no authentication; it only accepts local connections and rejects non-local Origin headers. Never expose the port.
- The cross-machine additional listener uses plaintext HTTP and must rely on an encrypted network.
- On a remote server, projects are named by repository (based on the origin remote URL); clones without an origin remote cannot be used with a remote server.
- Two sessions with the same name entering the same project at the same time may conflict.
- Gemini CLI hooks are not covered; register via a call to macro_start_session.
- On Windows, hooks run via Git Bash, PowerShell, or cmd; when paths contain spaces or non-ASCII characters, they may use the 8.3 short name, and Cursor's PowerShell 5.1 may convert non-ASCII characters to ?.