Running Two Claude Code Agents on the Same Repo with Git Worktrees

Running multiple Claude Code agents on the same repository simultaneously has been achieved using git worktrees. Each agent gets its own branch and dedicated working directory on disk, eliminating file conflicts and allowing reading/writing without interference.
Workflow
- Create a git worktree for each branch.
- Open a separate Claude Code session in each worktree directory.
- Let the agents run in parallel — they are unaware of each other.
- When both finish, merge the branches via normal git merge.
Practical Example
# Create a worktree for a feature branch
git worktree add ../repo-feature feature-branch
# Create a worktree for a bugfix branch
git worktree add ../repo-bugfix bugfix-branch
In each directory, start Claude Code
cd ../repo-feature && claude-code .
cd ../repo-bugfix && claude-code .
Benefits
Speed improvement is real for parallelizable work: one agent fixing a bug while another drafts a new feature, or a refactor alongside test coverage. Not every task splits cleanly, but genuinely independent concerns benefit. User reports having one agent fixing a bug and another drafting a feature simultaneously without conflict.
Considerations
The user asks about reliability for longer-running tasks and whether merge conflicts become a problem at scale. Standard git merge resolution applies when merging worktree branches back.
Who It's For
Developers using Claude Code who want to parallelize independent tasks on the same codebase.
📖 Read the full source: r/ClaudeAI
👀 See Also

Claude Code Routines Tunes CLI Performance 2.4x in 20+ PRs
Using Claude Code's Routines on a 2-hour cron to autonomously tune an open-source CLI (Repomix), resulting in 20+ auto-generated PRs and a 2.4x runtime improvement.

Claude Code Karma: Local Observability Dashboard for Claude Code Sessions
Claude Code Karma is an open-source local dashboard that parses JSONL files from ~/.claude/ to visualize Claude Code session data, track tool usage, and monitor silent failures. Built with FastAPI, Svelte-Kit 2, Svelte 5, and SQLite, it provides full session timelines and live tracking.

Claude 4.6 Opus Reasoning Distilled to 14GB for Apple Silicon via MLX Quantization
A developer has quantized a Qwen 3.5 27B model distilled from Claude 4.6 Opus reasoning trajectories from 55.6GB to 14GB using MLX for Apple Silicon, achieving ~16 tokens/sec on an M4 Pro while maintaining the model's analytical reasoning capabilities.

pxpipe: Cut Claude Code Token Usage 60% by Rendering Context as Images
pxpipe is a local proxy that renders bulky context (system prompts, tool docs, history) into compact PNGs, cutting input tokens ~10x and costs ~60% on token-dense workloads.