**Purpose:** Manage git worktrees for parallel development with sub-agents
Manages git worktrees for parallel development with sub-agents. Use this to handle epics with multiple dependent sub-issues, enabling 2-3x faster development by running tasks concurrently in isolated worktrees.
/plugin marketplace add Lobbi-Docs/claude/plugin install jira-orchestrator@claude-orchestrationPurpose: Manage git worktrees for parallel development with sub-agents Model: sonnet (for coordination) | haiku (for individual worktrees) Category: git
The Worktree Orchestrator manages parallel development workflows using git worktrees. It enables multiple sub-agents to work simultaneously on different parts of a feature or epic, each in their own isolated worktree.
| Scenario | Use Worktrees? | Reason |
|---|---|---|
| Epic with 3+ sub-issues | YES | Parallel development |
| Multiple independent features | YES | No context switching |
| Long-running feature + hotfix | YES | Don't block hotfix |
| Single simple task | No | Overhead not justified |
| Complex feature with dependencies | YES | Clear separation |
action: analyze_task
input:
issue_key: ${issue_key}
sub_issues: ${sub_issue_list}
output:
worktree_plan:
parallel_groups:
- level_0: [PROJ-101, PROJ-102] # No dependencies
- level_1: [PROJ-103] # Depends on level_0
- level_2: [PROJ-104] # Depends on level_1
total_worktrees: 4
estimated_parallelism: 3x
# Create worktree for each sub-issue
git worktree add ../worktree-PROJ-101 -b feature/PROJ-101-frontend
git worktree add ../worktree-PROJ-102 -b feature/PROJ-102-backend
git worktree add ../worktree-PROJ-103 -b feature/PROJ-103-integration
action: spawn_sub_agents
parallel_execution: true
agents:
- name: "frontend-specialist"
worktree: "../worktree-PROJ-101"
issue: "PROJ-101"
model: "sonnet"
task: "Implement frontend component"
- name: "backend-specialist"
worktree: "../worktree-PROJ-102"
issue: "PROJ-102"
model: "sonnet"
task: "Implement backend API"
coordination:
sync_interval: 5_minutes
progress_reporting: true
dependency_checking: true
action: monitor_progress
tracking:
- issue: PROJ-101
status: in_progress
completion: 60%
agent: frontend-specialist
- issue: PROJ-102
status: in_progress
completion: 45%
agent: backend-specialist
aggregated:
total_completion: 52.5%
blocking_issues: []
next_level_ready: false
action: create_prs
prs_created:
- issue: PROJ-101
branch: feature/PROJ-101-frontend
pr_number: 123
status: ready_for_review
- issue: PROJ-102
branch: feature/PROJ-102-backend
pr_number: 124
status: ready_for_review
merge_order:
1: [PR-123, PR-124] # Can merge in parallel
2: [PR-125] # After level 1 merged
# After PR merged
git worktree remove ../worktree-PROJ-101
git worktree remove ../worktree-PROJ-102
# Force remove if needed
git worktree remove --force ../worktree-PROJ-103
workspace/
├── main-repo/ # Main repository (main branch)
│ └── .git/ # Git directory
├── worktree-PROJ-101/ # Worktree for sub-issue 101
│ ├── src/
│ └── tests/
├── worktree-PROJ-102/ # Worktree for sub-issue 102
│ ├── src/
│ └── tests/
└── worktree-PROJ-103/ # Worktree for sub-issue 103
├── src/
└── tests/
| File Pattern | Specialist Agent |
|---|---|
*.tsx, *.jsx, components/ | react-component-architect |
*.py, api/, services/ | backend-specialist |
*.prisma, migrations/ | database-specialist |
*.test.*, tests/ | test-writer-fixer |
*.tf, terraform/ | terraform-specialist |
helm/, k8s/ | helm-chart-developer |
| Complexity | Model | Reason |
|---|---|---|
| Simple UI component | haiku | Fast, straightforward |
| Business logic | sonnet | Requires reasoning |
| Architecture decisions | opus | Strategic thinking |
| Documentation | haiku | Quick generation |
Epic: PROJ-100 "Implement OAuth2 Login"
│
├── LEVEL 0 (parallel - no dependencies):
│ │
│ ├── WORKTREE: ../worktree-PROJ-101
│ │ Issue: PROJ-101 "Database schema for users"
│ │ Agent: prisma-specialist (sonnet)
│ │ Status: ▓▓▓▓▓▓▓▓░░ 80%
│ │
│ └── WORKTREE: ../worktree-PROJ-102
│ Issue: PROJ-102 "Design login UI mockup"
│ Agent: ux-researcher (haiku)
│ Status: ▓▓▓▓▓▓▓▓▓▓ 100% ✓
│
├── LEVEL 1 (after LEVEL 0):
│ │
│ ├── WORKTREE: ../worktree-PROJ-103
│ │ Issue: PROJ-103 "Implement Keycloak integration"
│ │ Agent: keycloak-specialist (sonnet)
│ │ Status: ░░░░░░░░░░ Waiting
│ │
│ └── WORKTREE: ../worktree-PROJ-104
│ Issue: PROJ-104 "Create LoginForm component"
│ Agent: react-component-architect (sonnet)
│ Status: ░░░░░░░░░░ Waiting
│
└── LEVEL 2 (after LEVEL 1):
│
└── WORKTREE: ../worktree-PROJ-105
Issue: PROJ-105 "Integration tests for auth flow"
Agent: test-writer-fixer (sonnet)
Status: ░░░░░░░░░░ Waiting
Parallelism: 2-3 agents working simultaneously
Estimated speedup: 2.5x vs sequential
/worktree:create PROJ-101 --base main --description "user-auth-frontend"
Creates:
feature/PROJ-101-user-auth-frontend../worktree-PROJ-101/worktree:list
Output:
Active Worktrees:
../worktree-PROJ-101 feature/PROJ-101-frontend [80% complete]
../worktree-PROJ-102 feature/PROJ-102-backend [45% complete]
Main Repository:
./ main [primary]
/worktree:remove PROJ-101 --cleanup
Actions:
/worktree:sync --all
Actions:
When /jira:work detects multiple sub-issues:
auto_worktree:
threshold: 3 # Create worktrees if >= 3 sub-issues
enabled: true
cleanup_on_complete: true
Each worktree creates its own PR:
pr_strategy:
one_pr_per_worktree: true
link_to_parent: true
merge_order: "dependency_aware"
Updates posted for each worktree:
## Worktree Status
| Issue | Branch | Agent | Progress |
|-------|--------|-------|----------|
| PROJ-101 | feature/PROJ-101-frontend | react-architect | 80% |
| PROJ-102 | feature/PROJ-102-backend | backend-specialist | 45% |
error: worktree_creation_failed
cause: "Branch already exists"
resolution:
1. Check if branch exists: git branch -a | grep PROJ-101
2. Delete if stale: git branch -D feature/PROJ-101-xxx
3. Retry creation
error: merge_conflict
worktree: "../worktree-PROJ-103"
conflicts:
- src/services/auth.ts
resolution:
1. Navigate to worktree: cd ../worktree-PROJ-103
2. Resolve conflicts manually
3. Commit resolution
4. Continue: /worktree:continue PROJ-103
error: agent_failed
worktree: "../worktree-PROJ-102"
agent: backend-specialist
reason: "Test failures"
resolution:
1. Review failures in worktree
2. Fix issues manually or reassign agent
3. Resume: /worktree:resume PROJ-102
# jira-orchestrator/config/worktree.yml
worktree:
enabled: true
base_path: "../" # Relative to main repo
naming_pattern: "worktree-{issue_key}"
auto_create:
threshold: 3 # Min sub-issues for auto-worktree
cleanup:
on_pr_merge: true
on_error: false
retain_days: 7
sub_agents:
spawn_per_worktree: true
model_default: "sonnet"
max_parallel: 6
parallel-sub-issue-worker - Executes sub-issues in parallelexpert-agent-matcher - Selects best agent for each worktreepr-size-estimator - Determines if worktrees are neededagent-router - Routes work to appropriate specialists| Metric | Target | Actual |
|---|---|---|
| Parallel speedup | 2-3x | Measured per epic |
| Merge conflicts | < 5% | Tracked |
| Worktree cleanup | 100% | Automated |
| Sub-agent success | > 95% | Monitored |
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences