About Agent Mail Rust
Agent Mail Rust is an MCP server published by Dicklesworthstone in the Data category: rust MCP server for multi-agent coordination: 45 tools and 25 resources, Git-backed archive, SQLite indexing, advisory file locks, a 16-screen TUI, a server-rendered web UI, and an agent-first robot CLI. Conduid read 47 tools from its source: acknowledge_message, acquire_build_slot, check_file_reservation_conflicts, cleanup_pane_identities, create_agent_identity, deregister_agent and 41 more. No package is published for it, so it installs from a source checkout.
The repository has 293 stars and 52 forks, and its last commit was on 2 Dec 2026. The latest release is v0.3.41 (21 Nov 2026): Mailbox engine, memory, and WAL recovery (GH#372, GH#387, GH#350). It follows v0.3.40 (1 Nov 2026), and the 5 most recent releases go back to v0.3.37 (6 Oct 2026). It passes 4 of the 6 static checks Conduid ran on the repository; it does not pass No dynamic code execution and Scoped permissions. Its topics include data, coordination and tui.
Install
git clone https://github.com/Dicklesworthstone/mcp_agent_mail_rustTools (47)
acknowledge_messageacquire_build_slotAcquire a build slot (advisory), optionally exclusive. Returns conflicts when another holder is active.check_file_reservation_conflictscleanup_pane_identitiesRemove stale per-pane identity files for tmux panes that no longer exist. Queries tmux for live panes and removes identity files that reference dead panes. Safety: does nothing if tmux is not running (to avoid accidentally removing everything). Parameters ---------- project_key : Optional[str] If provided, only clean up identity files for this project. If omitted, clean up across all projects. Returns ------- dict { removed_count, removed_paths }create_agent_identityCreate a new, unique agent identity and persist its profile to Git. How this differs from `register_agent` -------------------------------------- - Always creates a new identity with a fresh unique name (never updates an existing one). - `name_hint`, if provided, must be a valid adjective+noun name or safe task identifier and must be available, otherwise an error is raised. Without a hint, a fresh adjective+noun name is generated, with a random suffix after bounded short-name collisions. Agent Naming Rules ------------------ - Omit `name_hint` for a fresh name such as "GreenCastle" or "BlueLake". Crowded projects use an adjective+noun prefix plus '-' and 32 random hex digits; retired names remain reserved. - Explicit hints may also be task identifiers such as "app-x-refactor", "worker_42", or "api.review". - Task identifiers start with an ASCII letter or digit, contain '.', '_' or '-', and use only ASCII letters, digits and those separators (at most 128 characters). - Reserved program/model/operator identities, broadcast tokens, template placeholders, '..', trailing dots and device names are rejected. - Adjective+noun names normalize to PascalCase; task identifiers retain their spelling. - Names are case-insensitive unique within each project; a differently cased duplicate is still rejected. When to use ----------- - Spawning a brand new worker agent that should not overwrite an existing profile. - Temporary task-specific identities (e.g., short-lived refactor assistants). Returns ------- dict { id, name, program, model, task_description, inception_ts, last_active_ts, project_id } Examples -------- Auto-generate name: ```json {"jsonrpc":"2.0","id":"c2","method":"tools/call","params":{"name":"create_agent_identity","arguments":{ "project_key":"/data/projects/backend","program":"claude-code","model":"opus-4.1" }}} ``` With explicit task name hint: ```json {"jsonrpc":"2.0","id":"c1","method":"tools/call","params":{"name":"create_agent_identity","arguments":{ "project_key":"/data/projects/backend","program":"codex-cli","model":"gpt5-codex","name_hint":"worker_42", "task_description":"DB migration spike" }}} ``` Optional cryptographic proof gate --------------------------------- Same gate as `register_agent`: by default no proof is needed. When the operator enables `[registration.proof_gate]`, pass a signed proof bundle as `registration_proof`; otherwise registration fails closed. Transcript-safe creation ------------------------ `return_registration_token : bool, default true`. When true (default), the response includes the freshly-minted `registration_token`. When false, the token is omitted from the tool result so transcript-visible MCP sessions can satisfy a "do not echo secrets into scrollback" contract, and the response carries `registration_token_returned: false` instead. The token still exists server-side (it is generated and persisted either way). When the operator enables session-bound identity (`MESSAGING_SESSION_IDENTITY=true`), the new identity is bound to this MCP session (stdio process, or Streamable HTTP session via `Mcp-Session-Id`): the session sends and replies as it with `verified_sender: true` and no `sender_token`, also under the fail-closed send profile, and cannot act as other agents of the project by naming them. Without that setting a caller that opts out of the token echo sends with `verified_sender: false` unless it obtains the token through an operator/admin path, and under the fail-closed send profile a sender token is mandatory. ```json {"jsonrpc":"2.0","id":"c3","method":"tools/call","params":{"name":"create_agent_identity","arguments":{ "project_key":"/data/projects/backend","program":"codex-cli","model":"gpt5", "return_registration_token":false }}} ```deregister_agentRemove an agent from a project. Marks the agent as inactive and removes it from the active roster. Messages from/to the agent are preserved for audit but the agent can no longer send or receive new messages. Rust authorization extension: deregistration also preserves reservations and Git archive history. It is permanent for that identity. Over stdio, authorization requires either the agent registration_token or a tmux pane bound to the agent; over HTTP (am serve-http) the registration_token is required and pane context does not authorize. The token is the `registration_token` field returned by register_agent / create_agent_identity / macro_start_session.ensure_productEnsure a Product exists. If not, create one. - product_key may be a product_uid or a name - If both are absent, errorensure_projectIdempotently create or ensure a project exists for the given human key. When to use ----------- - First call in a workflow targeting a new repo/path identifier. - As a guard before registering agents or sending messages. How it works ------------ - Validates that `human_key` is an absolute directory path (the agent's working directory). - Computes a stable slug from `human_key` (lowercased, safe characters) so multiple agents can refer to the same project consistently. - Ensures DB row exists and that the on-disk archive is initialized (e.g., `messages/`, `agents/`, `file_reservations/` directories). CRITICAL: Project Identity Rules --------------------------------- - The `human_key` MUST be the absolute path to the agent's working directory - Two agents working in the SAME directory path are working on the SAME project - Example: Both agents in /data/projects/smartedgar_mcp → SAME project - Sibling projects are DIFFERENT directories (e.g., /data/projects/smartedgar_mcp vs /data/projects/smartedgar_mcp_frontend) Parameters ---------- human_key : str The absolute path to the agent's working directory (e.g., "/data/projects/backend"). This MUST be an absolute path, not a relative path or arbitrary slug. This is the canonical identifier for the project - all agents working in this directory will share the same project identity. Returns ------- dict Minimal project descriptor: { id, slug, human_key, created_at }. Examples -------- JSON-RPC: ```json { "jsonrpc": "2.0", "id": "2", "method": "tools/call", "params": {"name": "ensure_project", "arguments": {"human_key": "/data/projects/backend"}} } ``` Common mistakes --------------- - Passing a relative path (e.g., "./backend") instead of an absolute path - Using arbitrary slugs instead of the actual working directory path - Creating separate projects for the same directory with different slugs Idempotency ----------- - Safe to call multiple times. If the project already exists, the existing record is returned and the archive is ensured on disk (no destructive changes).fetch_inboxfetch_inbox_eventsfetch_inbox_productRetrieve recent messages for an agent across all projects linked to a product (non-mutating).fetch_topicfile_reservation_pathsforce_release_file_reservationget_message_delivery_receipthealth_checkReturn basic readiness information for the Agent Mail server.install_precommit_guardlist_agentsList registered agents in a project, most-recently-active first. Returns agent name, role (program), model, task description, registration time (inception_ts), and last seen (last_active_ts). The result is bounded to avoid blowing the calling agent's context window on long-lived projects that accumulate agents across many short-lived swarms: at most `limit` agents (default 250) are returned, optionally restricted to those active within `active_within_days`. Parameters ---------- project_key : str Project slug or human key. limit : Optional[int] Maximum number of agents to return (most-recently-active first). Defaults to 250; values above 250 are clamped to 250. active_within_days : Optional[int] If provided, only return agents whose last_active_ts is within this many days. Omit to include all agents (subject to limit). Returns ------- str (JSON) Array of agent objects with fields: name, program, model, task_description, inception_ts, last_active_ts, contact_policy. Ordered by last_active_ts descending.list_contactsList contact links for an agent in a project.macro_contact_handshakeRequest contact permissions and optionally auto-approve plus send a welcome message. A cross-project handshake (`to_project`) delivers the welcome into the target's project once the link is approved (as `send_message` to `Target@project` does); if the link is still pending, no welcome is sent and the response carries `welcome_skipped_reason`. `auto_accept` approves a pending request on the target's behalf but never overrides a link the target has blocked.macro_file_reservation_cycleReserve a set of file paths and optionally release them at the end of the workflow.macro_prepare_threadMacro helper that aligns an agent with an existing thread by ensuring registration, summarising the thread, and fetching recent inbox context.macro_start_sessionMacro helper that boots a project session: ensure project, register agent, optionally file_reservation paths, and fetch the latest inbox snapshot.mark_all_readmark_message_readproducts_linkLink a project into a product (idempotent).register_agentCreate or update an agent identity within a project and persist its profile to Git. When to use ----------- - At the start of a coding session by any automated agent. - To update an existing agent's program/model/task metadata and bump last_active. Semantics --------- - If `name` is omitted, a fresh adjective+noun name is auto-generated, with a random suffix after bounded short-name collisions. - Reusing the same `name` updates the profile (program/model/task) and refreshes `last_active_ts`; it does not unretire an identity. Use authenticated `unretire_agent` to resume a retired identity. - A `profile.json` file is written under `agents/<Name>/` in the project archive. Agent Naming Rules ------------------ - Omit `name` for a fresh name such as "GreenLake" or "BlueDog". Crowded projects use an adjective+noun prefix plus '-' and 32 random hex digits; retired names remain reserved. - Explicit names may also be task identifiers such as "app-x-refactor", "worker_42", or "api.review". - Task identifiers start with an ASCII letter or digit, contain '.', '_' or '-', and use only ASCII letters, digits and those separators (at most 128 characters). - Reserved program/model/operator identities, broadcast tokens, template placeholders, '..', trailing dots and device names are rejected. - Adjective+noun names normalize to PascalCase; task identifiers retain their spelling. - Names are case-insensitive unique within each project; use the canonical name returned by registration. Parameters ---------- project_key : str The same human key you passed to `ensure_project` (or equivalent identifier). program : str The agent program (e.g., "codex-cli", "claude-code"). model : str The underlying model (e.g., "gpt5-codex", "opus-4.1"). name : Optional[str] An adjective+noun name (e.g., "BlueLake") or a safe task identifier (e.g., "app-x-refactor"). If omitted, a fresh name is auto-generated, using a random suffix when short names collide. Names are unique per project; passing the same name updates the profile. task_description : str Short description of current focus (shows up in directory listings). Returns ------- dict { id, name, program, model, task_description, inception_ts, last_active_ts, project_id } Examples -------- Register with auto-generated name: ```json {"jsonrpc":"2.0","id":"3","method":"tools/call","params":{"name":"register_agent","arguments":{ "project_key":"/data/projects/backend","program":"codex-cli","model":"gpt5-codex","task_description":"Auth refactor" }}} ``` Register with explicit task name: ```json {"jsonrpc":"2.0","id":"4","method":"tools/call","params":{"name":"register_agent","arguments":{ "project_key":"/data/projects/backend","program":"claude-code","model":"opus-4.1","name":"app-x-refactor","task_description":"Navbar redesign" }}} ``` Pitfalls -------- - Unsafe or reserved names are rejected before an identity is created. - Names are case-insensitive unique. If you see "already in use", pick another or omit `name`. - Use the same `project_key` consistently across cooperating agents. Optional cryptographic proof gate --------------------------------- By default registration is self-asserted (no proof needed). When the operator enables `[registration.proof_gate]`, pass a signed proof bundle as `registration_proof` (a JSON string binding identity, project_key, program, model, capability scope, issued_at, expires_at, and a nonce, signed by a configured trust-anchor Ed25519 key). When the gate is enabled, registration fails closed (no agent is created) if the proof is missing, malformed, untrusted, expired, replayed, or does not match the requested identity/scope.release_build_slotMark an active slot lease as released (non-destructive; keeps JSON with released_ts).release_file_reservationsrenew_build_slotExtend expiry for an existing build slot lease. No-op if missing.renew_file_reservationsreply_messagerequest_contactRequest contact approval to message another agent. Creates (or refreshes) a pending AgentLink and sends a small ack_required intro message. Discovery --------- To discover available agent names, use: resource://agents/{project_key} Agent names are NOT the same as program names or user names. Parameters ---------- project_key : str Project slug or human key. from_agent : str Your agent name (must be registered in the project). to_agent : str Target agent name (use resource://agents/{project_key} to discover names). to_project : Optional[str] Target project if different from your project (cross-project coordination). reason : str Optional explanation for the contact request. ttl_seconds : int Time to live for the contact approval request (default: 7 days).resolve_pane_identityResolve the agent name for a tmux pane from the canonical per-pane identity file. Checks the following locations in priority order: 1. Canonical: ~/.config/agent-mail/identity/<project_hash>/<pane_id> 2. Legacy Claude Code: ~/.claude/agent-mail/identity.<pane_id> 3. Legacy NTM: /tmp/agent-mail-name.<project_hash>.<pane_id> Each candidate passes the GH#252 liveness predicate before it is returned: a binding verifiably live in a DIFFERENT pane is never handed out (the lookup reports not-found so the caller mints a fresh identity), a dead binding is adopted and rewritten with the caller pane's facts, and legacy bare-name files resolve under a conservative compatibility rule. The response's `binding` field reports which case applied: "verified-live", "adopted-dead", or "legacy-unverified". Parameters ---------- project_key : str Absolute path to the project directory (used to scope the lookup). pane_id : Optional[str] Tmux pane identifier (e.g., "%0", "%3"). If omitted, reads $TMUX_PANE. tmux_socket_path : Optional[str] Absolute socket path of the tmux server `pane_id` belongs to (first field of the caller's $TMUX). Pane ids are only unique per server; the HTTP daemon fills this from the X-Tmux-Socket header. Ignored when pane_id is omitted (the $TMUX_PANE fallback is this process's own pane, on its own server). Returns ------- dict { agent_name, pane_id, identity_path, binding }respond_contactApprove or deny a contact request.retire_agentSoft-delete an agent: mark it as retired so it stops accepting new messages while preserving message history. Retired agents are hidden from active agent lists but visible in 'all agents' views. Rust authorization extension: over stdio, authorization requires either the agent registration_token or a tmux pane bound to the agent; over HTTP (am serve-http) the registration_token is required and pane context does not authorize. The token is the `registration_token` field returned by register_agent / create_agent_identity / macro_start_session.revoke_agent_tokenRevoke an agent's bearer credential without deleting or retiring the identity. Requires its current non-empty registration_token on every transport; neither pane nor session ownership substitutes for that token. The token is cleared atomically, and stale credentials cannot overwrite a concurrent rotation or authorize sends, replies, or further credential changes. Returns {project_id, agent_id, name, token_status: 'revoked', registration_token_returned: false}; no secret is returned. Existing MCP session ownership and the trusted-local tokenless messaging default remain unchanged. Use the existing authorized registration/operator path to issue a new credential after revocation.rotate_agent_tokenRotate an agent's bearer credential without changing its profile, activity, retirement status, or session bindings. Requires the current non-empty registration_token on every transport; neither a pane nor an existing session substitutes for the token. Concurrent use of a stale credential fails closed. The previous token stops authorizing sends, replies, and credential changes. return_registration_token defaults to false: the replacement is persisted but omitted from the result unless explicitly requested. Returns {project_id, agent_id, name, token_status: 'rotated', registration_token_returned}, plus registration_token only when requested. This changes bearer credentials only; existing session ownership and trusted-local tokenless behavior are unchanged. If the replacement is not returned, recovery uses the existing authorized registration/operator path.search_messagesSearch over subject and body for a project using the unified Search V3 service. Tips ---- - Query parser supports phrases ("build plan"), prefix (mig*), and boolean operators (plan AND users) - Results default to relevance ranking; set `ranking="recency"` for newest-first - Limit defaults to 20; raise for broad queries - All filter parameters are optional; omit to search without filtering Query examples -------------- - Phrase search: `"build plan"` - Prefix: `migrat*` - Boolean: `plan AND users` - Require urgent: `urgent AND deployment` Parameters ---------- project_key : str Project identifier. query : str Search query string. limit : int Max results to return (default 20, max 1000). offset : int Offset after filtering (default 0; offset plus limit at most 5000). cursor : str Continue with next_cursor and the same project, query, and filters. Overrides offset. ranking : str Ranking mode: "relevance" (default) or "recency" (newest first). sender : str Filter by sender agent name (exact match). Aliases: `from_agent`, `sender_name`. recipient_kind : str Keep direct agent or shared project-mailbox deliveries as "to", "cc", or "bcc". BCC identities are never returned. Sparse matches may reach the bounded page budget before filling limit. Continue with next_cursor, including when result is empty; diagnostics and guidance identify a partial page. importance : str Filter by importance level(s). Comma-separated: "low", "normal", "high", "urgent". thread_id : str Filter by thread ID (exact match). date_start : str Inclusive lower bound for created timestamp. date_end : str Inclusive upper bound for created timestamp. Aliases for start: `date_from`, `after`, `since`. Aliases for end: `date_to`, `before`, `until`. Date-only values are normalized in UTC (`date_end` includes the full day). explain : bool If true, include query explain metadata in the response (default false). include_body_md : bool Include full message bodies (default false). Returns ------- dict { result: [{ id, subject, importance, ack_required, created_ts, thread_id, from }], assistance?, guidance?, explain?, next_cursor?, diagnostics? } `diagnostics` is present when degraded-mode signals are detected (budget governor pressure, stage timeout, recipient-kind page budget). Examples -------- Basic search: ```json {"project_key":"/abs/path/backend","query":"build plan","limit":50} ``` Filtered search: ```json {"project_key":"/abs/path/backend","query":"migration","sender":"BlueLake","recipient_kind":"cc","importance":"high,urgent","ranking":"recency"} ```search_messages_productSearch across all projects linked to a product using the unified Search V3 service. Parameters ---------- product_key : str Product identifier. query : str Search query string. limit : int Max results to return (default 20, max 1000). cursor : str Stable pagination cursor for large result sets. project : str Optional project filter inside the product scope. Aliases: `project_key_filter`, `project_slug`, `proj`. sender : str Filter by sender agent name (exact match). Aliases: `from_agent`, `sender_name`. importance : str Filter by importance level(s). Comma-separated: "low", "normal", "high", "urgent". thread_id : str Filter by thread ID (exact match). date_start : str Inclusive lower bound for created timestamp. date_end : str Inclusive upper bound for created timestamp. Aliases for start: `date_from`, `after`, `since`. Aliases for end: `date_to`, `before`, `until`. Returns ------- dict { result: [{ id, subject, importance, ack_required, created_ts, thread_id, from, project_id }], assistance?, next_cursor?, diagnostics? } Rust extension -------------- Set `include_body_md=true` to include the full `body_md` field on each result. Use this when the caller intends to read message contents directly from search output rather than via `fetch_inbox_product` or `resource://thread/...`.send_messageset_contact_policySet contact policy for an active agent: open | auto | contacts_only | block_all. Retired agents must be unretired first; deregistered agents cannot change contact authorization.summarize_threadExtract participants, key points, and action items for one or more threads. Single-thread mode (thread_id is a single ID): - Returns detailed summary with optional example messages - Response: { thread_id, summary: {participants[], key_points[], action_items[]}, examples[] } Multi-thread mode (thread_id is comma-separated IDs like "TKT-1,TKT-2,TKT-3"): - Returns aggregate digest across all threads - Response: { threads: [{thread_id, summary}], aggregate: {top_mentions[], key_points[], action_items[]} } Parameters ---------- project_key : str Project identifier. thread_id : str Single thread ID for detailed summary, OR comma-separated IDs for aggregate digest. include_examples : bool If true (single-thread mode only), include up to 3 sample messages. llm_mode : bool If true and LLM is enabled, refine the summary with AI. llm_model : Optional[str] Override model name for the LLM call. per_thread_limit : int Max messages to consider per thread (multi-thread mode). Examples -------- Single thread: ```json {"thread_id": "TKT-123", "include_examples": true} ``` Multiple threads: ```json {"thread_id": "TKT-1,TKT-2,TKT-3"} ```summarize_thread_productSummarize a thread (by id or thread key) across all projects linked to a product.uninstall_precommit_guardunretire_agentRestore a retired agent back to active status. The agent will resume accepting new messages. Rust authorization extension: deregistered agents cannot be unretired. Over stdio, authorization requires either the agent registration_token or a tmux pane bound to the agent; over HTTP (am serve-http) the registration_token is required and pane context does not authorize. The token is the `registration_token` field returned by register_agent / create_agent_identity / macro_start_session.whoisReturn enriched profile details for an agent, optionally including recent archive commits. Discovery --------- To discover available agent names, use: resource://agents/{project_key} Agent names are NOT the same as program names or user names. Parameters ---------- project_key : str Project slug or human key. agent_name : str Agent name to look up (use resource://agents/{project_key} to discover names). include_recent_commits : bool If true (the default), include recent commits touching this agent's archive directory. History enrichment has a bounded scan so large archives cannot delay the profile indefinitely. commit_limit : int Maximum number of recent commits to include. Returns ------- dict Agent profile augmented with { recent_commits: [{hexsha, summary, authored_ts}] } when requested. If a scan budget is reached, recent_commits_truncated is true and older matching commits may exist. Commit traversal starts at HEAD; imported merges or skewed commit clocks do not guarantee global timestamp ordering.Security checks
Static checks derived from the repository yesterday. Heuristics on the source, not an audit.
- ✓README presentThe repository's README runs to about 23K words.
- ✓License declaredUsable under a stated license.
- ✓Tests presentA test suite exists in the repository.
- ✓Dependencies pinnedDependency versions are pinned by Cargo.lock and 4 more.
- !No dynamic code executionScanned 468 source files and found 5 calls to eval or shell execution, in crates/mcp-agent-mail-cli/src/doctor/fixers/login_shell_path_leak.rs, crates/mcp-agent-mail-share/src/scope.rs and crates/mcp-agent-mail-share/src/scope/prune.rs among others. Review how tool inputs reach them before granting credentials.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
Releases
README
The repository's README runs to about 23K words, fetched yesterday. The original in the repository is authoritative.
Read full README