Building with AI · Agent UX patterns
You can explain why background agents in 2026 default to git-worktree or VM isolation, and where the pattern breaks (shared state outside the repo).
Once agents can run unattended for tens of minutes, running just one at a time becomes the bottleneck. The natural next move is to run several in parallel — a fleet. The natural next problem is that they all live in the same repo. Three agents editing package.json at once is a recipe for merge conflict at best and corrupted state at worst.
Worktree isolation is the pattern that resolves this. Each background agent gets its own git worktree — a separate working directory pointing at the same repo, on its own branch. The agents can edit, commit, and run tests without seeing each other's changes. When a run completes, the user reviews the agent's branch as an ordinary PR. Conflicts get resolved at merge time, not mid-run.
The 2026 Agentic Coding Trends Report reports that 30% of Cursor's own merged PRs are now opened by background agents — a workflow that's impossible without isolation. GitHub's /fleet ships the same pattern at the Copilot CLI layer: one command, N parallel agents, each in its own sandbox. Claude Code's /goal mode uses the same primitive when it spawns sub-agents.
Chapter contains 3 lessons.