team-communication-protocols

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Team Communication Protocols

Agent团队通信协议

Protocols for effective communication between agent teammates, including message type selection, plan approval workflows, shutdown procedures, and common anti-patterns to avoid.
适用于Agent队友间高效通信的协议,包括消息类型选择、计划审批工作流、关闭流程以及需要避免的常见反模式。

When to Use This Skill

何时使用此技能

  • Establishing communication norms for a new team
  • Choosing between message types (message, broadcast, shutdown_request)
  • Handling plan approval workflows
  • Managing graceful team shutdown
  • Discovering teammate identities and capabilities
  • 为新团队建立通信规范
  • 在消息类型(message、broadcast、shutdown_request)之间进行选择
  • 处理计划审批工作流
  • 管理团队优雅关闭
  • 发现队友的身份和能力

Message Type Selection

消息类型选择

message
(Direct Message) — Default Choice

message
(直接消息)—— 默认选择

Send to a single specific teammate:
json
{
  "type": "message",
  "recipient": "implementer-1",
  "content": "Your API endpoint is ready. You can now build the frontend form.",
  "summary": "API endpoint ready for frontend"
}
Use for: Task updates, coordination, questions, integration notifications.
发送给单个特定队友:
json
{
  "type": "message",
  "recipient": "implementer-1",
  "content": "Your API endpoint is ready. You can now build the frontend form.",
  "summary": "API endpoint ready for frontend"
}
适用场景:任务更新、协调沟通、问题咨询、集成通知。

broadcast
— Use Sparingly

broadcast
— 谨慎使用

Send to ALL teammates simultaneously:
json
{
  "type": "broadcast",
  "content": "Critical: shared types file has been updated. Pull latest before continuing.",
  "summary": "Shared types updated"
}
Use ONLY for: Critical blockers affecting everyone, major changes to shared resources.
Why sparingly?: Each broadcast sends N separate messages (one per teammate), consuming API resources proportional to team size.
同时发送给所有队友:
json
{
  "type": "broadcast",
  "content": "Critical: shared types file has been updated. Pull latest before continuing.",
  "summary": "Shared types updated"
}
仅适用于:影响所有人的关键阻塞问题、共享资源的重大变更。
为何要谨慎使用?:每条broadcast会发送N条独立消息(每个队友一条),消耗的API资源与团队规模成正比。

shutdown_request
— Graceful Termination

shutdown_request
— 优雅终止

Request a teammate to shut down:
json
{
  "type": "shutdown_request",
  "recipient": "reviewer-1",
  "content": "Review complete, shutting down team."
}
The teammate responds with
shutdown_response
(approve or reject with reason).
请求队友关闭:
json
{
  "type": "shutdown_request",
  "recipient": "reviewer-1",
  "content": "Review complete, shutting down team."
}
队友会回复
shutdown_response
(批准或附带理由拒绝)。

Communication Anti-Patterns

通信反模式

Anti-PatternProblemBetter Approach
Broadcasting routine updatesWastes resources, noiseDirect message to affected teammate
Sending JSON status messagesNot designed for structured dataUse TaskUpdate to update task status
Not communicating at integration pointsTeammates build against stale interfacesMessage when your interface is ready
Micromanaging via messagesOverwhelms teammates, slows workCheck in at milestones, not every step
Using UUIDs instead of namesHard to read, error-proneAlways use teammate names
Ignoring idle teammatesWasted capacityAssign new work or shut down
反模式问题点更佳做法
广播常规更新内容浪费资源、产生噪音给受影响的队友发送直接消息
发送JSON状态消息并非为结构化数据设计使用TaskUpdate来更新任务状态
在集成节点不进行通信队友基于过时的接口进行开发当你的接口准备就绪时发送消息通知
通过消息进行微观管理让队友不堪重负、拖慢工作进度在里程碑节点检查,而非每一步都跟进
使用UUID而非名称难以阅读、容易出错始终使用队友的名称
忽略闲置的队友浪费产能分配新工作或关闭该队友

Plan Approval Workflow

计划审批工作流

When a teammate is spawned with
plan_mode_required
:
  1. Teammate creates a plan using read-only exploration tools
  2. Teammate calls
    ExitPlanMode
    which sends a
    plan_approval_request
    to the lead
  3. Lead reviews the plan
  4. Lead responds with
    plan_approval_response
    :
Approve:
json
{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "implementer-1",
  "approve": true
}
Reject with feedback:
json
{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "implementer-1",
  "approve": false,
  "content": "Please add error handling for the API calls"
}
当某个队友以
plan_mode_required
模式启动时:
  1. 队友使用只读探索工具创建计划
  2. 队友调用
    ExitPlanMode
    ,向负责人发送
    plan_approval_request
  3. 负责人审核计划
  4. 负责人回复
    plan_approval_response
批准
json
{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "implementer-1",
  "approve": true
}
附带反馈的拒绝
json
{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "implementer-1",
  "approve": false,
  "content": "Please add error handling for the API calls"
}

Shutdown Protocol

关闭协议

Graceful Shutdown Sequence

优雅关闭流程

  1. Lead sends shutdown_request to each teammate
  2. Teammate receives request as a JSON message with
    type: "shutdown_request"
  3. Teammate responds with
    shutdown_response
    :
    • approve: true
      — Teammate saves state and exits
    • approve: false
      + reason — Teammate continues working
  4. Lead handles rejections — Wait for teammate to finish, then retry
  5. After all teammates shut down — Call
    Teammate
    cleanup
  1. 负责人向每个队友发送shutdown_request
  2. 队友收到请求,格式为
    type: "shutdown_request"
    的JSON消息
  3. 队友回复
    shutdown_response
    • approve: true
      — 队友保存状态并退出
    • approve: false
      + 理由 — 队友继续工作
  4. 负责人处理拒绝请求 — 等待队友完成当前任务后重试
  5. 所有队友关闭后 — 调用
    Teammate
    清理操作

Handling Rejections

处理拒绝请求

If a teammate rejects shutdown:
  • Check their reason (usually "still working on task")
  • Wait for their current task to complete
  • Retry shutdown request
  • If urgent, user can force shutdown
如果某个队友拒绝关闭:
  • 查看其拒绝理由(通常是“仍在处理任务”)
  • 等待其完成当前任务
  • 重试关闭请求
  • 若情况紧急,用户可强制关闭

Teammate Discovery

队友发现

Find team members by reading the config file:
Location:
~/.claude/teams/{team-name}/config.json
Structure:
json
{
  "members": [
    {
      "name": "security-reviewer",
      "agentId": "uuid-here",
      "agentType": "team-reviewer"
    },
    {
      "name": "perf-reviewer",
      "agentId": "uuid-here",
      "agentType": "team-reviewer"
    }
  ]
}
Always use
name
for messaging and task assignment. Never use
agentId
directly.
通过读取配置文件查找团队成员:
位置
~/.claude/teams/{team-name}/config.json
结构
json
{
  "members": [
    {
      "name": "security-reviewer",
      "agentId": "uuid-here",
      "agentType": "team-reviewer"
    },
    {
      "name": "perf-reviewer",
      "agentId": "uuid-here",
      "agentType": "team-reviewer"
    }
  ]
}
**始终使用
name
**进行消息发送和任务分配。切勿直接使用
agentId
。",