Worktrees are isolation, not magic merge conflict prevention. Start each task from the right branch, give tasks non-overlapping ownership where possible, and review the handoff before bringing changes back into your local checkout.
1. Confirm the project is a Git repository and choose the correct base branch
Confirm the repository is clean enough to branch and identify the exact base commit or branch. Starting parallel work from different unseen states makes later comparison and integration unreliable.
2. Start a Codex chat in a worktree for one self-contained task
Create one worktree per self-contained task and give it a descriptive branch name. Each worktree should have a clear owner, scope and expected test command before Codex begins editing.
3. Keep the task scoped so another parallel worktree does not own the same files
Partition file ownership where possible. If two tasks must touch the same core file, treat them as integration-dependent rather than pretending they are fully parallel.
4. Run tests inside the worktree and review its diff before handoff
Run the relevant tests inside each worktree and inspect its diff independently. A passing sibling worktree says nothing about this branch because dependencies and edits are isolated.
5. Move or merge the work back deliberately, then clean up stale managed worktrees
Integrate deliberately with merge/rebase/cherry-pick according to the repository policy, rerun combined tests, then remove stale worktrees only after the integrated result is safe.
Create this task in a separate worktree from [base branch]. Scope ownership: [files/module]. Do not edit [overlap area]. Run [tests] inside the worktree. Before handoff, summarize commits, uncommitted changes, conflicts you expect and the safest integration path.
Starting from the wrong branch; two worktrees changing the same shared file set; assuming detached HEAD behavior is a normal feature branch; handing off without tests; leaving permanent worktrees and stale dependencies indefinitely.
Finish check
Each parallel task has an isolated checkout, tests run in its own environment, the diff is understandable, and integration back to the main checkout is deliberate rather than accidental.