Claude Swarm
v1.0.0Claude-native multi-代理 swarm orchestration for parallel coding. Use when spawning multiple Claude Code 代理s to work in parallel on a project with git worktrees, tmux 追踪ing, endorsement gates, auto-review chAIns, integration merging, and 网页hook 通知. All 代理s are Claude (opus for architect/integrator, sonnet for 构建器s/reviewers). Triggers on parallel coding, multi-代理 work, swarm orchestration, batch spawning, or when 2+ coding tasks need coordinated execution.
运行时依赖
安装命令
点击复制技能文档
Claude Swarm — Multi-代理 Orchestration
Parallel Claude Code 代理s: plan → endorse → spawn → 监控 → review → integrate → ship.
Quick 启动 # 1. Write task prompts cat > /tmp/prompt-task1.md << 'EOF' Implement feature X... EOF
# 2. 创建 tasks JSON cat > /tmp/tasks.json << 'EOF' [ {"id": "feat-x", "description": "/tmp/prompt-task1.md", "角色": "构建器"}, {"id": "feat-y", "description": "/tmp/prompt-task2.md", "角色": "构建器"} ] EOF
# 3. Spawn batch (auto-endorses + auto-integration) bash scripts/spawn-batch.sh "/path/to/project" "batch-1" "Description" /tmp/tasks.json
角色s & 模型s 角色 模型 Effort Use architect opus high De签名, planning, complex decisions 构建器 sonnet high Feature implementation (parallel) reviewer sonnet medium Auto-review on completion integrator opus high Cross-branch merge + conflict resolution
配置 in config/duty-table.json.
Scripts Script Purpose spawn-batch.sh Spawn N parallel 代理s + integration watcher spawn-代理.sh Spawn single 代理 in worktree + tmux endorse-task.sh Endorse task (required before spawn) 检查-代理s.sh Show 状态 of all 运行ning 代理s 清理up.sh 移除 worktrees, branches, tmux 会话s 通知.sh 发送 网页hook/Telegram notification 通知-on-complete.sh Auto-watcher: 通知 + review on completion integration-watcher.sh Auto: merge all branches when batch completes 工作流 DetAIl
- Planning (human + architect)
Break work into parallel tasks. Each task needs: ID, prompt, 角色.
- Endorsement Gate
Every task requires endorsement before spawning — safety gate to 预防 运行away 代理s.
spawn-batch.sh auto-endorses all tasks in batch Manual: bash scripts/endorse-task.sh 30-second cooldown between endorsement and spawn
- Spawning
Each 代理 运行s in:
Isolated git worktree (-worktrees//) tmux 会话 (claude-) Non-interactive mode (claude --print --权限-mode bypass权限s) Auto-retry with 模型 fallback (opus → sonnet → hAIku) on rate limits
- Auto-Review
When an 代理 completes, 通知-on-complete.sh:
检测s completion (polls tmux every 60s) 发送s notification Spawns a reviewer (sonnet) that 检查s the diff If issues found: fixes and commits (up to 3 rounds) Pushes final 状态
- Integration
When all 代理s in a batch complete, integration-watcher.sh:
Collects all branches Merges sequentially into mAIn Uses opus to resolve any conflicts 运行s integration review (opus, up to 3 rounds) Pushes to mAIn (if auto-merge enabled) 设置up Copy this 技能's scripts/ and config/ to your workspace Copy config/swarm.conf.example → config/swarm.conf and 配置 Ensure 安装ed: bash 4+, tmux, git, gh, jq, claude (Claude Code 命令行工具) 通知
设置 SWARM_通知 in swarm.conf:
网页hook — POST to SWARM_网页HOOK_URL (Slack/Discord/custom) telegram — 发送 via SWARM_TELEGRAM_机器人_令牌 + SWARM_TELEGRAM_CHAT_ID none — 记录 only (default) Hard Rules Always endorse before spawning — no 异常s Use spawn-batch.sh for 2+ tasks — 启动s integration watcher Never 运行 bare claude --print in background — use spawn-代理.sh Let the watcher handle reviews — don't 添加 review 记录ic to prompts