← Reddit

Running two Claude Code agents on the same repo simultaneously. Git worktrees make it work.

Reddit · EastMove5163 · May 11, 2026
A developer demonstrated running multiple Claude Code agents in parallel on the same codebase using git worktrees, with each agent working on its own branch and directory to avoid file conflicts. The approach enables significant speed improvements for parallelizable work, such as simultaneous bug fixes and feature development or independent refactoring and test coverage tasks. The technique proved successful even when agents operated simultaneously without awareness of each other, and branches merged together normally afterward.

Detailed Analysis

A developer working with Claude Code has documented a workflow for running multiple AI coding agents simultaneously on the same codebase by leveraging git worktrees, a feature of Git that allows multiple working directories to be checked out from the same repository. The core mechanism is straightforward: each agent is assigned its own branch and its own isolated directory on disk, which eliminates file-level conflicts that would otherwise arise from concurrent read/write operations. The author reports successfully running one agent on a bug fix while another worked on a new feature, with neither agent having any awareness of the other's activity. Once both complete their respective tasks, branches are merged through standard Git workflows.

The practical appeal of this approach lies in its exploitation of genuine task independence. Not all software development work parallelizes cleanly, but the author identifies several categories where the pattern delivers meaningful speed improvements: bug fix paired with feature development, refactoring alongside test coverage expansion, and two unrelated feature additions. The setup imposes no special tooling requirements beyond stock Git capabilities and Claude Code itself, making it accessible to any developer already using both. The workflow maps neatly onto a common software engineering heuristic — separation of concerns — and applies it at the level of AI agent orchestration rather than code architecture.

From a broader perspective, this workflow represents an early grassroots exploration of multi-agent software development patterns, a topic that has attracted significant attention across the AI industry. Anthropic has publicly emphasized agentic use cases as a key frontier for Claude, and Claude Code in particular is positioned as a tool for autonomous, long-running coding tasks. The git worktree approach essentially implements a primitive form of agent parallelism without requiring any specialized orchestration infrastructure — developers are improvising multi-agent coordination using existing version control primitives. This suggests that even before purpose-built multi-agent frameworks mature, practitioners are finding creative ways to extract parallel productivity from current-generation AI coding tools.

The open question the author raises — whether merge conflicts become a serious problem at scale or for longer-running tasks — points to the real ceiling of this approach. As agents work on increasingly complex or interrelated problems, the probability of overlapping changes grows, and the simplicity of the workflow starts to erode. The merge step, which the author currently treats as routine, could become the primary bottleneck. This dynamic mirrors historical debates in distributed software development about when the overhead of managing divergent branches outweighs the benefits of parallel work. For the AI agent context, it also raises an unanswered question about whether future tooling — from Anthropic or the broader ecosystem — will build conflict-awareness and inter-agent communication directly into the development environment, rather than leaving developers to manage coordination manually through Git.

Read original article →