Running Parallel Agents on Isolated Worktrees for Small Reviewable PRs
Running Parallel Agents on Isolated Worktrees for Small Reviewable PRs
The biggest issue with agent-generated pull requests is they try to do everything at once. The agent sees a bug, fixes it, then notices a refactoring opportunity, takes it, then adds a feature while it is in there. The resulting PR touches 40 files across 3 unrelated concerns, and the reviewer just gives up.
The Problem With Big PRs
Code review quality drops off a cliff as PR size increases. A 50-line PR gets careful, line-by-line review. A 500-line PR gets a skim and an approval. A 2000-line PR gets "LGTM" from someone who opened it, scrolled for 10 seconds, and closed it.
When an AI agent produces these monster PRs, the value of having an agent is undermined. You automated the coding but broke the review process.
The Worktree Approach
Instead of branch stacking - where you chain dependent branches on top of each other - I run multiple agents in parallel on isolated git worktrees, each scoped to one concern.
Each worktree is a separate checkout of the repo at the same base commit. Agent A works on the API endpoint in worktree A. Agent B works on the UI component in worktree B. Agent C fixes the test suite in worktree C. They do not interfere with each other because they are working in separate directories.
Why This Works
- Isolation: each agent only sees the files relevant to its task, so it cannot wander into unrelated changes
- Parallelism: all three agents run simultaneously instead of sequentially
- Clean PRs: each worktree produces a single-concern branch that maps to a small, reviewable PR
- Easy conflict resolution: if two agents modify the same file, you catch it at merge time with a clean diff instead of untangling interleaved changes
The Practical Setup
Create worktrees from your main branch, assign each agent a specific task with a narrow scope, and let them run. When they finish, you have three branches ready for three separate PRs. Each one is small enough for a real review.
The key is scoping. Be explicit about what each agent should and should not touch. "Fix the login validation bug in auth.ts - do not modify any other files" is a better prompt than "fix the login flow."
Fazm is an open source macOS AI agent. Open source on GitHub.