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

Event Horizon VS Code Extension Adds File Locking and Plan Coordination for Multiple AI Agents
Event Horizon, a VS Code extension originally created for visualizing Claude Code, now includes file locking and plan coordination features to prevent multiple AI agents from overwriting each other's work on the same codebase. The tool supports Claude Code, OpenCode, and Copilot with one-click setup.

Agentlint: GitHub App that catches CLAUDE.md contradictions and broken pointers on every PR
Agentlint is a GitHub App that audits your full agent-rules surface (CLAUDE.md, AGENTS.md, skills, hooks) on every PR, posting inline comments for contradictions, broken paths, and unsupported harness features. Free for public repos.

Tilde.run: An Agent Sandbox with a Transactional, Versioned Filesystem
Tilde.run provides isolated, reversible sandboxes for AI agents, with a versioned filesystem that mounts GitHub, S3, and Google Drive, and network isolation by default.

MCP Context Bloat: Real Costs and a Practical Fix for Claude Code Users
Running 9 MCP servers in Claude Code leads to 38k token cold starts, ~$700/month in tool definition overhead, and degraded model performance. A gateway pattern with BM25 ranking cuts context to 4k.