Agent Identity & Discovery
Agents get memorable persistent identities (GreenCastle, BlueLake) with project-scoped registration, program/model metadata, and automatic roster management. No more anonymous processes colliding in the dark.
MCP Agent Mail gives coding agents a shared operational fabric: project-scoped identity, threaded inboxes, reservation guardrails, and searchable audit trails backed by SQLite + Git.
Coordination primitives across messaging/search/reservations
Agent-discoverable resource surfaces
Representative high-load scenarios passed
HTTP stress profile baseline (context-dependent)
Every design decision is battle-tested across 40-50 concurrent agents from different providers working in a single shared codebase.
Agents claim file patternsGlob PatternWildcard file path matcherA pattern like src/auth/**/*.ts that matches files using wildcards. Agents reserve glob patterns rather than individual files, so a single reservation can cover an entire directory tree. temporarily while they work, but reservations are advisoryAdvisory LockNon-blocking coordination signalFile reservations in Agent Mail are advisory: they surface conflicts and enable the pre-commit guard, but they can always be bypassed. This prevents deadlocks while still making ownership visible. and expire via TTLTTLTime-to-live for reservationsFile reservations and build slots expire after their TTL (default 3600 seconds). Agents can renew before expiration. Expired reservations are automatically cleaned up, preventing stale locks.. This prevents deadlocks while making ownership visible.
If an agent crashes or gets its memory wiped, stale reservations expire automatically. Other agents can detect untouched files and reclaim them. The optional pre-commit guardPre-Commit GuardGit hook enforcing file reservationsThe mcp-agent-mail-guard binary installs as a Git pre-commit hook. It checks whether committed files overlap with another agent’s active reservations and blocks the commit if so. Bypassable with AGENT_MAIL_BYPASS=1. adds enforcement at commit time when you want it.
Git worktrees demolish development velocity and create merge debt you pay later when agents diverge. Working in one shared space with advisory reservationsFile ReservationAdvisory lease on file pathsAn agent declares intent to edit specific file patterns (globs like src/auth/**/*.ts) for a given TTL. Other agents see the reservation and can coordinate accordingly. Conflicts are surfaced but not hard-blocked. surfaces conflicts immediately.
Agents coordinate in real time through threaded messagingThreadConversation grouping by thread_idMessages sharing the same thread_id form a conversation thread. Threads enable context-aware communication; agents can review the full conversation history before replying. Thread IDs often map to bead/issue IDs (e.g., bd-123). instead of accumulating silent divergence. The result: zero merge debt, zero lost work, and immediate conflict resolution.
Git Worktrees
Agent Mail
Each agent gets a memorable identityAgent IdentityMemorable persistent name for an agentEach agent gets an adjective+noun identity (GreenCastle, BlueLake, RedHarbor) that persists across sessions. Identities are project-scoped and carry program/model metadata for context. (GreenCastle, BlueLake, RedHarbor) that persists for the duration of a task, but can vanish without breaking coordination state.
This matters because agents crash, get context-wiped, and disappear constantly. The identity system is designed for this reality: TTLTTLTime-to-live for reservationsFile reservations and build slots expire after their TTL (default 3600 seconds). Agents can renew before expiration. Expired reservations are automatically cleaned up, preventing stale locks.-based expiration cleans up after departed agents, and the contact handshakeContact HandshakeProtocol for establishing cross-agent communicationBefore agents in different projects can message each other, they perform a contact handshake: request_contact sends the invitation, respond_contact accepts or denies. Contact policies can auto-accept or block by default. protocol re-establishes trust when agents rejoin.
A naive implementation defaults to broadcast-to-all. Agents gravitate to whatever is easiest, so they will spam every peer with irrelevant information. Imagine if your work email defaulted to reply-all on every message.
Agent MailAgent MailCoordination infrastructure for AI coding agentsMCP Agent Mail provides the full operational fabric for multi-agent coding: identities, threaded messaging, file reservations, search, audit trails, and operator tooling, all backed by SQLite + Git. uses targeted messaging with subjects,threadsThreadConversation grouping by thread_idMessages sharing the same thread_id form a conversation thread. Threads enable context-aware communication; agents can review the full conversation history before replying. Thread IDs often map to bead/issue IDs (e.g., bd-123)., and explicit recipients. Agents only receive messages addressed to them. Acknowledgment trackingAcknowledgmentConfirmation that a message was receivedWhen a message is sent with ack_required=true, the recipient agent must explicitly acknowledge receipt. The system tracks ack status and can surface overdue acknowledgments to operators. ensures critical messages are processed, not just delivered.
With hundreds of tasks, you do not want agents randomly choosing or wasting context windowContext WindowToken budget available to an LLMThe fixed-size buffer of tokens an LLM can process in a single session. Coordination chatter (status updates, broadcasts, trace dumps) consumes context window space that would otherwise be available for reasoning and code generation. tokens negotiating. There is usually a clear best-next-task for each agent.
That answer comes from the dependency graph. The bv tool uses basic graph theory (PageRank, betweenness centrality, critical path analysis) as a compass that tells each agent which task will unlock the most downstream work.
Graph Analysis Signals
PageRank
Structural importance
Betweenness
Bottleneck detection
Critical Path
Longest dependency chain
What-If
Cascade impact prediction
bv combines these signals to recommend which task each agent should work on next.
Agent MailAgent MailCoordination infrastructure for AI coding agentsMCP Agent Mail provides the full operational fabric for multi-agent coding: identities, threaded messaging, file reservations, search, audit trails, and operator tooling, all backed by SQLite + Git. runs with 40-50 concurrent agents mixing Claude Code, Codex CLI, and Gemini CLI on the same project with no issues. This is production use, not a demo.
The 10-scenario stress gauntletStress Gauntlet10-scenario production readiness test suiteA comprehensive stress test suite covering: 30-agent message pipelines, 10-project concurrent ops, commit coalescer batching, stale lock recovery, mixed reservations + messages, pool exhaustion, sustained throughput, thundering herd, and inbox reads during storms. validates 30-agent message pipelines, pool exhaustion recovery, thundering herd handling, stale lock cleanup, and sustained ~49 RPS mixed workloads. Every scenario passes with zero errors.
Agent Mail is purpose-built coordination infrastructure for AI coding agents. Identity, messaging, file reservations, and task prioritization, all backed by SQLite and Git.
Agents get memorable persistent identities (GreenCastle, BlueLake) with project-scoped registration, program/model metadata, and automatic roster management. No more anonymous processes colliding in the dark.
Asynchronous, threaded conversations with subjects, recipients, CC/BCC, importance levels, and acknowledgment requirements. Messages stored in Git-backed archive, never consuming agent context windows.
Agents declare exclusive or shared leases on file globs before editing. TTL-based expiration, pattern matching, and optional pre-commit guard enforcement prevent conflicts while remaining bypassable.
Infrastructure, Identity, Messaging, Contacts, File Reservations, Search, Macros, Product Bus, and Build Slots. Every coordination primitive exposed via the Model Context Protocol standard.
Two-tier fusion combining lexical and semantic search with reranking. Field-based filters (subject:, body:, from:), cross-project search via product bus, and relevance scoring built on frankensearch.
Real-time dashboard, message browser, thread explorer, agent roster, unified search, reservation manager, tool metrics, system health, timeline views, contact graph, and more. Five themes including Cyberpunk Aurora.
Every message, reservation, and agent profile stored as files in per-project Git repositories. Human-auditable, diffable, fully recoverable. Date-partitioned messages with advisory locking for safe concurrent access.
Product bus links multiple repositories. Contact handshake protocol enables inter-project messaging. Shared thread IDs and contact policy management across your entire codebase.
16 non-interactive subcommands optimized for agent consumption. Token-efficient output in toon, JSON, or Markdown formats. Status, inbox, timeline, search, reservations, metrics, and health at your fingertips.
Git hook (mcp-agent-mail-guard) blocks commits touching files reserved by other agents. Prevents accidental conflicts while remaining bypassable with AGENT_MAIL_BYPASS=1 for emergencies.
Acquire, renew, and release build slots to control compilation concurrency across agents. Prevents resource contention on shared build infrastructure.
macro_start_session bootstraps project + agent + inbox in one call. macro_prepare_thread joins existing conversations. macro_file_reservation_cycle manages reserve-work-release flows. macro_contact_handshake sets up cross-agent contacts.
Fast lookup surfaces for inbox, threads, agents, reservations, metrics, and health — all accessible without tool calls. resource://inbox/{Agent}, resource://thread/{id}, and more.
Unified inbox across all projects, agent roster views, message detail with attachments, search with field filters, and an Overseer compose form for sending high-priority messages to redirect agents mid-session.
30-agent message pipelines, 10-project concurrent ops, pool exhaustion recovery, thundering herd handling, sustained 49 RPS mixed workloads. Every scenario passes with zero errors in the stress gauntlet.
Modular workspace: core, db, storage, search-core, guard, share, tools, server, CLI, conformance, and WASM. Built on Tokio, frankensearch, frankentui, and fastmcp_rust.
Agent Mail bakes coordination guarantees into the infrastructure layer. Features that require manual discipline with ad-hoc solutions are enforced by the architecture.
| Feature | Git Worktrees | Shared Docs | No Coordination | |
|---|---|---|---|---|
| ✓Persistent, project-scoped | ✕None | ⚠Manual naming | ✕None | |
| ✓Threaded + searchable | ✕None | ⚠Append-only files | ✕None | |
| ✓Advisory reservations + guard | ⚠Isolated branches | ✕None | ✕None | |
| ✓Git + SQLite | ⚠Git history only | ⚠File history | ✕None | |
| ✓Product bus | ✕None | ✕None | ✕None | |
| ✓Hybrid lexical + semantic | ⚠Git log | ⚠Text search | ✕None | |
| ✓15-screen TUI + Web UI | ⚠Git log | ⚠File browser | ✕None | |
| ✓34 tools + 20 resources | ✕None | ✕None | ✕None | |
| ✓Auto-detect + register | ✕Manual | ✕Manual | ✕Manual | |
| ✓Built-in ack protocol | ✕None | ✕None | ✕None | |
| ✓Build slot management | ✕None | ✕None | ✕Race conditions | |
| ✓10/10 gauntlet (30 agents) | ✕N/A | ✕N/A | ✕N/A |
Real scenarios that multi-agent teams face daily, and how purpose-built coordination transforms the outcome.
Without Agent Mail
Silent overwrite. Hours of work lost. Discovered only at commit time, if at all.
With Agent Mail
Advisory file reservations surface the conflict before either agent starts. Agents negotiate via threaded messages or pick different files.
Without Agent Mail
Each agent works in a separate worktree. Divergence accumulates silently. Merge conflicts pile up. Development velocity drops as you pay back the debt later.
With Agent Mail
Agents work in one shared space with advisory reservations. Conflicts surface immediately and are resolved in real time through messaging. No merge debt.
Without Agent Mail
Stale locks block other agents indefinitely. Manual cleanup required. No record of what the crashed agent was working on.
With Agent Mail
TTL-based reservations expire automatically. Other agents detect stale reservations and reclaim them. Full audit trail in Git shows exactly what happened.
Without Agent Mail
Every agent receives every message. Context windows fill with irrelevant information. Token costs spike. Signal-to-noise ratio collapses.
With Agent Mail
Targeted messaging with subjects, threads, and recipients. Agents only receive messages addressed to them. Acknowledgment tracking ensures nothing is missed.
Without Agent Mail
Informal coordination breaks down completely. File conflicts multiply quadratically. No one knows who is doing what.
With Agent Mail
Agent roster shows all active agents and their tasks. File reservations prevent conflicts at any scale. Graph-aware task prioritization (bv) ensures each agent works on the highest-impact task.
A fully coordinated multi-agent session in a few lines. Register an identity, reserve files, send targeted messages, and release when done.
01# Start the MCP Agent Mail server with TUI02am03 04# Bootstrap a session one call (project + agent + inbox)05macro_start_session(06 human_key="/abs/path/to/repo",07 program="claude-code",08 model="opus-4.6",09 task_description="Implementing auth module"10)11# Returns: { project, agent, file_reservations, inbox }12 13# Reserve files before editing14file_reservation_paths(15 project_key="/abs/path/to/repo",16 agent_name="GreenCastle",17 paths=["src/auth/**/*.ts", "src/middleware/auth.ts"],18 ttl_seconds=3600,19 exclusive=true,20 reason="bd-123"21)22 23# Coordinate through threaded messages24send_message(25 project_key="/abs/path/to/repo",26 sender_name="GreenCastle",27 to=["BlueLake"],28 subject="[bd-123] Starting auth refactor",29 body_md="Reserved src/auth/**. Taking login + token rotation.",30 thread_id="bd-123",31 ack_required=true32)Every claim is backed by reproducible benchmarks from the 10-scenario stress gauntlet and real-world multi-agent deployments.
10-scenario stress gauntlet covering 30-agent message pipelines, pool exhaustion, thundering herd, stale lock recovery, and sustained mixed workloads.
HTTP stress profile sustains ~49 RPS with 1,494 operations in 30 seconds of mixed workloads including messaging, search, and reservations.
Commit coalescer batches multiple storage writes into fewer Git commits, reducing write amplification.
First open-source coordination system that works across providers. Battle-tested with Claude Code, Codex CLI, and Gemini CLI running simultaneously on the same project.
TTL-based reservation expiration, stale lock detection, and automatic cleanup. Designed for the reality that agents crash, context-reset, and disappear without notice.
Battle-tested across thousands of agent sessions. Every phase documented, every design decision proven in practice.
Built original MCP Agent Mail in Python with SQLite storage
Designed agent identity, messaging, and file reservation primitives
Achieved 1,700+ GitHub stars and broad community adoption
Identified scalability bottlenecks: Git lock contention, SQLite pool exhaustion
12-crate modular workspace architecture with zero unsafe code
Built on Tokio for high-performance async concurrency
SQLite WAL mode with connection pooling and PRAGMA tuning
Git-backed archive with commit coalescing (9x reduction)
Implemented 34 MCP tools across 9 clusters via fastmcp_rust
Added 20+ MCP resources for fast agent-discoverable lookups
Built hybrid search with two-tier fusion and reranking on frankensearch
Cross-project coordination via product bus and contact handshakes
Whether you run solo or manage a fleet of agents, Agent Mail fits your workflow.
Advisory reservations and TTL expiration mean your agents coordinate instead of collide, even when they crash.
Get Started Free15-screen TUI, web dashboard, and robot mode CLI give you full visibility. Human Overseer lets you intervene when needed.
View Dashboard Demo34 MCP tools, cross-provider compatibility, and a stress gauntlet proving 40+ concurrent agents. MIT licensed.
Explore ArchitectureWe have heard every reason not to adopt a coordination layer. Here is why each one is wrong.
Branches isolate code but not communication. When Agent A needs to tell Agent B it changed an API, branches have no mechanism for that. Agent Mail adds the coordination layer that Git lacks.
The comparison table shows 12 capabilities where Git worktrees have gaps in messaging, identity, search, and operator visibility.
Agent Mail is a single binary (am) with a one-line install. The macro_start_session call bootstraps everything in one step. You do not need to configure databases, message brokers, or cloud services.
Install: curl | bash. Start: am. Bootstrap: one tool call. The getting-started path is under 60 seconds.
The stress gauntlet runs 30 concurrent agents across 10 projects with mixed workloads. Advisory reservations with TTL expiration prevent deadlocks while the guard hook provides enforcement when needed.
10/10 stress gauntlet scenarios pass: 1,494 ops in 30s, pool exhaustion recovery, thundering herd handling.
Agent Mail is open source (MIT), local-first, and stores everything in Git + SQLite. There are no cloud dependencies, no API keys, no accounts. If you stop using it, your data is still in standard formats.
MIT license, all data in Git repos and SQLite databases, no network calls required for core functionality.
They work fine until they do not. The first time two agents edit the same file, you lose hours of work. Agent Mail prevents that failure mode while adding structured communication that makes multi-agent workflows more productive.
Every team that has run 3+ concurrent agents has hit file collision issues. Reservations make these impossible.
From the Creator
“Worktrees suck and just kick the can down the road. Advisory file reservations and messaging ftw.”
On running 40-50 agents simultaneously with no issues, mixing Claude Code, Codex, and Gemini CLI.
“It does exactly what they want and much more, while sidestepping all the many footguns that a naive implementation would fall prey to.”
On why purpose-built coordination beats ad-hoc solutions.
“You want semi-persistent identity. An identity that can last for the duration of a discrete task, but one that can also vanish without a trace and not break things.”
On designing identity systems robust to agent crashes and context resets.
“It's like a compass that each agent can use to tell them which direction will unlock the most work overall.”
On how bv uses dependency graph analysis to prioritize agent work.
“You're going to be hearing about a lot of agent communication systems soon because it's such an obviously good idea, but mine was the first open-source system that works across providers, and still has the best design.”
On Agent Mail's position as the first cross-provider coordination system.
Add Agent Mail to your project with a single command. Coordinate 40+ concurrent AI agents from any provider with zero conflicts.
cargo install mcp_agent_mail_rust