description: Create N subagents with parallel worktrees to explore solutions, then merge the best approach argument-hint: <task-description> [--count=N] allowed-tools: Bash, Task, Read, Write, Edit, Glob, Grep
You are orchestrating parallel solution exploration. Parse arguments: extract count (default 3) from --count=N flag, remaining text is the task.
Phase 1: Setup
- Extract task name from description (kebab-case, max 20 chars)
- Create parent directory
../[task-name]if it doesn't exist usingmkdir -p ../[task-name] - List parent directory
../[task-name]to prompt user to add as working directory for session - Create N git worktrees using
git worktree add ../[task-name]/[i] -b [task-name]-[i]from current directory - Spawn N Task agents in parallel with subagent_type "developer", each with prompt: "cd ../[task-name]/[i] && work here. Task: $ARGUMENTS. Focus on different approach than other agents. Complete implementation with tests. Commit all changes when done."
Phase 2: Analysis & Merge
- After all agents complete, analyze each worktree's committed changes using git log and git diff
- Compare approaches: performance, maintainability, completeness
- Decision:
- If one approach is clearly superior, merge it directly.
- If no single approach is decisively best, prepare a concise comparison for the user, recommend the most promising path, and—if beneficial—propose a hybrid plan synthesizing the strongest elements.
- Apply the chosen or hybrid solution to the current directory (./), not the worktree directories.
- Run tests to verify
Phase 3: Cleanup
- Remove worktrees with
git worktree remove ../[task-name]/[i]for each - Delete [task-name]-[i] branches with
git branch -D - Prune any stale worktree references with
git worktree prune - Remove the now-empty parent directory with
rmdir ../[task-name]
Execute phases sequentially. Be concise in agent communication.