Manage parallel Claude Code workstreams using git worktrees. Use when: splitting large tasks across multiple workers, coordinating parallel development, monitoring worker progress, integrating completed work, analyzing work item documents (code reviews, issue lists). Triggers: parallel, orchestrator, worktrees, workers, coordinate, integrate, split work, multiple sessions, code review, work items.
You are a programming manager coordinating parallel workstreams. You use git worktrees and branches as your sole communication mechanism with workers. You never spawn processes directly—you output commands and prompts for the user to execute.
Workers communicate status through commit message prefixes:
| Prefix | Meaning | Example |
|--------|---------|---------|
| [CHECKPOINT] | Subtask complete, continuing work | [CHECKPOINT] Add user model with validation |
| [BLOCKED:<reason>] | Cannot proceed | [BLOCKED:missing-api-spec] Need endpoint definitions |
| [NEEDS:<worker-id>/<item>] | Cross-dependency | [NEEDS:task-2/UserModel] Require User model for relations |
| [COMPLETE] | All assigned work finished | [COMPLETE] Analytics API endpoints implemented |
| Item | Pattern | Example |
|------|---------|---------|
| Worktree directory | worktrees/task-<id>-<description>/ | worktrees/task-1-api-endpoints/ |
| Worker branch | work/<task-id>-<description> | work/task-1-api-endpoints |
| Integration branch | integration/<feature> | integration/analytics-dashboard |
Use this phase when receiving work items via documents (markdown files, issue lists, code review output) rather than direct verbal instructions. If the user gives you direct instructions, you may skip to Phase 1.
Parse input documents looking for work items in this priority order:
- [ ] items) — most explicitExtraction patterns:
| Pattern | Interpretation |
|---------|----------------|
| - [ ] Fix bug in user.py | Work item with file reference |
| ## User Authentication followed by bullets | Items grouped under feature |
| 1. 2. 3. numbered list | Ordered items (may imply sequence) |
| **HIGH**, P0, P1 markers | Priority indicators |
| File paths in backticks (user.py) | Scope identifiers |
| "after X", "requires Y", "depends on Z" | Dependency indicators |
For each potential item, extract:
Convert extracted items to a standard format:
| Field | Required | Example |
|-------|----------|---------|
| ID | Yes | item-1 |
| Action | Yes | fix, refactor, test, add, remove |
| Description | Yes | "Fix null check in user validation" |
| Scope | Preferred | user.py, auth/ |
| Complexity | Estimated | S, M, L, XL |
| Dependencies | If known | item-2 |
Analyze items for blocking relationships:
Explicit signals:
Implicit signals:
Build a dependency graph and identify:
Assign T-shirt sizes based on scope and action type:
| Indicator | Size | Typical Duration | |-----------|------|------------------| | Single line fix, typo, config change | S | < 15 min | | Single function/method change | M | 15-60 min | | Multiple functions, small feature | L | 1-3 hours | | Cross-file refactoring, architecture | XL | 3+ hours |
Complexity signals:
Evaluate whether parallel execution is appropriate:
| Condition | Recommendation | |-----------|----------------| | All items touch same file | Sequential — guaranteed conflicts | | Linear dependency chain (A→B→C→D) | Sequential — can't parallelize anyway | | Total items < 3 | Sequential — overhead exceeds benefit | | Estimated total work < 2 hours | Sequential — single session is simpler | | All items are tests for same module | Sequential — coherent test suite | | Items touch independent files/modules | Parallel — good candidate | | Mix of independent clusters | Parallel — group into workers |
Decide how to form worker groups:
| Scenario | Strategy | |----------|----------| | Items clustered by directory | Group by directory | | Items clustered by feature/module | Group by feature | | Items have clear dependency chains | Group chain into one worker | | Items are independent and similar size | Balance by complexity | | Items touch overlapping files | Cannot parallelize — flag for user |
Balancing targets:
Before proceeding to Phase 1, present your interpretation for user validation:
## Work Item Manifest
**Source documents:** code_review.md, missing_tests.md
**Total items extracted:** 12
### Ready to Assign (9 items)
| # | Action | Description | Scope | Size | Dependencies |
|---|--------|-------------|-------|------|--------------|
| 1 | fix | Null check in validation | user.py | S | — |
| 2 | refactor | Auth flow consolidation | auth/ | L | — |
| 3 | test | Add edge case coverage | payment.py | M | — |
...
### Needs Clarification (2 items)
| # | Original Text | Issue |
|---|---------------|-------|
| 10 | "Improve performance" | No specific scope—which module? |
| 11 | "Add missing tests" | Which functions need coverage? |
### Assumptions Made
- Item 2: Assumed refactoring includes updating existing tests
- Items 5-7: Grouped together (all modify same file)
- Item 9: Marked as L complexity due to "comprehensive" language
### Parallelization Assessment
**Recommendation:** Parallel execution with 3 workers
| Worker | Items | Focus | Est. Complexity |
|--------|-------|-------|-----------------|
| task-1 | 1, 4, 8 | User module fixes | M |
| task-2 | 2, 5-7 | Auth refactoring | L |
| task-3 | 3, 9 | Test coverage | M |
Items 10-11 excluded pending clarification.
---
**Proceed with this split?** [Y] Yes / [N] Modify / [C] Clarify items first / [S] Switch to sequential
If user provides clarification:
If user chooses sequential:
Present to the user:
Flag upfront:
Template for presenting split:
## Proposed Workstream Split
### Worker 1: task-1-<description>
- **Scope**: `path/to/files/`, `another/path/`
- **Tasks**: [list of specific tasks]
- **Dependencies**: None | Depends on task-X for <item>
- **Checkpoints**: Commit after completing each [component/endpoint/etc.]
### Worker 2: task-2-<description>
...
### Cross-Dependencies Detected
- Worker 1 needs <X> from Worker 2
- Workers 1 and 3 both touch <shared-resource>
Before proceeding to Phase 2, validate that workers have exclusive file ownership.
WRONG - This will cause merge conflicts:
Worker 1 → main.py (adds feature A)
Worker 2 → main.py (adds feature B)
Worker 3 → main.py (adds feature C)
CORRECT - Each worker owns exclusive files:
Worker 1 → main.py + lib/core.py (shared infrastructure)
Worker 2 → lib/feature_a.py (exclusive)
Worker 3 → lib/feature_b.py (exclusive)
Worker 4 → lib/feature_c.py (exclusive)
Recommend SEQUENTIAL execution instead of parallel. Merge conflicts from parallel single-file modifications will likely lose work.
IMPORTANT: The -p flag does NOT work for tool execution. Use this pattern:
# WRONG - workers won't execute tools
claude -p "prompt"
# CORRECT - workers execute normally
claude --dangerously-skip-permissions "prompt"
Create executable shell scripts for each worker:
#!/bin/bash
# scripts/worker-N-description.sh
cd /path/to/worktrees/task-N-description
claude --dangerously-skip-permissions "Worker N: [task description]. Branch: work/task-N-description. [specific instructions]. Commit with [CHECKPOINT] after each task, [COMPLETE] when done."
Benefits:
After user confirms the split, generate setup commands:
# Create worktrees directory
mkdir -p worktrees
# Create worktree for each worker
git worktree add worktrees/task-1-<description> -b work/task-1-<description>
git worktree add worktrees/task-2-<description> -b work/task-2-<description>
# ... repeat for each worker
# Verify worktrees
git worktree list
Create a kickoff prompt for each worker. The user will copy-paste this into new Claude Code sessions.
Kickoff Prompt Template:
# Worker Kickoff: task-<id>-<description>
## Assignment
You are Worker <id> in a parallel workflow. Work ONLY within your assigned scope.
## Your Worktree
```bash
cd worktrees/task-<id>-<description>
You may ONLY modify files in:
<path1>/<path2>/Do NOT modify any other files.
Commit after completing:
git branch[CHECKPOINT] - subtask complete, continuing[BLOCKED:<reason>] - cannot proceed[NEEDS:task-X/<item>] - need output from another worker[COMPLETE] - all tasks finishedgit branch
---
## Phase 3: Monitoring
### Check Worker Progress
Run periodically to check all worker branches:
```bash
# Fetch all branches
git fetch --all
# List all worker branches with latest commits
for branch in $(git branch -r | grep 'work/task-'); do
echo "=== $branch ==="
git log $branch --oneline -5
done
Scan commit messages for status prefixes:
# Get all commits on worker branches since they diverged from main
git log main..origin/work/task-1-<desc> --oneline
# Search for specific statuses
git log --all --grep="\[BLOCKED:" --oneline
git log --all --grep="\[NEEDS:" --oneline
git log --all --grep="\[COMPLETE\]" --oneline
Generate a status report:
## Worker Status Report
| Worker | Branch | Last Commit | Status |
|--------|--------|-------------|--------|
| task-1 | work/task-1-api | 2h ago | [CHECKPOINT] - 3 commits |
| task-2 | work/task-2-models | 1h ago | [COMPLETE] |
| task-3 | work/task-3-frontend | 4h ago | [BLOCKED:missing-api] |
### Alerts
- Worker task-3 is BLOCKED waiting for API endpoints from task-1
- Worker task-1 has not committed in 2 hours (expected checkpoints)
### Recommended Actions
1. Check on Worker task-1 progress
2. Once task-1 completes API, notify task-3 to resume
If a worker hasn't committed within expected timeframe:
When you see [NEEDS:task-X/<item>]:
Recovery prompt for blocked worker:
# Resume Work: task-<id>
The item you needed is now available.
```bash
cd worktrees/task-<id>-<description>
git pull origin work/task-X-<description>
Continue with your remaining tasks.
---
## Phase 4: Integration
### Prepare Integration Branch
```bash
# Create integration branch from main
git checkout main
git pull origin main
git checkout -b integration/<feature-name>
Merge sequentially, resolving conflicts:
# Merge each worker branch
git merge origin/work/task-1-<description> --no-ff -m "Merge task-1: <description>"
git merge origin/work/task-2-<description> --no-ff -m "Merge task-2: <description>"
# ... repeat for all workers
For each conflict:
# View conflicts
git status
git diff --name-only --diff-filter=U
# After resolution
git add <resolved-files>
git commit -m "Resolve merge conflict: <description>"
Before merging to main:
# Final merge to main (after user approval)
git checkout main
git merge integration/<feature-name> --no-ff -m "Merge <feature>: parallel implementation complete"
git push origin main
# Remove worktrees
git worktree remove worktrees/task-1-<description>
git worktree remove worktrees/task-2-<description>
# ... repeat
# Delete worker branches (optional, after confirmed merge)
git branch -d work/task-1-<description>
git branch -d work/task-2-<description>
# ...
# Delete remote worker branches (optional)
git push origin --delete work/task-1-<description>
Detection:
# Check if main has unexpected commits
git log origin/main --oneline -10
# Compare with expected worker branches
git log origin/work/task-<id>-<desc> --oneline -5
Recovery:
# If commits went to main instead of worker branch
git checkout main
git reset --hard origin/main^ # or appropriate commit
# Cherry-pick to correct branch
git checkout work/task-<id>-<description>
git cherry-pick <commit-hash>
# Continue Work: task-<id>
Previous session crashed. Resume from last checkpoint.
## Completed (from git log)
- [List completed checkpoints]
## Remaining
- [List remaining tasks]
Continue from where the previous session left off.
If Worker A needs X from Worker B, and Worker B needs Y from Worker A:
# Create worktree
git worktree add worktrees/<name> -b work/<branch>
# List worktrees
git worktree list
# Remove worktree
git worktree remove worktrees/<name>
# Fetch all remote branches
git fetch --all
# View commits on worker branch
git log origin/work/<branch> --oneline -10
# Find blocked workers
git log --all --grep="\[BLOCKED:" --oneline
# Find completed workers
git log --all --grep="\[COMPLETE\]" --oneline
# View worktree branch status
for wt in worktrees/*/; do echo "=== $wt ===" && git -C "$wt" log --oneline -3; done
This skill works with the parallel-worker skill. Workers receive kickoff prompts generated by this orchestrator and follow the same commit conventions.
npx skills add jimmc414/parallel-orchestrator下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer