Claude Code in 4 Git Worktrees: 23 Tasks, 9 Collisions, 1.5x Speed
Описание и применение
Запуск нескольких сессий Claude Code в отдельных git‑worktree увеличил количество реализованных задач на 1,5‑кратное, но привёл к конфликтам веток, конфликтам портов и баз данных, а также к росту времени обзора кода. После внедрения изоляции портов, единственной миграционной ветки, ограничений на редактируемые файлы и ограничения количества агентов до трёх, эффективность выросла, а количество конфликтов сократилось.
Задача
Running multiple Claude Code agents in parallel on a shared monorepo caused port conflicts, database race conditions, merge collisions, and increased human review time, limiting throughput.
Результат
Parallel Claude Code agents increased shipped tasks by 1.5x but introduced 9 branch collisions and 6.5 hours of review. After applying isolation strategies and limiting to three agents, throughput improved further with minimal collisions.
Рабочий процесс
- Create four git worktrees, each on a feature branch
- Run a Claude Code session in each worktree
- Assign tasks via prompts with file‑ownership constraints
- Agents rebase onto origin/main and run tests before reporting completion
- Merge agent branches into main manually, resolving conflicts per guidelines
- Apply conventions file for cache keys, route registration, and env vars
- Limit to three agents to stay within usage and review capacity
Доказательства
Running Claude Code in 4 git worktrees for 5 working days, I queued 23 tasks. 17 shipped, 4 needed heavy rework, 2 got thrown away.
9 of the 23 branches collided with another agent's work: 5 textual merge conflicts, 4 clean merges that broke main or staging anyway.
My throughput went from 11 shipped tasks the week before (one agent, sequential) to 17. That's 1.5x, not 4x.
I spent 6.5 hours reviewing diffs, more than any single agent spent working.
- Дата записи: 2026-09-18T16:02:48.199Z