> ## Documentation Index
> Fetch the complete documentation index at: https://agent-harness101.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Write conflicts

> Avoid the collision by design first. Isolate with worktrees when it can't be avoided.

## The question

Say it happens anyway — two subagents both need to write to the same file. Then what?

## The answer

Avoid the collision by design first. Isolate with worktrees when it can't be avoided.

### 1 — Partition by design

Split work so no two subagents own the same mutable file.

Exactly what the previous question’s “non-conflicting” check catches before delegation happens.

### 2 — If unavoidable

Each subagent gets its own **git worktree** — a separate working directory, own branch, same repo history.

Edits in one worktree never touch files in the other while both run.

### 3 — Merge time

Reconciled through a normal **git merge** — if the changes genuinely overlap, that surfaces as an ordinary merge conflict, resolved the standard way. Not something the agents negotiate live.

### Source

[code.claude.com/docs/en/worktrees](https://code.claude.com/docs/en/worktrees) — Worktree isolation (`isolation: worktree`) is a documented, native Claude Code feature for subagents and parallel sessions — not a third-party workaround.

<Tip>
  **Design decision:** Prevent conflicts by partitioning first; never coordinate live.
</Tip>

## Continue the walkthrough

<Card title="When to delegate" icon="arrow-right" href="/subagents/when-to-delegate">
  Continue to topic 12 of 14.
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.