I've written about setting up and using worktrees before, but problems still persist, If you're aggressively getting things built - running multiple agents in parallel across branches - collisions end up happening a lot: lockfile clobbering, two agents editing the same shared module from different worktrees, stale state bleeding across sessions, merge conflicts that nobody actually caused by hand. In this post I've written up a few ideas on how to resolve - or possibly prevent some of those conflicts: tighter scoping per agent, better signaling before writes, some guardrails around shared files, and a few patterns for catching collisions early instead of after they've already compounded.
Anyway, blagh blagh blagh, here's the post. Give it a read. Got other ideas? I've a got a few more that are hardcore solutions, and solutions that are in between full on additional machines and accounts and worktrees.
https://compositecode.blog/2026/11/02/agent-collisions-beyond-worktrees/
AI agent collisions: Worktrees aren’t enough
compositecode.blog