inbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInbox Skill
Inbox Skill
Quick Ref: Monitor Agent Mail from any session. View pending messages, help requests, completions.
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Monitor Agent Mail messages for coordination across agents.
Requires: MCP Agent Mail tools OR HTTP endpoint at localhost:8765.
快速参考: 在任意会话中监控Agent Mail。查看待处理消息、帮助请求和已完成任务。
你必须执行此工作流,不能仅进行描述。
监控Agent Mail消息,实现Agent间的协同调度。
依赖条件: MCP Agent Mail工具 或 运行在localhost:8765的HTTP端点。
Invocation
调用方式
bash
/inbox # Show current inbox state
/inbox --watch # Continuous polling modebash
/inbox # 显示当前收件箱状态
/inbox --watch # 持续轮询模式Execution Steps
执行步骤
Given :
/inbox [--watch]当调用时:
/inbox [--watch]Step 1: Check Agent Mail Availability
步骤1:检查Agent Mail可用性
bash
undefinedbash
undefinedCheck if Agent Mail MCP tools are available
检查Agent Mail MCP工具是否可用
Look for tools starting with mcp__mcp-agent-mail__
查找以mcp__mcp-agent-mail__开头的工具
Alternatively, check HTTP endpoint
或者检查HTTP端点
curl -s http://localhost:8765/health 2>/dev/null && echo "Agent Mail HTTP available" || echo "Agent Mail not running"
undefinedcurl -s http://localhost:8765/health 2>/dev/null && echo "Agent Mail HTTP可用" || echo "Agent Mail未运行"
undefinedStep 2: Determine Agent Identity
步骤2:确定Agent身份
bash
undefinedbash
undefinedCheck environment for agent identity
从环境变量中获取Agent身份
if [ -n "$OLYMPUS_DEMIGOD_ID" ]; then
AGENT_NAME="$OLYMPUS_DEMIGOD_ID"
elif [ -n "$AGENT_NAME" ]; then
AGENT_NAME="$AGENT_NAME"
else
# Default to asking or using hostname
AGENT_NAME="${USER:-unknown}-$(hostname -s 2>/dev/null || echo local)"
fi
if [ -n "$OLYMPUS_DEMIGOD_ID" ]; then
AGENT_NAME="$OLYMPUS_DEMIGOD_ID"
elif [ -n "$AGENT_NAME" ]; then
AGENT_NAME="$AGENT_NAME"
else
# 默认询问用户或使用主机名
AGENT_NAME="${USER:-unknown}-$(hostname -s 2>/dev/null || echo local)"
fi
Get project key (current repo path)
获取项目密钥(当前仓库路径)
PROJECT_KEY=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
echo "Agent: $AGENT_NAME"
echo "Project: $PROJECT_KEY"
undefinedPROJECT_KEY=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
echo "Agent: $AGENT_NAME"
echo "Project: $PROJECT_KEY"
undefinedStep 3: Fetch Inbox (MCP Method)
步骤3:获取收件箱(MCP方法)
Use MCP tool if available:
Tool: mcp__mcp-agent-mail__fetch_inbox
Parameters:
project_key: "<project-key>"
agent_name: "<agent-name>"Parse results into categories:
- Pending: Messages without acknowledgement
- HELP_REQUEST: Messages with subject containing "HELP_REQUEST"
- Completions: Messages with subject "OFFERING_READY" or "DONE"
如果MCP工具可用则使用:
工具: mcp__mcp-agent-mail__fetch_inbox
参数:
project_key: "<project-key>"
agent_name: "<agent-name>"将结果分类:
- 待处理: 未确认的消息
- HELP_REQUEST: 主题包含"HELP_REQUEST"的消息
- 已完成: 主题为"OFFERING_READY"或"DONE"的消息
Step 4: Search for HELP_REQUESTs Needing Response
步骤4:搜索需要响应的HELP_REQUEST
Search for unresolved help requests:
Tool: mcp__mcp-agent-mail__search_messages
Parameters:
project_key: "<project-key>"
query: "HELP_REQUEST"Filter to those without HELP_RESPONSE in same thread.
搜索未解决的帮助请求:
工具: mcp__mcp-agent-mail__search_messages
参数:
project_key: "<project-key>"
query: "HELP_REQUEST"过滤掉同一线程中已有HELP_RESPONSE的请求。
Step 5: Get Recent Completions
步骤5:获取近期已完成任务
Search for done messages:
Tool: mcp__mcp-agent-mail__search_messages
Parameters:
project_key: "<project-key>"
query: "OFFERING_READY OR DONE OR COMPLETED"搜索已完成的消息:
工具: mcp__mcp-agent-mail__search_messages
参数:
project_key: "<project-key>"
query: "OFFERING_READY OR DONE OR COMPLETED"Step 6: Summarize Threads (Optional)
步骤6:汇总线程(可选)
For active threads with multiple messages:
Tool: mcp__mcp-agent-mail__summarize_thread
Parameters:
project_key: "<project-key>"
thread_id: "<thread-id>"对于包含多条消息的活跃线程:
工具: mcp__mcp-agent-mail__summarize_thread
参数:
project_key: "<project-key>"
thread_id: "<thread-id>"Step 7: Display Results
步骤7:展示结果
Format output as:
markdown
undefined输出格式如下:
markdown
undefinedAgent Mail Inbox
Agent Mail收件箱
Agent: <agent-name>
Project: <project-key>
Checked: <timestamp>
Agent: <agent-name>
项目: <project-key>
检查时间: <timestamp>
Pending Messages (<count>)
待处理消息 (<数量>)
| From | Subject | Thread | Age |
|---|---|---|---|
| ... | ... | ... | ... |
| 发送方 | 主题 | 线程 | 时长 |
|---|---|---|---|
| ... | ... | ... | ... |
HELP_REQUESTs Needing Response (<count>)
需要响应的HELP_REQUEST (<数量>)
| From | Issue | Problem | Waiting |
|---|---|---|---|
| demigod-gt-123 | gt-123 | STUCK - Can't find auth module | 15m |
| ... | ... | ... | ... |
| 发送方 | 问题ID | 问题描述 | 等待时长 |
|---|---|---|---|
| demigod-gt-123 | gt-123 | 卡住 - 找不到认证模块 | 15分钟 |
| ... | ... | ... | ... |
Recent Completions (<count>)
近期已完成任务 (<数量>)
| Agent | Issue | Status | Completed |
|---|---|---|---|
| demigod-gt-124 | gt-124 | DONE | 2m ago |
| ... | ... | ... | ... |
| Agent | 问题ID | 状态 | 完成时间 |
|---|---|---|---|
| demigod-gt-124 | gt-124 | 已完成 | 2分钟前 |
| ... | ... | ... | ... |
Actions Needed
待执行操作
- Respond to HELP_REQUEST from demigod-gt-123 (waiting 15m)
- Acknowledge completion of gt-124
undefined- 回复来自demigod-gt-123的HELP_REQUEST(已等待15分钟)
- 确认gt-124任务完成
undefinedWatch Mode
监控模式
When flag is provided:
--watch当提供参数时:
--watchStep W1: Enter Polling Loop
步骤W1:进入轮询循环
bash
POLL_INTERVAL=30 # seconds
while true; do
clear
echo "=== Agent Mail Inbox (Watch Mode) ==="
echo "Press Ctrl+C to exit"
echo ""
# Execute Steps 3-7 above
# Show last update time
echo ""
echo "Last updated: $(date)"
echo "Next refresh in ${POLL_INTERVAL}s"
sleep $POLL_INTERVAL
donebash
POLL_INTERVAL=30 # 秒
while true; do
clear
echo "=== Agent Mail收件箱(监控模式) ==="
echo "按Ctrl+C退出"
echo ""
# 执行上述步骤3-7
# 显示最后更新时间
echo ""
echo "最后更新: $(date)"
echo "下次刷新将在${POLL_INTERVAL}秒后"
sleep $POLL_INTERVAL
doneStep W2: Alert on New Messages
步骤W2:新消息提醒
When new messages arrive since last poll:
bash
undefined当自上次轮询后有新消息到达时:
bash
undefinedCompare message counts
比较消息数量
if [ "$NEW_COUNT" -gt "$PREV_COUNT" ]; then
echo "*** NEW MESSAGES ($((NEW_COUNT - PREV_COUNT))) ***"
# Optionally use terminal bell
echo -e "\a"
fi
if [ "$NEW_COUNT" -gt "$PREV_COUNT" ]; then
echo "*** 新消息($((NEW_COUNT - PREV_COUNT))条) ***"
# 可选:触发终端提示音
echo -e "\a"
fi
Highlight urgent HELP_REQUESTs
高亮紧急HELP_REQUEST
if [ "$HELP_WAITING_MINS" -gt 5 ]; then
echo "*** URGENT: HELP_REQUEST waiting ${HELP_WAITING_MINS}m ***"
fi
undefinedif [ "$HELP_WAITING_MINS" -gt 5 ]; then
echo "*** 紧急:HELP_REQUEST已等待${HELP_WAITING_MINS}分钟 ***"
fi
undefinedStep W3: Show Message Summaries
步骤W3:显示消息摘要
For each new message, display summary:
markdown
---
**NEW:** From demigod-gt-125 | Thread: gt-125 | 10s ago
Subject: PROGRESS
> Step 4 in progress. Files touched: src/auth.py, tests/test_auth.py
---对于每条新消息,显示摘要:
markdown
---
**新消息:** 来自demigod-gt-125 | 线程: gt-125 | 10秒前
主题: 进度更新
> 步骤4进行中。涉及文件: src/auth.py, tests/test_auth.py
---MCP Tool Reference
MCP工具参考
| Tool | Purpose |
|---|---|
| Get messages for agent |
| Find messages by query |
| Summarize a thread |
| Mark message as read |
| 工具 | 用途 |
|---|---|
| 获取Agent的消息 |
| 根据查询条件查找消息 |
| 汇总线程内容 |
| 标记消息为已读 |
HTTP Fallback
HTTP备选方案
If MCP tools unavailable but HTTP server running:
bash
undefined如果MCP工具不可用但HTTP服务器已运行:
bash
undefinedFetch inbox via HTTP
通过HTTP获取收件箱
curl -s "http://localhost:8765/mcp/"
-H "Content-Type: application/json"
-d '{ "method": "fetch_inbox", "params": { "project_key": "<project-key>", "agent_name": "<agent-name>" } }'
-H "Content-Type: application/json"
-d '{ "method": "fetch_inbox", "params": { "project_key": "<project-key>", "agent_name": "<agent-name>" } }'
curl -s "http://localhost:8765/mcp/"
-H "Content-Type: application/json"
-d '{ "method": "fetch_inbox", "params": { "project_key": "<project-key>", "agent_name": "<agent-name>" } }'
-H "Content-Type: application/json"
-d '{ "method": "fetch_inbox", "params": { "project_key": "<project-key>", "agent_name": "<agent-name>" } }'
Search messages
搜索消息
curl -s "http://localhost:8765/mcp/"
-H "Content-Type: application/json"
-d '{ "method": "search_messages", "params": { "project_key": "<project-key>", "query": "HELP_REQUEST" } }'
-H "Content-Type: application/json"
-d '{ "method": "search_messages", "params": { "project_key": "<project-key>", "query": "HELP_REQUEST" } }'
undefinedcurl -s "http://localhost:8765/mcp/"
-H "Content-Type: application/json"
-d '{ "method": "search_messages", "params": { "project_key": "<project-key>", "query": "HELP_REQUEST" } }'
-H "Content-Type: application/json"
-d '{ "method": "search_messages", "params": { "project_key": "<project-key>", "query": "HELP_REQUEST" } }'
undefinedKey Rules
核心规则
- Check regularly - Agents may be waiting for help
- Prioritize HELP_REQUESTs - Blocked agents waste resources
- Acknowledge completions - Closes the coordination loop
- Use watch mode - For active orchestration sessions
- 定期检查 - Agent可能在等待帮助
- 优先处理HELP_REQUEST - 被阻塞的Agent会浪费资源
- 确认已完成任务 - 关闭协同循环
- 使用监控模式 - 适用于活跃的编排会话
Integration Points
集成点
| System | Integration |
|---|---|
| Beads | Thread IDs often match beads issue IDs (e.g., gt-123) |
| Demigod | Demigods send progress, help requests, completions |
| Mayor | Mayor monitors inbox for coordination decisions |
| Chiron | Chiron watches for HELP_REQUESTs to answer |
| 系统 | 集成方式 |
|---|---|
| Beads | 线程ID通常与Beads问题ID匹配(例如gt-123) |
| Demigod | Demigod发送进度更新、帮助请求和完成通知 |
| Mayor | Mayor监控收件箱以做出协同决策 |
| Chiron | Chiron监控HELP_REQUEST并提供解答 |
Example Session
示例会话
bash
undefinedbash
undefinedQuick check
快速检查
/inbox
/inbox
Output:
输出:
Agent Mail Inbox
Agent Mail收件箱
Agent: boden
Agent: boden
Project: /Users/fullerbt/gt/olympus
项目: /Users/fullerbt/gt/olympus
Pending Messages (2)
待处理消息(2)
- PROGRESS from demigod-ol-527 (5m ago)
- 来自demigod-ol-527的进度更新(5分钟前)
- HELP_REQUEST from demigod-ol-528 (2m ago)
- 来自demigod-ol-528的HELP_REQUEST(2分钟前)
HELP_REQUESTs Needing Response (1)
需要响应的HELP_REQUEST(1)
- demigod-ol-528: STUCK - Can't find skill template format
- demigod-ol-528: 卡住 - 找不到技能模板格式
Actions Needed:
待执行操作:
- [ ] Respond to HELP_REQUEST from demigod-ol-528
- [ ] 回复来自demigod-ol-528的HELP_REQUEST
Start monitoring
开始监控
/inbox --watch
undefined/inbox --watch
undefinedWithout Agent Mail
无Agent Mail时的处理
If Agent Mail is not available:
markdown
Agent Mail not available.
To enable:
1. Start MCP Agent Mail server:
Start your Agent Mail MCP server (implementation-specific). See `docs/agent-mail.md`.
2. Add to ~/.claude/mcp_servers.json:
{
"mcp-agent-mail": {
"type": "http",
"url": "http://127.0.0.1:8765/mcp/"
}
}
3. Restart Claude Code session如果Agent Mail不可用:
markdown
Agent Mail不可用。
启用方法:
1. 启动MCP Agent Mail服务器:
启动你的Agent Mail MCP服务器(具体实现依环境而定)。查看`docs/agent-mail.md`。
2. 添加到~/.claude/mcp_servers.json:
{
"mcp-agent-mail": {
"type": "http",
"url": "http://127.0.0.1:8765/mcp/"
}
}
3. 重启Claude Code会话References
参考资料
- Agent Mail Protocol: See for message format specifications
skills/shared/agent-mail-protocol.md - Parser (Go): - shared parser for all message types
cli/internal/agentmail/
- Agent Mail协议: 查看获取消息格式规范
skills/shared/agent-mail-protocol.md - 解析器(Go): - 所有消息类型的共享解析器
cli/internal/agentmail/