Workflow Patterns¶
Single-Task Isolation¶
One worktree for one feature or bug fix. The agent works in isolation, then merges back.
When it helps: Non-trivial changes, work that might be interrupted, experimental modifications.
When it's overkill: Single-file fixes, quick documentation updates.
Parallel Agents¶
Multiple agents working simultaneously, each in their own worktree.
.worktrees/
├── agent-1-auth/ ← Agent 1
├── agent-2-dashboard/ ← Agent 2
└── agent-3-bugfix/ ← Agent 3
Each agent has:
- Own workspace with separate dependencies
- No file conflicts between agents
- Isolated processes
Work proceeds without coordination overhead. The constraint: worktrees must be on different branches.
PR Review Pattern¶
A dedicated worktree for reviewing changes without disrupting active work.
main/ ← Your active development
.worktrees/
├── current-feature/ ← Your current task
└── pr-review-123/ ← Reviewing someone's PR
Run tests, explore changes with full IDE support, then return to your work without losing state.
When to Use Worktrees¶
| Scenario | Worktree? |
|---|---|
| Multi-file feature | Yes |
| Quick typo fix | No |
| Parallel agent work | Yes |
| Experimental refactoring | Yes |
| Documentation update | Usually no |
| Reviewing a PR during active work | Yes |
Use a worktree when losing current state would be disruptive.
When Files Conflict¶
Parallel worktrees work best when agents touch different files. When features overlap, merge conflicts become likely.
To avoid conflicts:
- Assign non-overlapping features to parallel agents
- When files overlap, serialize the work
- Frequent merges reduce conflict scope
Worktrees provide file-level isolation. Coordinating overlapping changes is your job.