Member-only story
Running Multiple AI Agents at Once Using Git Worktrees
Or how to get more productive with long running agents
The Agent is the bottleneck
The Problem
Running a local agent effectively “locks” your workspace. While an agent is busy with code generation or long-running evaluations, you are tied to that specific branch. Switching branches to handle a separate task risks breaking the agent’s execution or creating a mess of uncommitted changes.
Cloning the repository into multiple separate folders is a common workaround, but it is inefficient. It duplicates the entire .git history, consumes excessive disk space, and makes managing synchronized updates between copies a logistical headache.
The Solution
Git Worktrees¹. Instead of cloning, worktrees allow you to attach multiple independent working directories to a single repository. Think of them as “parallel universes”: each agent gets its own folder and branch, enabling five agents to operate on five different tasks simultaneously from one source.
Once a task is complete, you simply merge the worktree branch into main. Deleting the worktree folder leaves no trace, no redundant clones, no configuration drift, and no idle time.

