Execute SWARM (Specialized Workflow with Autonomous Resource Management) development workflow for coordinated multi-agent implementation
Executes the SWARM coordinated multi-agent development workflow for implementing tickets. Use for complex tasks requiring orchestrated planning, parallel execution with git worktrees, code review, and automated PR creation.
/plugin marketplace add nitromike502/meckert-claude-code-marketplace/plugin install nitromike502-dev-toolkit-plugins-dev-toolkit@nitromike502/meckert-claude-code-marketplace[ticket(s)] [instructions] - One or more ticket IDs (space/comma separated) and/or custom instructionsDocumentation Discovery: Before starting SWARM workflow, reference these guides:
Check project docs first:
docs/guides/SWARM-WORKFLOW.mddocs/guides/PARALLEL-EXECUTION-GUIDE.mddocs/guides/GIT-WORKFLOW.mddocs/guides/GIT-WORKTREES-GUIDE.mddocs/guides/TESTING-GUIDE.mdFall back to plugin guides:
${CLAUDE_PLUGIN_ROOT}/guides/SWARM-WORKFLOW.md${CLAUDE_PLUGIN_ROOT}/guides/PARALLEL-EXECUTION-GUIDE.md${CLAUDE_PLUGIN_ROOT}/guides/GIT-WORKFLOW.md${CLAUDE_PLUGIN_ROOT}/guides/GIT-WORKTREES-GUIDE.md${CLAUDE_PLUGIN_ROOT}/guides/TESTING-GUIDE.mdCRITICAL ARCHITECTURE PRINCIPLE: Only the main agent invokes subagents. The orchestrator creates plans but does NOT invoke other subagents. </context>
<execution> **User Arguments:** `$ARGUMENTS`This command implements the complete SWARM workflow across 9 phases:
Arguments provided: $ARGUMENTS
Ticket ID Pattern: EPIC-*, STORY-*, TASK-*, BUG-* (case-insensitive)
If $ARGUMENTS is empty:
If $ARGUMENTS contains ticket ID(s):
Determine execution mode:
len(tickets) == 1len(tickets) > 1 → Requires dependency analysis and git worktrees/swarm TASK-3.1.1 → Single-ticket mode
/swarm TASK-3.1.1 TASK-3.1.2 → Multi-ticket mode (2 tickets)
/swarm TASK-3.1.1, TASK-3.1.2, TASK-3.1.3 → Multi-ticket mode (3 tickets)
/swarm STORY-4.2 Focus on API first → Single-ticket with instructions
/swarm → Auto-select mode
When multiple tickets are provided, use git worktrees for true parallel execution.
Main agent invokes dev-toolkit:subagent-orchestrator with ALL tickets for dependency analysis:
Analyze dependencies between tickets:
- TASK-3.1.1
- TASK-3.1.2
- TASK-3.1.3
Determine:
1. Which tickets can execute in parallel (no shared files/dependencies)
2. Which tickets must be sequential (dependencies exist)
3. Recommended execution order
Orchestrator evaluates:
Orchestrator returns dependency graph:
Independent (can parallelize):
- TASK-3.1.1 (creates user-service.js)
- TASK-3.1.2 (creates auth-middleware.js)
Sequential (has dependencies):
- TASK-3.1.3 depends on TASK-3.1.1 (modifies user-service.js)
Execution Plan:
Parallel Group 1: [TASK-3.1.1, TASK-3.1.2]
Sequential after 3.1.1: [TASK-3.1.3]
Main agent presents to user:
User approves or modifies plan.
Main agent invokes dev-toolkit:git-expert to set up worktrees:
# Ensure main is up to date
git checkout main
git pull origin main
# Create worktree directory
mkdir -p ../project-worktrees
# Create worktree for each parallel ticket
git worktree add ../project-worktrees/TASK-3.1.1 -b feature/TASK-3.1.1
git worktree add ../project-worktrees/TASK-3.1.2 -b feature/TASK-3.1.2
Worktree structure:
project/ # Main working directory
project-worktrees/ # Worktree container
├── TASK-3.1.1/ # Independent worktree
└── TASK-3.1.2/ # Independent worktree
For each parallel group, main agent launches agents in parallel:
Agent-1 (working in ../project-worktrees/TASK-3.1.1):
├── Implement TASK-3.1.1
├── Run tests in worktree
├── Commit to feature/TASK-3.1.1
└── Report completion
Agent-2 (working in ../project-worktrees/TASK-3.1.2): [PARALLEL]
├── Implement TASK-3.1.2
├── Run tests in worktree
├── Commit to feature/TASK-3.1.2
└── Report completion
Each agent must:
After parallel group completes:
# Merge TASK-3.1.1 to main
git checkout main
git merge --no-ff feature/TASK-3.1.1
# Now TASK-3.1.3 can proceed (depends on 3.1.1)
git worktree add ../project-worktrees/TASK-3.1.3 -b feature/TASK-3.1.3
Option A: Single Combined PR (Simple)
Option B: Individual PRs (Granular)
Present options to user for decision.
After all tickets complete and merge:
# Remove worktrees
git worktree remove ../project-worktrees/TASK-3.1.1
git worktree remove ../project-worktrees/TASK-3.1.2
# Delete merged branches
git branch -d feature/TASK-3.1.1
git branch -d feature/TASK-3.1.2
# Clean up remote branches
git push origin --delete feature/TASK-3.1.1
git push origin --delete feature/TASK-3.1.2
# Prune stale references
git worktree prune
When a single ticket is provided, use the standard SWARM workflow.
Main agent invokes dev-toolkit:subagent-orchestrator with ticket context:
If ticket ID provided:
If NO ticket ID provided:
dev-toolkit:implementation-manager to analyze and recommend ticketsOrchestrator Deliverable:
TRUST SUBAGENT OUTPUT: Present the orchestrator's plan directly to the user without additional research. Subagents run in isolated contexts specifically to do analysis work - duplicating that work wastes main agent context.
Main agent presents orchestrator's plan to user:
Request user approval or refinements.
User provides feedback:
Main agent invokes dev-toolkit:git-expert:
feature/[ticket-id]-descriptionCRITICAL: Main agent creates this, NOT documenter
Location: docs/sessions/tracking/SESSION-[TICKET-ID]-[YYYY-MM-DD].md
Content:
Purpose: This document must be detailed enough for a fresh session to resume work at any point.
Main agent uses TodoWrite tool:
Main agent coordinates execution based on orchestrator recommendations.
For each task:
Main agent invokes appropriate developer agent
Developer implements task
Developer reports completion
Main agent updates tracking document and TodoWrite
Main agent invokes test-runner
Tests pass → Main agent invokes git-expert
Repeat for next task
Main agent launches multiple developer agents simultaneously:
Main agent invokes multiple agents in parallel
Each agent works independently
Main agent monitors completion
Main agent invokes test-runner
All tests pass → Main agent invokes git-expert
type: description (TASK-X, TASK-Y)Integrated into Phase 3 - commits happen after each task/batch completion.
Only if documentation updates needed.
Main agent invokes dev-toolkit:documenter:
Commit documentation changes separately:
docs: description (TICKET-ID)Create pull request BEFORE code review:
Code reviewer reviews the PR directly:
gh pr diff to see changesgh apiReview outcomes:
User can view all review comments directly on the PR.
Only if code review resulted in changes OR documentation updates needed.
Main agent invokes /docs with implementation context:
/dev-toolkit:docs "Update documentation for [feature].
Implementation details:
- Added [component/service] with [functionality]
- Modified [existing component] to support [new behavior]
- API changes: [list any API changes]
Review recent commits for specific changes."
documenter agent will:
Main agent invokes git-expert:
docs: update documentation for [ticket-id]Present:
Request user decision:
Main agent moves session tracking doc to archive:
docs/sessions/tracking/SESSION-*.md to .deleted/docs/sessions/tracking/git mv to preserve historyMain agent invokes git-expert to merge PR:
Update ticket status to done.
Show:
Mandatory Practices:
done without user reviewCRITICAL: As the main agent in SWARM workflow, you are a COORDINATOR, not an implementer. Your role is to invoke subagents and track progress - NEVER to perform implementation work directly.
| Action | Use This Subagent Instead |
|---|---|
| Edit code files (Edit tool on src/, tests/) | dev-toolkit:frontend-developer or dev-toolkit:backend-developer |
| Run tests (Bash npm test, npx jest, etc.) | dev-toolkit:test-runner |
| Execute git commands (git add, commit, push, etc.) | dev-toolkit:git-expert |
| Query/update tickets in database | dev-toolkit:ticket-manager |
| Update documentation files | dev-toolkit:documenter |
Even if a task appears trivial (one-line fix, simple file move, single git command), you MUST delegate to the appropriate specialist. Specialists handle:
Wrong thinking: "This is just one line → I'll do it directly" Correct thinking: "This is code modification → frontend-developer owns code quality"
Before using Edit, Bash, or Write tools, ask yourself:
Context efficiency: Delegation actually SAVES context because subagents work in isolated contexts. Direct implementation consumes MORE main agent context through file reads, debugging, and multiple attempts.
Quality assurance: Specialists know domain-specific rules. Example: git-expert knows the branching strategy and will create bug fixes from main, not from feature branches.
Process integrity: When you bypass specialists, you bypass the quality gates and safety protocols they enforce.
/swarm STORY-3.2
/swarm STORY-3.2 Focus on backend first, then frontend
/swarm
/swarm STORY-3.2
/swarm TASK-3.1.1 TASK-3.1.2
/swarm TASK-3.1.1, TASK-3.1.2, TASK-3.1.3
/swarm TASK-4.1.1 TASK-4.1.2 Prioritize test coverage