Skip to main content

Swarm Mode

Swarm mode spawns parallel agents, each with its own git worktree and SDLC pipeline. It's designed for decomposing large features into independent stories that can be implemented concurrently.

Architecture

+--------------------------------------------------------------------------+
| ORCHESTRATOR |
| 1. Decompose work into stories |
| 2. Create worktree per story |
| 3. Spawn story agent per worktree |
| 4. Monitor progress |
+--------------------------------------------------------------------------+
|
+----------------------+----------------------+
v v v
+-----------------+ +-----------------+ +-----------------+
| Story A Agent | | Story B Agent | | Story C Agent |
| (worktree-a) | | (worktree-b) | | (worktree-c) |
+-----------------+ +-----------------+ +-----------------+
| SDLC Pipeline: | | SDLC Pipeline: | | SDLC Pipeline: |
| [DESIGN] | | [DESIGN] | | [DESIGN] |
| [TEST] | | [TEST] | | [TEST] |
| [DEV] | | [DEV] | | [DEV] |
| [VERIFY] | | [VERIFY] | | [VERIFY] |
| [DOCS] | | [DOCS] | | [DOCS] |
+-----------------+ +-----------------+ +-----------------+

Each story agent works in isolation on its own branch, executing a full software development lifecycle.

Activation

swarm 3                              # 3 story agents (SDLC mode)
swarm stories "Auth" "Payments" # Named stories
swarm 2 --flat # Flat task mode (legacy)

SDLC Pipeline

Each story agent executes these stages in order:

StageSkillPurpose
DESIGN/aide:designTechnical spec, interfaces, acceptance criteria
TEST/aide:testWrite failing tests (TDD)
DEV/aide:implementMake tests pass
VERIFY/aide:verifyFull QA validation
DOCS/aide:docsUpdate documentation

Agents send status messages at each stage transition, making progress visible to the orchestrator and other agents.

Workflow

1. Plan (Optional)

Use the plan-swarm skill to decompose work through a Socratic interview:

plan the dashboard feature

This produces validated, independent stories with clear boundaries.

2. Decompose

The orchestrator breaks work into independent stories. Each story should be:

  • Self-contained — Can be implemented without depending on other stories
  • Testable — Has clear acceptance criteria
  • Bounded — Small enough for a single agent to complete

3. Create Worktrees

Each story gets an isolated git worktree:

.aide/worktrees/story-auth/       → branch: feat/story-auth
.aide/worktrees/story-payments/ → branch: feat/story-payments
.aide/worktrees/story-dashboard/ → branch: feat/story-dashboard

4. Execute

Each agent runs its SDLC pipeline independently. Agents can coordinate through:

  • Decisionsaide decision set/get for architectural choices visible to all
  • Memoryaide memory add for discoveries and learnings
  • Messagesaide message send for direct inter-agent communication
  • Tasksaide task create/claim/complete for work tracking

5. Monitor

Track progress through:

aide task list                    # All tasks with status
aide message list --agent=orch # Messages to orchestrator
aide state list # All agent states

6. Merge

When all stories complete, use the worktree-resolve skill to merge:

merge the swarm branches

Or manually:

git worktree list
git merge feat/story-auth
git merge feat/story-payments
git worktree remove .aide/worktrees/story-auth
git worktree remove .aide/worktrees/story-payments

Agent Coordination

Shared State

All agents share the same AIDE data store, enabling real-time coordination:

MechanismUse CaseExample
DecisionsArchitectural choices"Use JWT for auth" — all agents see this
MessagesDirect communication"User model is ready" from agent A to agent B
StateStatus trackingPer-agent mode, stage, progress
TasksWork trackingCreate, claim, complete tasks

Message Protocol

Agents follow a messaging protocol:

TypeWhen
statusStage transitions (DESIGN → TEST → DEV...)
requestAsking another agent for information
responseReplying to a request
blockerReporting something blocking progress
completionSignaling work is done

Tool Enforcement

In swarm mode, agent roles determine tool access:

  • Architect/Explorer/Researcher agents are restricted to read-only tools
  • Executor agents have full tool access
  • This prevents conflicts when multiple agents work on the same codebase

Platform Differences

FeatureClaude CodeOpenCode
Agent spawningNative (subagent hooks)External orchestration
Worktree managementAutomaticAutomatic
SDLC pipelineFullFull
Inter-agent messagingFullFull
Progress monitoringHUD + tasksTasks only