From autonomous-dev
This skill should be used when the user asks to "run tasks in parallel", "create worktrees", "dispatch parallel agents", "orchestrate execution", or when autonomous-dev needs to execute independent tasks simultaneously. Manages git worktrees for isolated parallel development.
How this skill is triggered — by the user, by Claude, or both
Slash command
/autonomous-dev:skills/parallel-orchestratorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Coordinate multiple parallel agents working on independent tasks using git worktrees for isolation.
Coordinate multiple parallel agents working on independent tasks using git worktrees for isolation.
This skill is automatically invoked when:
task-decomposer found >= 3 independent tasksPARALLELIZEparallelization.enabled == true in config (default)Skip conditions:
independent_tasks < 3parallelization.enabled == false in .claude/auto-context.yamlBefore creating worktrees, verify:
# Check parallelization config
if [[ -f ".claude/auto-context.yaml" ]]; then
enabled=$(yq -r '.parallelization.enabled // true' .claude/auto-context.yaml)
min_tasks=$(yq -r '.parallelization.min_tasks // 3' .claude/auto-context.yaml)
max_agents=$(yq -r '.parallelization.max_agents // 5' .claude/auto-context.yaml)
fi
Always output the execution decision:
For PARALLEL execution:
┌─────────────────────────────────────────────────────────────┐
│ ⚡ Execution Mode: PARALLEL │
│ Tasks: 5 independent files detected │
│ Agents: 3 (limited by max_agents config) │
│ │
│ Parallel Group 1: │
│ ├── Agent 1: [worktree-1] globals.css, tailwind.config │
│ ├── Agent 2: [worktree-2] sidebar.tsx │
│ └── Agent 3: [worktree-3] header.tsx │
│ │
│ Parallel Group 2 (after Group 1): │
│ ├── Agent 4: [worktree-4] stat-bar.tsx │
│ └── Agent 5: [worktree-5] onboarding.tsx │
│ │
│ Progress: [░░░░░░░░░░░░░░░░] 0/5 agents complete │
└─────────────────────────────────────────────────────────────┘
For SEQUENTIAL execution:
┌─────────────────────────────────────────────────────────────┐
│ ⏸️ Execution Mode: SEQUENTIAL │
│ Reason: Only 2 files with dependencies │
│ Order: types.ts → component.tsx │
│ │
│ Skipping parallel orchestration (threshold not met) │
└─────────────────────────────────────────────────────────────┘
Instead of creating worktrees one-by-one, use a managed pool for better resource utilization:
┌──────────────────────────────────────────────────────────────┐
│ AGENT POOL COORDINATOR │
│ (scripts/pool-manager.sh) │
├──────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ WORKTREE POOL (Max 8) │ │
│ │ │ │
│ │ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │ │
│ │ │WT-1 │ │WT-2 │ │WT-3 │ │WT-4 │ │WT-5 │ ... │ │
│ │ │BUSY │ │BUSY │ │IDLE │ │BUSY │ │IDLE │ │ │
│ │ └──┬──┘ └──┬──┘ └─────┘ └──┬──┘ └─────┘ │ │
│ │ │ │ │ │ │
│ │ ▼ ▼ ▼ │ │
│ │ [Task A] [Task B] [Task C] │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ MERGE COORDINATOR │ │
│ │ (conflict resolution) │ │
│ └─────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
# Initialize pool (run once at session start)
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh init 8
# Check pool status
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh status
# Acquire worktree for task
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh acquire task-login-form
# Output: wt-1|/path/to/worktree|auto/task-login-form
# Release worktree back to pool
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh release wt-1
# Merge all busy worktrees
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh merge main
# Full cleanup
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh cleanup
Each independent task receives its own git worktree from the pool:
At the start of a parallel session:
# Initialize pool with 8 slots
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh init 8
For each task in a parallel group:
# Acquire from pool (returns: wt_id|path|branch)
result=$(${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh acquire task-{id})
WT_ID=$(echo "$result" | cut -d'|' -f1)
WT_PATH=$(echo "$result" | cut -d'|' -f2)
BRANCH=$(echo "$result" | cut -d'|' -f3)
This:
.claude/worktree-pool/wt-{N}/auto/task-{id}Use the Task tool for each parallel task:
Task(
subagent_type: "general-purpose",
prompt: "Work in worktree at {path}. Task: {description}.
Verification: {commands}.
When done, commit and output: <promise>TASK_DONE: {id}</promise>",
run_in_background: true
)
Update .claude/auto-progress.yaml with task status:
tasks:
task-1:
status: in_progress
branch: auto/task-1
iterations: 1
Monitor agent output files for completion signals.
Failure handling protocol:
Independent verification by QA agent before approving any task.
After task-executor signals READY_FOR_QA (not TASK_DONE):
Dispatch QA agent for independent verification:
Task(
subagent_type: "autonomous-dev:qa-agent",
prompt: "Verify task {id} in branch auto/task-{id}",
run_in_background: true
)
Wait for QA decision:
TASK_APPROVED → Task verified, ready for integrationTASK_REJECTED → Return to task-executor for fixesQA_BLOCKED → Investigate environment issueUpdate progress based on QA result:
tasks:
task-1:
status: qa_approved # or qa_rejected
qa_verified: true
qa_timestamp: "2025-01-18T12:00:00Z"
Only mark task complete after QA approval:
READY_FOR_QATASK_APPROVEDdone┌─────────────────────────────────────────────────────────────┐
│ Task Executor │
│ │ │
│ ├── Implements feature (TDD cycle) │
│ ├── Runs local verification │
│ └── Signals: READY_FOR_QA (not TASK_DONE!) │
│ │
│ Parallel Orchestrator │
│ │ │
│ └── Dispatches QA Agent for independent verification │
│ │
│ QA Agent (fresh environment) │
│ │ │
│ ├── npm ci (fresh install) │
│ ├── Run all verification checks │
│ ├── Test edge cases │
│ └── Decision: TASK_APPROVED or TASK_REJECTED │
│ │
│ Parallel Orchestrator │
│ │ │
│ ├── TASK_APPROVED → Mark done, proceed │
│ └── TASK_REJECTED → Return to task-executor │
└─────────────────────────────────────────────────────────────┘
After all parallel tasks complete:
Switch back to the primary working directory.
Execute merges in dependency order:
${CLAUDE_PLUGIN_ROOT}/scripts/merge-branches.sh
For merge conflicts:
Release worktrees back to pool:
# Release each completed worktree
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh release wt-1
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh release wt-2
# ...
# Or cleanup entire pool after session
${CLAUDE_PLUGIN_ROOT}/scripts/pool-manager.sh cleanup
For legacy single-worktree cleanup:
git worktree remove /tmp/auto-worktrees/task-{id}
git branch -d auto/task-{id}
For detailed worktree management:
references/worktree-management.md - Complete git worktree guide, common issues, best practices| Script | Purpose |
|---|---|
scripts/pool-manager.sh | NEW - Manage agent pool (init/acquire/release/status) |
scripts/setup-worktree.sh | Create isolated worktree (legacy, single use) |
scripts/merge-branches.sh | Merge all auto/* branches |
scripts/state-transition.sh | Manage state machine |
| Command | Description |
|---|---|
pool-manager.sh init [size] | Initialize pool (default: 8 slots) |
pool-manager.sh acquire <task_id> | Get worktree for task |
pool-manager.sh release <wt_id> | Return worktree to pool |
pool-manager.sh status | Show pool status |
pool-manager.sh merge [branch] | Merge all busy worktrees |
pool-manager.sh cleanup | Remove all worktrees |
pool-manager.sh reset [size] | Full pool reset |
pool-manager.sh health | Check pool health |
Update progress display after each agent completion:
┌─────────────────────────────────────────────────────────────┐
│ ⚡ Execution Mode: PARALLEL │
│ Progress: [████████░░░░░░░░] 3/5 agents complete │
│ │
│ ✅ Agent 1: globals.css, tailwind.config (done) │
│ ✅ Agent 2: sidebar.tsx (done) │
│ ✅ Agent 3: header.tsx (done) │
│ ⏳ Agent 4: stat-bar.tsx (in progress) │
│ ⏳ Agent 5: onboarding.tsx (in progress) │
└─────────────────────────────────────────────────────────────┘
After parallel execution completes:
# Transition to INTEGRATE state for merging
${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.sh transition INTEGRATE
In .claude/auto-context.yaml:
parallelization:
enabled: true # Master switch
min_tasks: 3 # Minimum independent tasks to trigger
max_agents: 5 # Maximum concurrent agents
auto_cleanup: true # Remove worktrees after merge
retry_on_failure: 3 # Retry failed agents N times
Anthropic Best Practice: One parallel group per session to avoid context exhaustion
Execute exactly ONE parallel group per session:
┌─────────────────────────────────────────────────────────────┐
│ Session Start │
│ │ │
│ ├── Read checkpoint (if resuming) │
│ │ └── ${CLAUDE_PLUGIN_ROOT}/scripts/checkpoint-manager.sh read
│ │ │
│ ├── Identify next parallel group │
│ │ │
│ ├── Execute ONLY that group │
│ │ ├── Create worktrees for group tasks │
│ │ ├── Dispatch agents (run_in_background: true) │
│ │ ├── Wait for all agents to complete │
│ │ └── Verify all tasks in group │
│ │ │
│ ├── Write checkpoint │
│ │ └── ${CLAUDE_PLUGIN_ROOT}/scripts/checkpoint-manager.sh write GROUP_N "summary"
│ │ │
│ └── End session (or signal for continuation) │
└─────────────────────────────────────────────────────────────┘
Checkpoints are written automatically when:
Each checkpoint captures:
# .claude/auto-memory/parallel-group-N-summary.md
group_number: 2
status: complete
tasks_completed:
- task-3: "Created sidebar component"
- task-4: "Created header component"
branches_created:
- auto/task-3
- auto/task-4
verification_passed: true
next_group: 3
remaining_groups: [3, 4]
Before dispatching parallel agents:
# Write pre-execution checkpoint
${CLAUDE_PLUGIN_ROOT}/scripts/checkpoint-manager.sh write "PRE_GROUP_${GROUP_NUM}" \
"Starting parallel group $GROUP_NUM with tasks: $TASK_LIST"
After all agents complete:
# Write post-execution checkpoint
${CLAUDE_PLUGIN_ROOT}/scripts/checkpoint-manager.sh write "POST_GROUP_${GROUP_NUM}" \
"Completed group $GROUP_NUM. Tasks verified. Ready for next group."
# Prepare for next session if more groups exist
if [[ $NEXT_GROUP -le $TOTAL_GROUPS ]]; then
${CLAUDE_PLUGIN_ROOT}/scripts/checkpoint-manager.sh handoff
echo "Session complete. Run /auto-continue for next group."
fi
| Metric | Limit | Action |
|---|---|---|
| Agents per group | max_agents config (default 5) | Split into sub-groups |
| Groups per session | 1 | Checkpoint and continue |
| Context usage | < 80% | Continue, monitor |
| Context usage | >= 80% | Force checkpoint |
When work_type == FRONTEND, add visual verification step:
┌─────────────────────────────────────────────────────────────┐
│ FRONTEND Workflow │
│ │
│ 1. Task Executor (TDD cycle) │
│ 2. QA Agent (independent verification) │
│ 3. E2E Validator (visual verification) ← NEW │
│ 4. Integration (merge) │
└─────────────────────────────────────────────────────────────┘
| Condition | E2E Required |
|---|---|
| work_type == FRONTEND | ✅ Yes |
| UI components changed | ✅ Yes |
| CSS/styling changed | ✅ Yes |
| work_type == BACKEND | ❌ No |
| API-only changes | ❌ No |
After QA Agent approves, dispatch E2E validator:
Task(
subagent_type: "general-purpose",
prompt: "Run e2e-validator skill on the merged code.
Check: responsive layouts, interactive elements, visual regressions.
Base URL: http://localhost:3000",
run_in_background: false
)
┌─────────────────────────────────────────────────────────────┐
│ E2E Validation: FRONTEND │
│ │
│ Viewports tested: mobile, tablet, desktop, wide │
│ Screenshots: .claude/screenshots/current/ │
│ │
│ Visual regressions: 0 │
│ Interactive tests: 5/5 passed │
│ │
│ Status: ✅ PASS │
└─────────────────────────────────────────────────────────────┘
Do NOT use this skill when:
parallelization.enabled in configmax_agents configuration settingnpx claudepluginhub adiomas/claude-code-adiomas-plugins --plugin autonomous-devDecomposes large tasks (migrations, multi-issue fixes, big features) into parallel work packages with quality gates. Useful for reducing PR cycle time and avoiding merge conflicts.
Executes implementation plans by dispatching fresh subagents per task with dependency analysis, concurrent execution, and built-in two-stage self-review for spec compliance and code quality.
Orchestrates multi-agent work at scale—research swarms, parallel builds, wave dispatch, build-review-fix pipelines, and any task needing 3+ agents. Selects strategy by work shape and partitions agents for true parallelism.