Parallel Agent Workflows: Running Multiple Claude Code Sessions with Git Worktrees
Parallel Agent Workflows: Running Multiple Claude Code Sessions with Git Worktrees
The single biggest mistake engineers make when using Claude Code is working sequentially:
- Run a long prompt to implement an API feature.
- Stare at the terminal for 4 minutes while Claude searches files and executes tests.
- Pause everything when a production bug or code review needs immediate attention.
This creates an artificial bottleneck. You are treating an autonomous agent like a synchronous REPL.
The solution is an old Git capability that has become the definitive superpower of 2026 AI engineering: Git Worktrees.
What Are Git Worktrees?
Standard Git checkouts swap files in place inside a single directory. A git worktree allows you to check out multiple branches of the same repository simultaneously into separate physical directories on your disk.
All worktrees share the same underlying .git object database, meaning zero duplicate clone overhead.
1. Setting Up Parallel Worktrees for Claude Code
Suppose you are working on main in your primary repository directory. You need to build a new authentication feature, fix a payment bug, and review a teammate's PR simultaneously.
Create isolated worktrees:
# Worktree 1: Feature branch
git worktree add ../repo-feature-auth -b feature/oauth2-upgrade
# Worktree 2: Urgent hotfix
git worktree add ../repo-hotfix-billing -b fix/stripe-webhook-timeout
# Worktree 3: PR review
git worktree add ../repo-pr-104 origin/pr-104
You now have three clean, independent directories:
../repo-feature-auth../repo-hotfix-billing../repo-pr-104
2. Launching Autonomous Claude Code Instances
Open three separate terminal tabs (or tmux panes) and launch Claude inside each directory:
# Tab 1: Build the feature
cd ../repo-feature-auth
claude /go "Implement OAuth2 PKCE login flow. Stop only when unit tests in /tests/auth pass."
# Tab 2: Fix the bug
cd ../repo-hotfix-billing
claude /go "Reproduce and fix Stripe webhook 504 timeout error in webhook-handler.ts."
# Tab 3: PR Review
cd ../repo-pr-104
claude /focus "Review diff against origin/main. Check for POPIA compliance and SQL injection."
Each Claude Code instance runs with its own isolated memory, separate file handles, and independent context window. Neither agent can overwrite files or corrupt Git state in the other.
3. Visual Ergonomics: /color and /rename
When managing multiple open terminal tabs, it is easy to lose track of which agent is doing what.
Use Claude Code's built-in session branding:
- In Tab 1: Run
/color blueand/rename auth-feature - In Tab 2: Run
/color redand/rename billing-hotfix - In Tab 3: Run
/color greenand/rename pr-104-review
Your terminal tabs and Claude prompts will immediately reflect distinct colors and labels, preventing accidental command execution in the wrong workspace.
4. Multi-Agent Fleet Monitoring
If you run more than two subagents, you do not need to cycle through tabs manually. Start Claude in your root repository with the fleet orchestrator:
claude agents
This launches the Agents Dashboard:
- Displays all active worktrees and running subagents
- Shows current task status (
RUNNING,AWAITING PERMISSION,COMPLETE) - Displays real-time token spend and context consumption per agent
- Allows one-click switching and keyboard navigation between tasks
5. Merging & Teardown
Once an agent signals that its /go goal is complete and all automated verification tests pass, merge the branch and tear down the worktree:
# From main repository
git merge feature/oauth2-upgrade
# Safely prune the worktree folder
git worktree remove ../repo-feature-auth
By decoupling your agent sessions across Git worktrees, you transform Claude Code from an interactive coding assistant into a parallel engineering squad.
READY TO IMPLEMENT THIS?
We specialize in turning these high-impact engineering concepts into production-grade systems.