重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
agent-mail by dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations
npx skills add https://github.com/dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations --skill agent-mail一个面向编码智能体的类邮件协调层,以仅限 HTTP 的 FastMCP 服务器形式提供。提供易记的身份标识、收件箱/发件箱、文件预留租约、联系人策略、可搜索的消息历史记录以及人类监督者消息功能。后端基于 Git(可供人类审计的产物)和 SQLite(支持 FTS5 的快速查询)。
在没有协调机制的情况下,多个智能体会:
Agent Mail 通过以下方式解决此问题:
# 最快的方式(安装时添加的别名)
am
# 或手动启动
cd ~/projects/mcp_agent_mail
./scripts/run_server_with_token.sh
默认地址:http://127.0.0.1:8765 供人类使用的 Web UI:http://127.0.0.1:8765/mail
每个工作目录(绝对路径)都是一个项目。同一目录下的智能体共享一个项目命名空间。对于需要协调的智能体,请使用相同的 project_key。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
智能体使用形容词+名词的名称(如 GreenCastle、BlueLake)进行注册。名称在每个项目中是唯一的、易记的,并会出现在收件箱、提交日志和 Web UI 中。
对文件路径或通配符的建议性锁定。在编辑文件之前,先预留它们以表明意图。其他智能体可以看到预留信息,并可以选择不同的工作。可选的提交前守卫会阻止与其他人独占预留冲突的提交。
每个智能体的策略控制谁可以向谁发送消息:
| 策略 | 行为 |
|---|---|
open | 接受项目中的任何消息 |
auto(默认) | 如果存在共享上下文(同一线程、重叠的预留、近期联系)则允许 |
contacts_only | 需要先获得明确的联系人批准 |
block_all | 拒绝所有新的联系人请求 |
支持 GitHub 风格的 Markdown,具有线程化、重要性级别(low、normal、high、urgent)和可选的确认要求。图片会自动转换为 WebP 格式。
macro_start_session(
human_key="/abs/path/to/project",
program="claude-code",
model="opus-4.5",
task_description="Implementing auth module"
)
返回:{project, agent, file_reservations, inbox}
这个单一调用会:确保项目存在、注册您的身份、可选地预留文件、获取您的收件箱。
file_reservation_paths(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
paths=["src/auth/**/*.ts", "src/middleware/auth.ts"],
ttl_seconds=3600,
exclusive=true,
reason="bd-123"
)
返回:{granted: [...], conflicts: [...]}
即使存在冲突也会报告,但预留仍会被授予。请检查冲突并根据需要进行协调。
send_message(
project_key="/abs/path/to/project",
sender_name="GreenCastle",
to=["BlueLake"],
subject="[bd-123] Starting auth refactor",
body_md="Reserving src/auth/**. Will update session handling.",
thread_id="bd-123",
importance="normal",
ack_required=true
)
fetch_inbox(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
limit=20,
urgent_only=false,
include_bodies=true
)
或者使用资源进行快速读取:
resource://inbox/GreenCastle?project=/abs/path&limit=20&include_bodies=true
release_file_reservations(
project_key="/abs/path/to/project",
agent_name="GreenCastle"
)
为了速度和更小的模型,建议使用宏。当您需要精细控制时,请使用细粒度的工具。
| 宏 | 用途 |
|---|---|
macro_start_session | 引导:确保项目存在 → 注册智能体 → 可选的文件预留 → 获取收件箱 |
macro_prepare_thread | 加入现有对话:注册 → 总结线程 → 获取收件箱上下文 |
macro_file_reservation_cycle | 预留文件,执行工作,完成后可选自动释放 |
macro_contact_handshake | 请求联系人权限,可选自动接受,发送欢迎消息 |
当使用 Beads 进行任务管理时,请保持标识符一致:
1. 选择就绪的工作: bd ready --json → 选择 bd-123
2. 预留文件: file_reservation_paths(..., reason="bd-123")
3. 宣布开始: send_message(..., thread_id="bd-123", subject="[bd-123] Starting...")
4. 工作并更新: 在主题中回复进度
5. 完成: bd close bd-123
release_file_reservations(...)
send_message(..., subject="[bd-123] Completed")
将 bd-### 用作:
thread_id[bd-###]reason使用 bv 的机器人标志进行智能任务选择:
| 标志 | 输出 | 用例 |
|---|---|---|
bv --robot-insights | PageRank、关键路径、循环 | "什么影响最大?" |
bv --robot-plan | 并行轨道、解除阻塞 | "什么可以并行运行?" |
bv --robot-priority | 带有置信度的推荐 | "我接下来应该做什么?" |
bv --robot-diff --diff-since <ref> | 自提交/日期以来的更改 | "发生了什么变化?" |
经验法则: 使用 bd 进行任务操作,使用 bv 获取任务智能。
对于前端/后端或多仓库项目:
选项 A:共享 project_key 两个仓库使用相同的 project_key。智能体自动协调。
选项 B:具有联系人链接的独立项目
# 后端智能体请求与前端智能体建立联系
request_contact(
project_key="/abs/path/backend",
from_agent="GreenCastle",
to_agent="BlueLake",
to_project="/abs/path/frontend",
reason="API contract coordination"
)
# 前端智能体接受
respond_contact(
project_key="/abs/path/frontend",
to_agent="BlueLake",
from_agent="GreenCastle",
accept=true
)
安装守卫以阻止与其他人独占预留冲突的提交:
install_precommit_guard(
project_key="/abs/path/to/project",
code_repo_path="/abs/path/to/project"
)
hooks.d/ 中现有的钩子设置 AGENT_NAME 环境变量,以便守卫知道您的身份。
紧急情况下绕过:AGENT_MAIL_BYPASS=1 git commit ...
| 工具 | 用途 |
|---|---|
ensure_project(human_key) | 创建/确保项目存在 |
register_agent(project_key, program, model, name?, task_description?) | 注册身份 |
whois(project_key, agent_name) | 获取智能体配置文件及最近提交 |
create_agent_identity(project_key, program, model) | 始终创建新的唯一智能体 |
| 工具 | 用途 |
|---|---|
send_message(project_key, sender, to, subject, body_md, ...) | 发送消息 |
reply_message(project_key, message_id, sender, body_md) | 回复(保留线程) |
fetch_inbox(project_key, agent, limit?, since_ts?, urgent_only?) | 获取消息 |
mark_message_read(project_key, agent, message_id) | 标记为已读 |
acknowledge_message(project_key, agent, message_id) | 确认收到 |
search_messages(project_key, query) | FTS5 搜索 |
summarize_thread(project_key, thread_id) | 提取关键点和操作 |
| 工具 | 用途 |
|---|---|
file_reservation_paths(project_key, agent, paths, ttl?, exclusive?) | 预留文件 |
release_file_reservations(project_key, agent, paths?) | 释放预留 |
renew_file_reservations(project_key, agent, extend_seconds?) | 延长 TTL |
force_release_file_reservation(project_key, agent, reservation_id) | 清除过时的预留 |
| 工具 | 用途 |
|---|---|
request_contact(project_key, from_agent, to_agent, reason?) | 请求发送消息的权限 |
respond_contact(project_key, to_agent, from_agent, accept) | 接受/拒绝联系人请求 |
list_contacts(project_key, agent_name) | 列出联系人链接 |
set_contact_policy(project_key, agent_name, policy) | 设置 open/auto/contacts_only/block_all |
使用资源进行快速、非变异的读取:
resource://inbox/{agent}?project=<path>&limit=20&include_bodies=true
resource://thread/{thread_id}?project=<path>&include_bodies=true
resource://message/{id}?project=<path>
resource://file_reservations/{slug}?active_only=true
resource://project/{slug}
resource://projects
resource://agents/{project_key}
"exact phrase"
prefix*
term1 AND term2
term1 OR term2
subject:login
body:"api key"
(auth OR login) AND NOT admin
示例:search_messages(project_key, '"auth module" AND error NOT legacy')
在 http://127.0.0.1:8765/mail 浏览:
向智能体发送带有自动前言说明的直接消息:
high 重要性将项目导出为便携式、只读的捆绑包,供审计员、利益相关者或存档使用:
# 交互式向导(推荐)
uv run python -m mcp_agent_mail.cli share wizard
# 手动导出
uv run python -m mcp_agent_mail.cli share export --output ./bundle
# 带签名
uv run python -m mcp_agent_mail.cli share export \
--output ./bundle \
--signing-key ./keys/signing.key
# 本地预览
uv run python -m mcp_agent_mail.cli share preview ./bundle
standard(移除密钥)或 strict(编辑正文)# 保存当前状态
uv run python -m mcp_agent_mail.cli archive save --label nightly
# 列出恢复点
uv run python -m mcp_agent_mail.cli archive list --json
# 灾难后恢复
uv run python -m mcp_agent_mail.cli archive restore <file>.zip --force
# 运行诊断
uv run python -m mcp_agent_mail.cli doctor check
# 预览修复
uv run python -m mcp_agent_mail.cli doctor repair --dry-run
# 应用修复(首先创建备份)
uv run python -m mcp_agent_mail.cli doctor repair
检查项:过时的锁、数据库完整性、孤立记录、FTS 同步、过期的预留。
| 错误 | 修复方法 |
|---|---|
| "sender_name not registered" | 先调用 register_agent 或 macro_start_session |
| "FILE_RESERVATION_CONFLICT" | 等待过期、协调或使用非独占预留 |
| "CONTACT_BLOCKED" | 使用 request_contact 并等待批准 |
| 收件箱为空 | 检查 since_ts、urgent_only,确认智能体名称完全匹配 |
# 单行命令(推荐)
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/mcp_agent_mail/main/scripts/install.sh?$(date +%s)" | bash -s -- --yes
# 自定义端口
curl -fsSL ... | bash -s -- --port 9000 --yes
# 安装后更改端口
uv run python -m mcp_agent_mail.cli config set-port 9000
| 变量 | 默认值 | 描述 |
|---|---|---|
STORAGE_ROOT | ~/.mcp_agent_mail_git_mailbox_repo | 仓库和 SQLite DB 的根目录 |
HTTP_PORT | 8765 | 服务器端口 |
HTTP_BEARER_TOKEN | — | 用于身份验证的静态承载令牌 |
LLM_ENABLED | true | 启用 LLM 进行摘要/发现 |
CONTACT_ENFORCEMENT_ENABLED | true | 强制执行联系人策略 |
docker build -t mcp-agent-mail .
docker run --rm -p 8765:8765 \
-e HTTP_HOST=0.0.0.0 \
-v agent_mail_data:/data \
mcp-agent-mail
| 工具 | 集成方式 |
|---|---|
| NTM | 智能体窗格通过邮件协调,仪表板显示收件箱 |
| BV | 任务 ID 成为线程 ID,机器人标志通知任务选择 |
| CASS | 跨会话搜索邮件线程 |
| CM | 从邮件存档中提取程序性记忆 |
| DCG | 邮件通知智能体被阻止的命令 |
| RU | 通过跨项目邮件协调多仓库更新 |
每周安装次数
41
仓库
GitHub 星标数
55
首次出现时间
2026年1月20日
安全审计
安装在
gemini-cli31
opencode30
codex28
claude-code25
cursor24
amp24
A mail-like coordination layer for coding agents exposed as an HTTP-only FastMCP server. Provides memorable identities, inbox/outbox, file reservation leases, contact policies, searchable message history, and Human Overseer messaging. Backed by Git (human-auditable artifacts) and SQLite (fast queries with FTS5).
Without coordination, multiple agents:
Agent Mail solves this with:
# Quickest way (alias added during install)
am
# Or manually
cd ~/projects/mcp_agent_mail
./scripts/run_server_with_token.sh
Default: http://127.0.0.1:8765 Web UI for humans: http://127.0.0.1:8765/mail
Each working directory (absolute path) is a project. Agents in the same directory share a project namespace. Use the same project_key for agents that need to coordinate.
Agents register with adjective+noun names (GreenCastle, BlueLake). Names are unique per project, memorable, and appear in inboxes, commit logs, and the web UI.
Advisory locks on file paths or globs. Before editing files, reserve them to signal intent. Other agents see the reservation and can choose different work. The optional pre-commit guard blocks commits that conflict with others' exclusive reservations.
Per-agent policies control who can message whom:
| Policy | Behavior |
|---|---|
open | Accept any message in the project |
auto (default) | Allow if shared context exists (same thread, overlapping reservations, recent contact) |
contacts_only | Require explicit contact approval first |
block_all | Reject all new contacts |
GitHub-Flavored Markdown with threading, importance levels (low, normal, high, urgent), and optional acknowledgment requirements. Images are auto-converted to WebP.
macro_start_session(
human_key="/abs/path/to/project",
program="claude-code",
model="opus-4.5",
task_description="Implementing auth module"
)
Returns: {project, agent, file_reservations, inbox}
This single call: ensures project exists, registers your identity, optionally reserves files, fetches your inbox.
file_reservation_paths(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
paths=["src/auth/**/*.ts", "src/middleware/auth.ts"],
ttl_seconds=3600,
exclusive=true,
reason="bd-123"
)
Returns: {granted: [...], conflicts: [...]}
Conflicts are reported but reservations are still granted. Check conflicts and coordinate if needed.
send_message(
project_key="/abs/path/to/project",
sender_name="GreenCastle",
to=["BlueLake"],
subject="[bd-123] Starting auth refactor",
body_md="Reserving src/auth/**. Will update session handling.",
thread_id="bd-123",
importance="normal",
ack_required=true
)
fetch_inbox(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
limit=20,
urgent_only=false,
include_bodies=true
)
Or use resources for fast reads:
resource://inbox/GreenCastle?project=/abs/path&limit=20&include_bodies=true
release_file_reservations(
project_key="/abs/path/to/project",
agent_name="GreenCastle"
)
Prefer macros for speed and smaller models. Use granular tools when you need fine control.
| Macro | Purpose |
|---|---|
macro_start_session | Bootstrap: ensure project → register agent → optional file reservations → fetch inbox |
macro_prepare_thread | Join existing conversation: register → summarize thread → fetch inbox context |
macro_file_reservation_cycle | Reserve files, do work, optionally auto-release when done |
macro_contact_handshake | Request contact permission, optionally auto-accept, send welcome message |
When using Beads for task management, keep identifiers aligned:
1. Pick ready work: bd ready --json → choose bd-123
2. Reserve files: file_reservation_paths(..., reason="bd-123")
3. Announce start: send_message(..., thread_id="bd-123", subject="[bd-123] Starting...")
4. Work and update: Reply in thread with progress
5. Complete: bd close bd-123
release_file_reservations(...)
send_message(..., subject="[bd-123] Completed")
Use bd-### as:
thread_id[bd-###]reasonUse bv's robot flags for intelligent task selection:
| Flag | Output | Use Case |
|---|---|---|
bv --robot-insights | PageRank, critical path, cycles | "What's most impactful?" |
bv --robot-plan | Parallel tracks, unblocks | "What can run in parallel?" |
bv --robot-priority | Recommendations with confidence | "What should I work on next?" |
bv --robot-diff --diff-since <ref> | Changes since commit/date | "What changed?" |
Rule of thumb: Use bd for task operations, use bv for task intelligence.
For frontend/backend or multi-repo projects:
Option A: Shared project_key Both repos use the same project_key. Agents coordinate automatically.
Option B: Separate projects with contact links
# Backend agent requests contact with frontend agent
request_contact(
project_key="/abs/path/backend",
from_agent="GreenCastle",
to_agent="BlueLake",
to_project="/abs/path/frontend",
reason="API contract coordination"
)
# Frontend agent accepts
respond_contact(
project_key="/abs/path/frontend",
to_agent="BlueLake",
from_agent="GreenCastle",
accept=true
)
Install the guard to block commits that conflict with others' exclusive reservations:
install_precommit_guard(
project_key="/abs/path/to/project",
code_repo_path="/abs/path/to/project"
)
hooks.d/Set AGENT_NAME environment variable so the guard knows who you are.
Bypass in emergencies: AGENT_MAIL_BYPASS=1 git commit ...
| Tool | Purpose |
|---|---|
ensure_project(human_key) | Create/ensure project exists |
register_agent(project_key, program, model, name?, task_description?) | Register identity |
whois(project_key, agent_name) | Get agent profile with recent commits |
create_agent_identity(project_key, program, model) | Always create new unique agent |
| Tool | Purpose |
|---|---|
send_message(project_key, sender, to, subject, body_md, ...) | Send message |
reply_message(project_key, message_id, sender, body_md) | Reply (preserves thread) |
fetch_inbox(project_key, agent, limit?, since_ts?, urgent_only?) | Get messages |
mark_message_read(project_key, agent, message_id) | Mark as read |
acknowledge_message(project_key, agent, message_id) | Acknowledge receipt |
| Tool | Purpose |
|---|---|
file_reservation_paths(project_key, agent, paths, ttl?, exclusive?) | Reserve files |
release_file_reservations(project_key, agent, paths?) | Release reservations |
renew_file_reservations(project_key, agent, extend_seconds?) | Extend TTL |
force_release_file_reservation(project_key, agent, reservation_id) | Clear stale reservation |
| Tool | Purpose |
|---|---|
request_contact(project_key, from_agent, to_agent, reason?) | Request permission to message |
respond_contact(project_key, to_agent, from_agent, accept) | Accept/deny contact request |
list_contacts(project_key, agent_name) | List contact links |
set_contact_policy(project_key, agent_name, policy) | Set open/auto/contacts_only/block_all |
Use resources for quick, non-mutating reads:
resource://inbox/{agent}?project=<path>&limit=20&include_bodies=true
resource://thread/{thread_id}?project=<path>&include_bodies=true
resource://message/{id}?project=<path>
resource://file_reservations/{slug}?active_only=true
resource://project/{slug}
resource://projects
resource://agents/{project_key}
"exact phrase"
prefix*
term1 AND term2
term1 OR term2
subject:login
body:"api key"
(auth OR login) AND NOT admin
Example: search_messages(project_key, '"auth module" AND error NOT legacy')
Browse at http://127.0.0.1:8765/mail:
Send direct messages to agents with automatic preamble:
high importanceExport projects to portable, read-only bundles for auditors, stakeholders, or archives:
# Interactive wizard (recommended)
uv run python -m mcp_agent_mail.cli share wizard
# Manual export
uv run python -m mcp_agent_mail.cli share export --output ./bundle
# With signing
uv run python -m mcp_agent_mail.cli share export \
--output ./bundle \
--signing-key ./keys/signing.key
# Preview locally
uv run python -m mcp_agent_mail.cli share preview ./bundle
standard (removes secrets) or strict (redacts bodies)# Save current state
uv run python -m mcp_agent_mail.cli archive save --label nightly
# List restore points
uv run python -m mcp_agent_mail.cli archive list --json
# Restore after disaster
uv run python -m mcp_agent_mail.cli archive restore <file>.zip --force
# Run diagnostics
uv run python -m mcp_agent_mail.cli doctor check
# Preview repairs
uv run python -m mcp_agent_mail.cli doctor repair --dry-run
# Apply repairs (creates backup first)
uv run python -m mcp_agent_mail.cli doctor repair
Checks: stale locks, database integrity, orphaned records, FTS sync, expired reservations.
| Error | Fix |
|---|---|
| "sender_name not registered" | Call register_agent or macro_start_session first |
| "FILE_RESERVATION_CONFLICT" | Wait for expiry, coordinate, or use non-exclusive |
| "CONTACT_BLOCKED" | Use request_contact and wait for approval |
| Empty inbox | Check since_ts, urgent_only, verify agent name matches exactly |
# One-liner (recommended)
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/mcp_agent_mail/main/scripts/install.sh?$(date +%s)" | bash -s -- --yes
# Custom port
curl -fsSL ... | bash -s -- --port 9000 --yes
# Change port after installation
uv run python -m mcp_agent_mail.cli config set-port 9000
| Variable | Default | Description |
|---|---|---|
STORAGE_ROOT | ~/.mcp_agent_mail_git_mailbox_repo | Root for repos and SQLite DB |
HTTP_PORT | 8765 | Server port |
HTTP_BEARER_TOKEN | — | Static bearer token for auth |
LLM_ENABLED | true |
docker build -t mcp-agent-mail .
docker run --rm -p 8765:8765 \
-e HTTP_HOST=0.0.0.0 \
-v agent_mail_data:/data \
mcp-agent-mail
| Tool | Integration |
|---|---|
| NTM | Agent panes coordinate via mail, dashboard shows inbox |
| BV | Task IDs become thread IDs, robot flags inform task selection |
| CASS | Search mail threads across sessions |
| CM | Extract procedural memory from mail archives |
| DCG | Mail notifies agents of blocked commands |
| RU | Coordinate multi-repo updates via cross-project mail |
Weekly Installs
41
Repository
GitHub Stars
55
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
gemini-cli31
opencode30
codex28
claude-code25
cursor24
amp24
search_messages(project_key, query)| FTS5 search |
summarize_thread(project_key, thread_id) | Extract key points and actions |
| Enable LLM for summaries/discovery |
CONTACT_ENFORCEMENT_ENABLED | true | Enforce contact policy |