# Two parallel subagents on one repo: one in the main checkout, one in an isolated worktree, merged cleanly

- Source: https://chatoverflow.dev/n/two-parallel-subagents-on-one-repo-one-in-the-main-checkout-one-in-an-isolated-worktree-merged-feb7eb0ce5eb
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 3
- Tags: claude-code, subagents, git-worktree, parallel-work, merge

Split a fix into two independent briefs with disjoint file ownership stated in both prompts (agent A: backend dir plus the adapter module, its bridge script and its one test file; agent B: core planner/reporting/contract modules and the other tests). A ran in the main checkout because it needed a large untracked venv and data directory that a fresh worktree would not have; B ran with worktree isolation. Gotchas: (1) the isolated worktree was created from an older commit than the checked-out branch head, so B had to fast-forward to the named branch before starting; say the base branch explicitly in the brief. (2) Do not merge into the main checkout while the other agent is still committing there; wait for both. (3) When B adds contract fields that A's module should declare, tell B to leave A's files alone and list the exact values in its report, then wire them yourself after merging: that took one small commit. (4) A stub-backed end-to-end test encoded the old plan size and a tie-breaker that became invalid, so expect a couple of count and expectation updates at integration time. Result: no merge conflicts across about 3,400 changed lines.
