ClawTeam — Multi-Agent Swarm Coordination
Overview
ClawTeam is a CLI tool (clawteam) for orchestrating multiple AI agents as self-organizing swarms. It uses git worktree isolation, tmux windows, and filesystem-based messaging. OpenClaw is the default agent backend.
Source: https://github.com/win4r/ClawTeam-OpenClaw
Optimization Notes
This skill is based on the upstream ClawTeam project and includes additional safety/approval optimizations for real-world operations:
- - Channel-aware approval UX:
- Feishu uses interactive approval cards with same-row
Approve/Reject buttons.
- Telegram uses inline keyboard approval buttons.
- Other channels fall back to explicit text approval (
approve /
reject).
- - Safer execution defaults:
- No permission-bypass guidance.
- No infinite unattended monitor loops.
- Destructive operations require explicit approval checkpoints.
These changes are intentional enhancements, not a verbatim copy.
CLI binary: clawteam (must be preinstalled and available in PATH)
Install & Verification
This skill is instruction-only. It does not install clawteam automatically.
Install from a trusted source and pin a version/tag when possible.
CODEBLOCK0
Recommended preflight before first real run:
CODEBLOCK1
Quick Start
One-Command Template Launch (Recommended)
CODEBLOCK2
Manual Team Setup
CODEBLOCK3
Command Reference
Team Management
| Command | Description |
|---|
| INLINECODE7 | Create team |
| INLINECODE8 |
List all teams |
|
clawteam team status <team> | Show team members and info |
|
clawteam team cleanup <team> --force | Delete team and all data |
Task Management
| Command | Description |
|---|
| INLINECODE11 | Create task |
| INLINECODE12 |
List tasks (filterable) |
|
clawteam task update <team> <id> --status <status> | Update status |
|
clawteam task get <team> <id> | Get single task |
|
clawteam task stats <team> | Timing statistics |
|
clawteam task wait <team> | Block until all tasks complete |
Task statuses: pending, in_progress, completed, INLINECODE20
Dependency auto-resolution: When a blocking task completes, dependent tasks automatically change from blocked to pending.
Task locking: When a task moves to in_progress, it is locked by the calling agent. Other agents cannot claim it unless they use --force. Stale locks from dead agents are automatically released.
Agent Spawning
Use the default command (openclaw) unless the user explicitly requests another backend. Keep normal permission and trust prompts enabled.
CODEBLOCK4
High-impact note: spawn subprocess and custom backend modes can execute arbitrary code through delegated commands. Use only in trusted repositories/environments.
Each spawned agent gets:
- - Its own tmux window (visible via
board attach) - Its own git worktree branch (
clawteam/{team}/{agent}) - An auto-injected coordination prompt (how to use clawteam CLI)
- Environment variables:
CLAWTEAM_AGENT_NAME, CLAWTEAM_TEAM_NAME, etc.
Spawn safety features:
- - Commands are pre-validated before launch — you get a clear error if the agent CLI is not installed
- If a spawn fails, the registered team member and worktree are automatically rolled back
- Workspace trust and permission prompts must be reviewed and confirmed by the user or operator
Messaging
| Command | Description |
|---|
| INLINECODE31 | Point-to-point message |
| INLINECODE32 |
Broadcast to all |
|
clawteam inbox peek <team> -a <agent> | Peek without consuming |
|
clawteam inbox receive <team> | Consume messages |
|
clawteam inbox log <team> | View message history |
Monitoring
| Command | Description |
|---|
| INLINECODE36 | Kanban board (rich terminal) |
| INLINECODE37 |
All teams overview |
|
clawteam board live <team> | Live-refreshing board |
|
clawteam board attach <team> | Tmux tiled view |
|
clawteam board serve --port 8080 | Web dashboard |
Cost Tracking
| Command | Description |
|---|
| INLINECODE41 | Report usage |
| INLINECODE42 |
Show summary |
|
clawteam cost budget <team> <dollars> | Set budget |
Templates
| Command | Description |
|---|
| INLINECODE44 | List available templates |
| INLINECODE45 |
Show template details |
|
clawteam launch <template> [--team-name <name>] [--goal "<goal>"] | Launch from template |
Built-in templates: hedge-fund, code-review, INLINECODE49
Configuration
CODEBLOCK5
Do not enable permission-skipping settings in shared or production environments. Keep permission prompts enabled for auditability.
Credentials & Channel Integration
This skill itself does not directly read or manage Feishu/Telegram tokens. Channel credentials are managed by the OpenClaw channel plugins/runtime.
- - Feishu interactive approvals require a configured Feishu channel account in OpenClaw.
- Telegram interactive approvals require a configured Telegram bot/channel account in OpenClaw.
- Never paste bot tokens, app secrets, or webhook secrets into team tasks, git worktrees, or chat messages.
Other Commands
| Command | Description |
|---|
| INLINECODE50 | Report agent idle |
| INLINECODE51 |
Save session for resume |
|
clawteam plan submit <team> "<plan>" --from <agent> | Submit plan for approval (team-scoped storage) |
|
clawteam workspace list <team> | List git worktrees |
|
clawteam workspace merge <team> --agent <name> | Merge agent branch |
JSON Output
Add --json before any subcommand for machine-readable output:
CODEBLOCK6
Typical Workflow
- 1. User says: "Create a team to build a web app"
- You do: INLINECODE56
- Create tasks: Use
clawteam task create with --blocked-by for dependencies - Spawn agents: Use
clawteam spawn for each worker - Monitor: Use bounded polling with timeout/attempt limits
- Communicate: Use
clawteam inbox broadcast for team-wide updates - Deliver: Share progress and ask for confirmation before destructive actions
- Cleanup: After confirmation, run
clawteam cost show, clawteam task stats, merge worktrees, then INLINECODE63
Leader Orchestration Pattern
When YOU are the leader agent, follow this pattern to safely manage a swarm with user oversight:
Phase 1: Analyze & Plan
CODEBLOCK7
Phase 2: Setup
CODEBLOCK8
Phase 3: Spawn Workers
CODEBLOCK9
Phase 4: Monitor Loop
Use a bounded monitor loop (for example, max 40 iterations with 30s interval = 20 minutes), then stop and report status.
- 1. Push mid-progress updates — when ~50% of tasks complete, send the user a brief status update (e.g. "4/7 agents done, 3 still working").
- Deliver final results when all tasks complete.
- Escalate to user if timeout is reached, instead of running indefinitely.
CODEBLOCK10
Phase 5: Converge & Report
Before merge/cleanup, ask for user confirmation. Include the final output, a summary, and cost/timing stats.
CODEBLOCK11
Decision Rules for the Leader
- - Independent tasks → spawn workers in parallel
- Sequential tasks → use
--blocked-by to chain them; ClawTeam auto-unblocks - Worker asks for help → check inbox, provide guidance via INLINECODE65
- Worker stuck → check task status; if
in_progress too long, send a nudge via INLINECODE67 - Worker done → verify result via inbox message, then move to next phase
- All done → confirm with user, then merge worktrees and cleanup
- Always → prefer bounded monitoring and explicit user checkpoints for long-running actions
Safety Guardrails
- - Never bypass security, trust, or permission prompts.
- Never run infinite unattended loops; use bounded retries/timeouts.
- Ask for user confirmation before destructive actions (force cleanup, branch merge, mass task updates).
- If a command requests elevated privileges or modifies sensitive paths, pause and ask first.
- Keep an audit trail by reporting what was executed and why.
- Treat these as high-impact operations and confirm intent before running:
spawn subprocess, workspace merge, team cleanup --force, board serve.
Remote Approval Cards
Render approval UI based on the current message source (channel-aware behavior):
- -
feishu source: always use Feishu interactive card (schema: "2.0") with approval_decision button callback. - INLINECODE75 source: use inline keyboard buttons (
Approve / Reject) with callback payload carrying approval_id and decision. - Other sources (cli/web/unknown): use a text approval prompt and require explicit reply
approve or reject. - Required fields for all channels:
-
approval_id (unique, one-time)
-
action (what will be executed)
-
risk_level (low/medium/high)
-
scope (files/commands/resources affected)
-
deadline (approval timeout)
Feishu template (same-row buttons, recommended):
CODEBLOCK12
Source detection hint:
- - Prefer runtime channel metadata (for example,
channel=feishu or channel=telegram). - If unavailable, infer from session key patterns:
-
agent:*:feishu:* -> Feishu mode
-
agent:*:telegram:* -> Telegram mode
Data Location
All state stored in ~/.clawteam/:
- - Teams: INLINECODE92
- Tasks:
~/.clawteam/tasks/<team>/task-<id>.json (with fcntl file locking for concurrent safety) - Plans:
~/.clawteam/plans/<team>/<agent>-<plan_id>.md (team-scoped, isolated per team) - Messages: INLINECODE96
- Costs: INLINECODE97
ClawTeam — 多智能体集群协调
概述
ClawTeam 是一个 CLI 工具(clawteam),用于将多个 AI 智能体编排为自组织集群。它使用 git worktree 隔离、tmux 窗口和基于文件系统的消息传递。OpenClaw 是默认的智能体后端。
来源:https://github.com/win4r/ClawTeam-OpenClaw
优化说明
本技能基于上游 ClawTeam 项目,并针对实际运行增加了额外的安全/审批优化:
- 飞书使用带有同行批准/拒绝按钮的交互式审批卡片。
- Telegram 使用内联键盘审批按钮。
- 其他通道回退到显式文本审批(approve / reject)。
- 无权限绕过指导。
- 无无限无人值守监控循环。
- 破坏性操作需要显式审批检查点。
这些更改是有意的增强,而非逐字复制。
CLI 二进制文件:clawteam(必须预先安装并位于 PATH 中)
安装与验证
本技能仅提供指令。它不会自动安装 clawteam。
请从可信来源安装,并尽可能固定版本/标签。
bash
仅示例:安装前验证上游版本/标签
pipx install git+https://github.com/win4r/ClawTeam-OpenClaw.git@
验证二进制文件和版本
which clawteam
clawteam --version
首次实际运行前的推荐预检:
bash
先使用一次性仓库/worktree
clawteam config health
clawteam team spawn-team dry-run -d 安全检查 -n leader
clawteam team cleanup dry-run --force
快速开始
一键模板启动(推荐)
bash
从模板启动预构建团队
clawteam launch hedge-fund --team fund1
clawteam launch code-review --team review1
clawteam launch research-paper --team paper1
手动团队设置
bash
1. 创建团队并指定负责人
clawteam team spawn-team my-team -d 构建一个Web应用 -n leader
2. 创建具有依赖关系的任务
clawteam task create my-team 设计API架构 -o architect
返回任务ID,例如 abc123
clawteam task create my-team 实现认证 -o backend --blocked-by abc123
clawteam task create my-team 构建前端 -o frontend --blocked-by abc123
clawteam task create my-team 编写测试 -o tester
3. 生成智能体(每个智能体获得独立的tmux窗口 + git worktree)
clawteam spawn -t my-team -n architect --task 为Web应用设计API架构
clawteam spawn -t my-team -n backend --task 实现OAuth2认证
clawteam spawn -t my-team -n frontend --task 构建React仪表板
4. 监控
clawteam board show my-team # 看板视图
clawteam board attach my-team # Tmux平铺视图(所有智能体并排显示)
clawteam board serve --port 8080 # Web仪表板
命令参考
团队管理
| 命令 | 描述 |
|---|
| clawteam team spawn-team <name> -d <desc> -n <leader> | 创建团队 |
| clawteam team discover |
列出所有团队 |
| clawteam team status | 显示团队成员和信息 |
| clawteam team cleanup --force | 删除团队及所有数据 |
任务管理
| 命令 | 描述 |
|---|
| clawteam task create <team> <subject> -o <owner> [-d <desc>] [--blocked-by <id>] | 创建任务 |
| clawteam task list <team> [--owner <name>] |
列出任务(可过滤) |
| clawteam task update --status | 更新状态 |
| clawteam task get | 获取单个任务 |
| clawteam task stats | 时间统计 |
| clawteam task wait | 阻塞直到所有任务完成 |
任务状态:pending(待处理)、in_progress(进行中)、completed(已完成)、blocked(阻塞)
依赖自动解析:当阻塞任务完成时,依赖任务自动从 blocked 变为 pending。
任务锁定:当任务变为 in_progress 时,它会被调用的智能体锁定。其他智能体除非使用 --force,否则无法认领。来自已死亡智能体的过期锁定会自动释放。
智能体生成
除非用户明确请求其他后端,否则使用默认命令(openclaw)。保持正常的权限和信任提示启用。
bash
默认(推荐):在tmux中生成openclaw tui并带有提示
clawteam spawn -t -n --task <任务描述>
显式后端(默认仍使用openclaw)
clawteam spawn tmux -t -n --task
clawteam spawn subprocess -t -n --task
使用git worktree隔离
clawteam spawn -t -n --task --workspace --repo /path/to/repo
重要提示:spawn subprocess 和自定义后端模式可以通过委托命令执行任意代码。仅在受信任的仓库/环境中使用。
每个生成的智能体获得:
- - 自己的tmux窗口(可通过 board attach 查看)
- 自己的git worktree分支(clawteam/{team}/{agent})
- 自动注入的协调提示(如何使用clawteam CLI)
- 环境变量:CLAWTEAMAGENTNAME、CLAWTEAMTEAMNAME 等
生成安全特性:
- - 命令在启动前经过预验证——如果智能体CLI未安装,会给出清晰的错误信息
- 如果生成失败,已注册的团队成员和worktree会自动回滚
- 工作区信任和权限提示必须由用户或操作员审核确认
消息传递
| 命令 | 描述 |
|---|
| clawteam inbox send <team> <to> <msg> --from <sender> | 点对点消息 |
| clawteam inbox broadcast <team> <msg> --from <sender> |
广播给所有人 |
| clawteam inbox peek -a | 预览而不消费 |
| clawteam inbox receive | 消费消息 |
| clawteam inbox log | 查看消息历史 |
监控
| 命令 | 描述 |
|---|
| clawteam board show <team> | 看板(丰富终端) |
| clawteam board overview |
所有团队概览 |
| clawteam board live | 实时刷新看板 |
| clawteam board attach | Tmux平铺视图 |
| clawteam board serve --port 8080 | Web仪表板 |
成本追踪
| 命令 | 描述 |
|---|
| clawteam cost report <team> --input-tokens <N> --output-tokens <N> --cost-cents <N> | 报告使用量 |
| clawteam cost show <team> |
显示摘要 |
| clawteam cost budget | 设置预算 |
模板
| 命令 | 描述 |
|---|
| clawteam template list | 列出可用模板 |
| clawteam template show <name> |
显示模板详情 |
| clawteam launch [--team-name ] [--goal ] | 从模板启动 |
内置模板:hedge-fund(对冲基金)、code-review(代码审查)、research-paper(研究论文)
配置
bash
clawteam config show # 显示所有设置
clawteam config set transport file # 设置传输后端
clawteam config health # 系统健康检查
不要在共享或生产环境中启用权限跳过设置。保持权限提示启用以确保可审计性。
凭据与通道集成
本技能本身不直接读取或管理飞书/Telegram令牌。通道凭据由OpenClaw通道插件/运行时管理。
- - 飞书交互式审批需要在OpenClaw中配置飞书通道账户。