CloudCodeTree LogoCloudCodeTree
HomeResumeAI NewsContactSchedule
CloudCodeTree Logo
CloudCodeTree
← Back to AI News
Claude Code Fan-Out: Parallel Subagents in Git Worktrees Halve Your Wall-Clock Time

Photo: Boris K. / Pexels

Claude Code Fan-Out: Parallel Subagents in Git Worktrees Halve Your Wall-Clock Time

Chris Harper

2 min read

Jun 17, 2026 · 15:59 UTC

AI
Workflow
Claude Code
Best Practices

TL;DR: Parallel Claude Code sessions in separate git worktrees eliminate file conflicts and reduce wall-clock time to the longest single task instead of the sum of all tasks.

When a coding job splits into independent subtasks — "update the API layer," "add tests," "regenerate docs" — sequential Claude Code sessions leave you waiting. The fan-out pattern: one git worktree per task, parallel sessions, merge when all finish.

One-time setup:

git worktree add ../project-api api-work
git worktree add ../project-tests test-work

Each worktree is a full checkout on a named branch. Open a separate claude session in each directory — they share repo history but touch different files, so there are no conflicts mid-run.

Pattern 1: Scope each subagent's tools. If you're using Claude Code's experimental Agent Teams (set "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" in settings.json), restrict each subagent to exactly what it needs. A test-writer agent doesn't need web fetches or git push:

---
tools: Read, Write, Bash
---
Write tests only. Do not modify source files or run git commands.

Pattern 2: Stop hook as a completion gate. Wire a hook in .claude/settings.json that runs your test suite before the agent ends the session:

"Stop": [{
  "hooks": [{"type": "command", "command": "pnpm test --passWithNoTests"}]
}]

The agent can't declare done until tests pass — you get a green bar without manual review.

Pattern 3: Spec first, implement in parallel. Session 1 writes a task breakdown. Sessions 2–N open worktrees, each handed one bounded task with --allowedTools "Read,Write,Bash" to prevent scope creep. Merge and review the combined diff once all branches report done.

Sources: Shipyard: Multi-agent orchestration for Claude Code, Developers Digest: Claude Code agent teams playbook, SmartScope: Claude Code advanced best practices, okhlopkov.com: Claude Code setup 2026