$ARGUMENTS
Orchestrates parallel development by spinning up multiple git worktrees and tmux sessions to handle independent tasks simultaneously. Use this when you need to work on multiple related features or subtasks at once, such as creating separate branches for authentication, API endpoints, and tests.
/plugin marketplace add ken2403/.claude-paralell-dev-plugin/plugin install pw@claude-parallel-dev-plugin$ARGUMENTS
basename $(git rev-parse --show-toplevel 2>/dev/null) || echo "unknown"git branch --show-currentgit status --short | head -5 || echo "clean"gh pr list --state open --limit 10 2>/dev/null || echo "Cannot fetch PRs"tmux list-sessions 2>/dev/null || echo "No active sessions"Locate the parallel-workflow plugin scripts:
# Find plugin directory (check common locations)
if [ -d ".claude-paralell-dev-plugin/scripts" ]; then
PLUGIN_DIR=".claude-paralell-dev-plugin"
elif [ -d "../.claude-paralell-dev-plugin/scripts" ]; then
PLUGIN_DIR="../.claude-paralell-dev-plugin"
elif [ -n "$PW_PLUGIN_DIR" ]; then
PLUGIN_DIR="$PW_PLUGIN_DIR"
else
echo "Error: parallel-workflow plugin not found"
echo "Set PW_PLUGIN_DIR environment variable or place plugin in .claude-paralell-dev-plugin/"
exit 1
fi
The scripts automatically detect the git repository:
GIT_REPO environment variableThis allows running from a parent directory:
/workspace/ ← Claude session here
├── my-project/ ← Git repo (auto-detected)
├── wt-feature-auth/ ← worktree (auto-created)
└── wt-feature-api/ ← worktree (auto-created)
Detect the base branch from workspace configuration (NOT always main/master):
# Check CLAUDE.md for base branch specification
BASE_BRANCH=""
if [ -f "CLAUDE.md" ]; then
BASE_BRANCH=$(grep -i "base.branch\|default.branch\|primary.branch" CLAUDE.md | head -1 | grep -oE "(main|master|develop|dev|release[^[:space:]]*)" || echo "")
fi
# Fallback: check git remote HEAD or common branches
if [ -z "$BASE_BRANCH" ]; then
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "")
fi
# Final fallback: check which exists
if [ -z "$BASE_BRANCH" ]; then
for branch in main master develop dev; do
if git show-ref --verify --quiet "refs/heads/$branch" 2>/dev/null; then
BASE_BRANCH="$branch"
break
fi
done
fi
echo "Base branch: ${BASE_BRANCH:-main}"
Before starting workers:
# Ensure base branch is up to date
git fetch origin ${BASE_BRANCH:-main}
# Check for uncommitted changes
git status --short
If input contains branch names:
If input is decomposition output:
Use the plugin's spinup script:
# Using plugin scripts
"${PLUGIN_DIR}/scripts/spinup.sh" [branch1] [branch2] [branch3]
The spinup script will:
For each worker, construct and send the task command:
# Project name is auto-detected from git repository name
PROJECT_NAME=$(basename $(git rev-parse --show-toplevel))
# Convert branch name to session name (replace / with -)
# Example: feature/auth -> feature-auth
# Session name format: ${PROJECT_NAME}__${branch_with_dash}
# Worker 1 - Use -l flag to send literal characters (avoids quote escaping issues)
TASK1="[Task 1 detailed description in English]"
tmux send-keys -t "${PROJECT_NAME}__[branch1-safe]" -l "claude -p \"/pw:worker ${TASK1}\""
tmux send-keys -t "${PROJECT_NAME}__[branch1-safe]" Enter
# Worker 2
TASK2="[Task 2 detailed description in English]"
tmux send-keys -t "${PROJECT_NAME}__[branch2-safe]" -l "claude -p \"/pw:worker ${TASK2}\""
tmux send-keys -t "${PROJECT_NAME}__[branch2-safe]" Enter
NOTE: The -l flag sends characters literally, avoiding issues with special characters like quotes, $, and backticks in task descriptions.
CRITICAL: Always write task prompts in English for consistent parsing.
After assigning tasks, start the status-monitor subagent in background:
Use status-monitor subagent in background to monitor worker progress
The status-monitor subagent will:
This allows the orchestrator to continue with other tasks while monitoring runs in the background.
If you prefer manual monitoring, run /pw:status periodically:
PROJECT_NAME=$(basename $(git rev-parse --show-toplevel))
echo "=== Status Check $(date) ==="
# Check each worker session
for session in $(tmux list-sessions -F '#{session_name}' 2>/dev/null | grep "^${PROJECT_NAME}__"); do
echo "--- $session ---"
OUTPUT=$(tmux capture-pane -t "$session" -p 2>/dev/null | tail -20)
echo "$OUTPUT" | tail -5
# Detect status
if echo "$OUTPUT" | grep -qi "error\|failed\|exception\|traceback"; then
echo "⚠️ STATUS: ERROR DETECTED"
elif echo "$OUTPUT" | grep -qi "pull request\|pr created\|https://github.com.*pull"; then
echo "✅ STATUS: PR CREATED"
elif echo "$OUTPUT" | grep -qi "committed\|git commit"; then
echo "🔄 STATUS: COMMITTED (PR pending)"
else
echo "⏳ STATUS: IN PROGRESS"
fi
echo ""
done
# Check PRs
echo "=== Open PRs ==="
gh pr list --state open 2>/dev/null || echo "Cannot fetch PRs"
Track expected branches and check for PR creation:
# Expected branches (from orchestration input)
EXPECTED_BRANCHES="[branch1] [branch2] [branch3]"
EXPECTED_COUNT=$(echo "$EXPECTED_BRANCHES" | wc -w | tr -d ' ')
# Count PRs from these branches
CREATED_PRS=$(gh pr list --state open --json headRefName --jq '.[].headRefName' 2>/dev/null)
CREATED_COUNT=0
for branch in $EXPECTED_BRANCHES; do
if echo "$CREATED_PRS" | grep -q "^${branch}$"; then
CREATED_COUNT=$((CREATED_COUNT + 1))
fi
done
echo "Progress: $CREATED_COUNT / $EXPECTED_COUNT PRs created"
if [ "$CREATED_COUNT" -eq "$EXPECTED_COUNT" ]; then
echo "🎉 ALL WORKERS COMPLETED - Ready for review"
fi
If error detected in a worker:
Capture full error log:
tmux capture-pane -t "$session" -p -S -1000 > /tmp/worker_error_${session}.log
Alert and suggest action:
Options:
tmux send-keys -t "$session" 'claude -p "/pw:fix [error description]"' EnterWhen all PRs are created:
List all PRs for review:
gh pr list --state open --json number,title,headRefName
Start review process:
For each PR, run: /pw:review [pr-number]
After all reviews approved and merged:
Run: /pw:cleanup [branches]
# Orchestration Started
## Workers Created
| Session | Branch | Worktree | Status |
|---------|--------|----------|--------|
| [project]__feature-xxx | feature/xxx | /path/to/wt-feature-xxx | Started |
| [project]__feature-yyy | feature/yyy | /path/to/wt-feature-yyy | Started |
| [project]__feature-zzz | feature/zzz | /path/to/wt-feature-zzz | Started |
## Task Assignments
- **Worker 1** (feature/xxx): [Task description]
- **Worker 2** (feature/yyy): [Task description]
- **Worker 3** (feature/zzz): [Task description]
## Monitoring Started
Checking status every 60 seconds...
# Status Update [HH:MM:SS]
| Worker | Branch | Status | Last Activity |
|--------|--------|--------|---------------|
| Worker 1 | feature/xxx | 🔄 WORKING | Editing src/auth.py |
| Worker 2 | feature/yyy | ✅ PR CREATED | PR #45 |
| Worker 3 | feature/zzz | ⚠️ ERROR | Test failed |
## Progress: 1/3 PRs created
## Actions Needed
- Worker 3: Error detected. Review error and run `/pw:fix` or restart.
# 🎉 All Workers Completed
## PRs Ready for Review
| PR # | Branch | Title |
|------|--------|-------|
| #45 | feature/xxx | feat: Add authentication |
| #46 | feature/yyy | feat: Add API endpoints |
| #47 | feature/zzz | test: Add integration tests |
## Next Steps
1. Review each PR: `/pw:review 45`, `/pw:review 46`, `/pw:review 47`
2. After all approved and merged: `/pw:cleanup feature/xxx feature/yyy feature/zzz`