claude-code-swarm-plugin
v0.63.3
Published
Multi-agent swarm coordination plugin for Claude Code
Downloads
47
Readme
Claude Code Swarm Plugin
Multi-agent coordination for Claude Code. Enables parallel task decomposition, worker spawning, and agent-to-agent communication.
Installation
1. Install the swarm CLI (required)
The plugin delegates to the swarm CLI for all operations:
bun add -g opencode-swarm-plugin
# or
npm install -g opencode-swarm-pluginVerify installation:
swarm --version2. Install the plugin from marketplace
# Add the swarm-tools marketplace
claude /plugin add-marketplace https://github.com/joelhooks/opencode-swarm-plugin
# Install the swarm plugin
claude /plugin install swarm@swarm-tools3. Restart Claude Code
The plugin's MCP server will start automatically.
Usage
Slash Commands
| Command | Description |
|---------|-------------|
| /swarm <task> | Decompose task into parallel subtasks and spawn workers |
| /hive | Query and manage tasks (cells) in the hive tracker |
| /inbox | Check swarm mail inbox for messages from other agents |
| /status | Check swarm coordination status |
| /handoff | End session with proper cleanup and handoff notes |
Example: Running a Swarm
/swarm refactor the auth module to use JWT tokensThis will:
- Analyze the task and decompose into parallelizable subtasks
- Create an epic with child tasks in the hive tracker
- Spawn worker agents for each subtask
- Coordinate file reservations to prevent conflicts
- Review worker output before completion
Tools
The plugin exposes 25 tools via MCP:
Hive (Task Management)
hive_cells- Query cells with filtershive_create- Create a new cellhive_create_epic- Create epic with subtaskshive_close- Close a cell with reasonhive_query- Query with advanced filtershive_ready- Get next unblocked cellhive_update- Update cell status/description
Hivemind (Memory)
hivemind_find- Semantic search across memorieshivemind_store- Store a memory with embeddinghivemind_get- Retrieve memory by IDhivemind_stats- Memory system statistics
Swarmmail (Agent Coordination)
swarmmail_init- Initialize agent sessionswarmmail_inbox- Check inbox for messagesswarmmail_send- Send message to other agentsswarmmail_reserve- Reserve files for editingswarmmail_release- Release file reservations
Swarm (Orchestration)
swarm_decompose- Generate decomposition promptswarm_status- Get swarm status by epic IDswarm_plan_prompt- Strategy-specific planningswarm_validate_decomposition- Validate decompositionswarm_spawn_subtask- Prepare subtask for spawningswarm_review- Generate review promptswarm_review_feedback- Send review feedbackswarm_progress- Report progressswarm_complete- Mark subtask complete
Claude Code 2.1.32 Integration
Claude Code has native multi-agent capabilities as of version 2.1.32. This plugin complements those capabilities rather than replacing them.
Architecture: Two Coordination Paths
┌──────────────────────────────────┐
│ Claude Code 2.1.32 │
└──────────────────────────────────┘
│
┌─────────────┴─────────────┐
│ │
┌───────────▼─────────────┐ ┌─────────▼────────────────┐
│ Native Agent Teams │ │ Swarm Plugin Tools │
│ (Teammate tool) │ │ (MCP) │
├─────────────────────────┤ ├──────────────────────────┤
│ • Team spawning │ │ • Hive (git-backed) │
│ • Task assignment │ │ • Hivemind (memory) │
│ • Real-time messaging │ │ • Swarmmail (events) │
│ • UI task list │ │ • Decomposition logic │
│ • Planning mode │ │ • Review workflow │
│ • Sub-agent config │ │ • File reservations │
└─────────────────────────┘ └──────────────────────────┘
│ │
└───────────┬───────────────┘
│
┌────────▼────────┐
│ Worker Agents │
└─────────────────┘What Native Provides vs Plugin Additions
| Capability | Native (2.1.32+) | Swarm Plugin |
|------------|------------------|--------------|
| Agent Teams | ✅ Teammate tool | ⚠️ Swarmmail (event-based, persistent history) |
| Task UI | ✅ TaskCreate/TaskList | ⚠️ Hive cells (git-backed, survives compaction) |
| Messaging | ✅ Real-time DMs | ⚠️ Swarmmail (persistent, file reservations) |
| Planning | ✅ Planning mode | ⚠️ Decomposition strategies (file/feature/risk) |
| Sub-agents | ✅ Agent config | ⚠️ Worker/coordinator specialization |
| Memory | ❌ | ✅ Hivemind semantic memory + embeddings |
| Git Persistence | ❌ | ✅ Hive syncs to .hive/ directory |
| File Coordination | ❌ | ✅ Swarmmail reservations prevent conflicts |
| Review Workflow | ❌ | ✅ swarm_review + feedback loop |
| Strategy Selection | ❌ | ✅ Auto-selects file/feature/risk strategies |
Hooks
The plugin registers lifecycle hooks:
| Hook | Action |
|------|--------|
| SessionStart | Initialize session context |
| UserPromptSubmit | Track user prompts |
| PreToolUse | Pre-edit validation and pre-complete checks |
| PostToolUse | Track tool usage for hivemind_find, skills_use, swarmmail_init, hivemind_store, swarm_complete |
| PreCompact | Save state before context compaction |
| SessionEnd | Cleanup and sync |
| SubagentStart | Initialize worker agent context |
| SubagentStop | Cleanup worker state |
Skills
always-on-guidance
Rule-oriented guidance for Claude Code agents. Loaded automatically.
swarm-coordination
Multi-agent coordination patterns. Use when spawning workers or coordinating parallel tasks.
Agents
| Agent | Type | Purpose |
|-------|------|---------|
| coordinator | Foreground | Orchestrates swarm decomposition and worker spawning |
| worker | Foreground | Executes subtasks with file reservations |
| background-worker | Background | Handles tasks without MCP tool access |
Architecture
┌─────────────────────────────────────────────────────────┐
│ Claude Code │
├─────────────────────────────────────────────────────────┤
│ Plugin (this package) │
│ ├── MCP Server (bin/mcp-server.js) │
│ │ └── Shells out to: swarm tool <name> --json │
│ ├── Commands (/swarm, /hive, /inbox, etc.) │
│ ├── Skills (always-on-guidance, swarm-coordination) │
│ ├── Agents (coordinator, worker) │
│ └── Hooks (SessionStart, PreCompact, etc.) │
├─────────────────────────────────────────────────────────┤
│ swarm CLI (globally installed) │
│ ├── Hive tracker (.hive/ directory) │
│ ├── Hivemind semantic memory (LibSQL + Ollama) │
│ └── Swarmmail coordination (embedded event store) │
└─────────────────────────────────────────────────────────┘Why This Architecture?
The main OpenCode swarm plugin bundles native dependencies (@libsql/client) which causes issues when Claude Code copies plugins to its cache. This plugin avoids bundling by delegating all tool execution to the globally installed swarm CLI.
Benefits:
- No native dependency issues
- Single source of truth (the CLI)
- Automatic updates when CLI is updated
- Tiny plugin size (~600KB bundled)
Development
# Install dependencies
bun install
# Build the MCP server bundle
bun run build
# Type check
bun run typecheckLicense
MIT
