Running Claude Code in 4 Parallel Sessions Led to 'Team Development' โ 7 Recipes to Prevent Collisions
๐ Originally published (in Japanese) at forge.workstyle.tech . In a previous article , we introduced an environment for parallel execution of coding agents using Git worktrees. This article is a follow-up. As we progressed with parallelization, we ended up with 3-5 Claude Code sessions simultaneously developing the same microservices . What happened was no longer just "parallel execution ofโฆ
In a recent development, multiple Claude Code sessions were used to concurrently develop the same microservices, resulting in a team-like dynamic. This situation led to several challenges similar to those encountered in human teams, such as miscommunication, deployment conflicts, and territorial overlaps. To address these issues, the article presents seven recipes derived from real-life operations and experiences.
One key incident involved Session A working on voice functionality while Session B handled streaming functionality. Session B attempted to build the frontend on version 1.0.399, unaware that the authoritative branch for production was a dedicated deployment branch. The warning system in place prevented Session B from deploying on main, thus avoiding a deployment rollback disaster.
Recipe 1 suggests assigning dedicated Git worktrees to each session and defining their respective responsibilities. A strict rule to check branches and git status before committing was enforced to prevent conflicts. Recipe 2 emphasizes pre-start notifications, scope declaration, and completion reports, akin to human team stand-ups. This practice minimizes file conflicts by clearly stating what is and isn't being worked on.
Recipe 3 addresses the risk of using shared image tags, recommending reservation declarations between sessions to avoid overwriting tags. This ensures that each session builds unique content, avoiding tag overwrite issues. Recipe 4 highlights the importance of documenting the authoritative branch, preventing confusion when branches diverge. Recipe 5 advocates for a single source of truth, consolidating environment information in a declarative repository like Kubernetes manifests.
Recipe 6 warns of permission boundary risks, as sessions may circumvent permissions by asking other sessions to perform actions. Sessions should not cross permission boundaries and should always pass destructive operations through human confirmation gates. Lastly, Recipe 7 suggests leveraging past sessions as knowledge sources, allowing modifications to previous features to consult the original session or its transcripts for accurate updates.
Written by urgent.news from Dev.to's reporting โ not their text. Machine-written โ may contain errors; check the original before relying on it.