Get the FREE Ultimate OpenClaw Setup Guide →

orchestrating

npx machina-cli add skill zircote/claude-team-orchestration/orchestrating --openclaw
Files (1)
SKILL.md
5.5 KB

Claude Code Swarm Orchestration

Master multi-agent orchestration using Claude Code's agent teams and task system.

Experimental: Agent teams are disabled by default. Enable with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS in your settings.json or environment.


Primitives

PrimitiveWhat It IsFile Location
AgentA Claude instance that can use tools. You are an agent. Subagents are agents you spawn.N/A (process)
TeamA named group of agents working together. One leader, multiple teammates.~/.claude/teams/{name}/config.json
TeammateAn agent that joined a team. Has a name, color, inbox. Spawned via Task with team_name + name.Listed in team config
LeaderThe agent that created the team. Receives teammate messages, approves plans/shutdowns.First member in config
TaskA work item with subject, description, status, owner, and dependencies.~/.claude/tasks/{team}/N.json
InboxJSON file where an agent receives messages from teammates.~/.claude/teams/{name}/inboxes/{agent}.json
MessageA JSON object sent between agents. Can be text or structured (shutdown_request, idle_notification, etc).Stored in inbox files
BackendHow teammates run. Auto-detected: in-process (same Node.js, invisible), tmux (separate panes, visible), iterm2 (split panes in iTerm2). See Spawn Backends.Auto-detected based on environment

How They Connect

flowchart TB
    subgraph TEAM[TEAM]
        Leader[Leader - you]
        T1[Teammate 1]
        T2[Teammate 2]

        Leader <-->|messages via inbox| T1
        Leader <-->|messages via inbox| T2
        T1 <-.->|can message| T2
    end

    subgraph TASKS[TASK LIST]
        Task1["#1 completed: Research<br/>owner: teammate1"]
        Task2["#2 in_progress: Implement<br/>owner: teammate2"]
        Task3["#3 pending: Test<br/>blocked by #2"]
    end

    T1 --> Task1
    T2 --> Task2
    Task2 -.->|unblocks| Task3

Lifecycle

flowchart LR
    A[1. Create Team] --> B[2. Create Tasks]
    B --> C[3. Spawn Teammates]
    C --> D[4. Work]
    D --> E[5. Coordinate]
    E --> F[6. Shutdown]
    F --> G[7. Cleanup]

Message Flow

sequenceDiagram
    participant L as Leader
    participant T1 as Teammate 1
    participant T2 as Teammate 2
    participant Tasks as Task List

    L->>Tasks: TaskCreate (3 tasks)
    L->>T1: spawn with prompt
    L->>T2: spawn with prompt

    T1->>Tasks: claim task #1
    T2->>Tasks: claim task #2

    T1->>Tasks: complete #1
    T1->>L: SendMessage (findings)

    Note over Tasks: #3 auto-unblocks

    T2->>Tasks: complete #2
    T2->>L: SendMessage (findings)

    L->>T1: SendMessage (shutdown_request)
    T1->>L: SendMessage (shutdown_response, approve)
    L->>T2: SendMessage (shutdown_request)
    T2->>L: SendMessage (shutdown_response, approve)

    L->>L: TeamDelete

Sub-Skills Index

SkillWhat It Covers
Team ManagementCreate teams, spawn teammates, delegate mode, permissions, shutdown, cleanup
Task SystemTaskCreate, TaskList, TaskGet, TaskUpdate, dependencies, file locking
Agent TypesBuilt-in agents (Bash, Explore, Plan, general-purpose), plugin agents, selection guide
MessagingSendMessage (all types), message formats, automatic delivery, direct interaction
Orchestration Patterns7 patterns (parallel, pipeline, swarm, research, plan approval, refactoring, RLM)
RLM PatternContent-aware chunked analysis of large files and directories using RLM pattern
Spawn Backendsin-process, tmux, iTerm2, teammateMode setting, auto-detection
Error HandlingCommon errors, hooks (TeammateIdle, TaskCompleted), limitations, debugging

Quick Reference

Create Team and Spawn Teammate

TeamCreate({ team_name: "my-team", description: "Working on feature X" })
Task({ team_name: "my-team", name: "worker", subagent_type: "general-purpose", prompt: "...", run_in_background: true })

Spawn Subagent (No Team)

Task({ subagent_type: "Explore", description: "Find files", prompt: "..." })

Message Teammate

SendMessage({ type: "message", recipient: "worker-1", content: "...", summary: "Brief update" })

Create Task Pipeline

TaskCreate({ subject: "Step 1", description: "...", activeForm: "Working on step 1..." })
TaskCreate({ subject: "Step 2", description: "...", activeForm: "Working on step 2..." })
TaskUpdate({ taskId: "2", addBlockedBy: ["1"] })

Shutdown Team

SendMessage({ type: "shutdown_request", recipient: "worker-1", content: "All done" })
// Wait for approval...
TeamDelete()

Based on Claude Code agent teams documentation - Updated 2026-02-07

Source

git clone https://github.com/zircote/claude-team-orchestration/blob/main/skills/orchestrating/SKILL.mdView on GitHub

Overview

Claude Code Swarm Orchestration enables coordinating multiple agents using teams, a leader, teammates, and a task system. It supports parallel code reviews, pipeline workflows with dependencies, and self-organizing task queues, routing to sub-skills for team management, tasks, messaging, patterns, backends, and error handling.

How This Skill Works

You define a Team with a Leader and Teammates; tasks live as JSON items in a local task list. Teammates claim and work on tasks via the inbox messages, while the Leader coordinates plans and shutdowns. Backends are auto-detected (in-process, tmux, iterm2) to run code, and messages flow through structured Message objects stored in inbox files.

When to Use It

  • Coordinating multiple agents to tackle a shared, partitioned objective
  • Running parallel code reviews across teammates for faster validation
  • Creating pipeline workflows with explicit task dependencies
  • Building self-organizing task queues that adapt to workload
  • Applying divide-and-conquer patterns for complex projects

Quick Start

  1. Step 1: Enable experimental agent teams by setting CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to true in your settings.json or environment
  2. Step 2: Create a Team and define Leader and Teammates in ~/.claude/teams/{name}/config.json, then prepare a Task list
  3. Step 3: Create Tasks, spawn Teammates with team_name and name, and start work by exchanging messages through inbox files

Best Practices

  • Define a clear Leader and assign explicit roles for Teammates
  • Make Task IDs and dependencies explicit to prevent bottlenecks
  • Use inbox-based messaging for reliable inter-agent communication
  • Prefer explicit backends and monitor resource usage across agents
  • Plan for shutdowns and cleanup to avoid orphaned tasks

Example Use Cases

  • Feature code-review swarm where multiple teammates concurrently review different modules
  • CI-like pipeline with tasks for build, test, and deploy that depend on each other
  • Data-processing job split into parallel tasks with dependencies and unblocking logic
  • Incident response workflow where tasks are queued and reassigned based on progress
  • Experimentation cycle with auto-unblocking of dependent tasks as results arrive

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers