Add multi-agent isolation strategy using git worktrees#2
Conversation
Define org-wide rules for running multiple AI agents concurrently without conflicts: one worktree per agent, no overlapping file ownership, tool-specific setup for Claude Code/Copilot/Codex/Cursor, naming conventions, cleanup, and a pre-launch coordination checklist. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a "Multi-Agent Isolation — Git Worktrees" section to AGENTS.md specifying mandatory per-agent isolated workspaces, strict one-agent-per-story/task mapping, rules for branching and PRs, worktree naming conventions, tool-specific setup snippets, dependency handling, cleanup, and a human coordination checklist. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds organization-level guidance to standardize how multiple AI agents (and humans) work concurrently in the same repo by using isolated workspaces—primarily Git worktrees—to prevent conflicting changes and overlapping file edits.
Changes:
- Adds a new “Multi-Agent Isolation — Git Worktrees” policy section with 6 core rules for concurrent agent work.
- Documents tool-specific setup patterns (Claude Code, Copilot coding agent, Codex, Cursor, manual worktrees).
- Provides naming, environment/dependency, cleanup, and coordination checklist guidance.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@AGENTS.md`:
- Line 148: Add a short subsection to AGENTS.md after the existing rule 3 that
provides concrete guidance and lightweight tooling steps for detecting
file-overlap violations before running agents in parallel: create a "Detecting
File Overlap" heading and list quick checks such as reviewing each story's
acceptance criteria and implementation scope, using git commands like git log
--stat (or equivalent) to surface files touched by recent similar changes, and
fallback options (run stories sequentially or consult the team) to handle
uncertainty; ensure the new text is concise, actionable, and explicitly
recommends serializing stories if any overlap is detected.
- Around line 201-206: The fenced code block that lists files for the
.worktreeinclude entry is missing surrounding blank lines and a language
specifier; update the block showing ".env" and ".env.local" (the
.worktreeinclude example) to be a properly fenced block with a language token
(e.g., ```text) and ensure there is a blank line before and after the fenced
block so the list item and the following sentence ("After entering a
worktree...") render correctly.
- Around line 212-216: The markdown code block in AGENTS.md is missing
surrounding blank lines and the closing fence is malformed; update the section
that lists the cleanup commands so the fenced code block uses an opening fence
with language "```bash" on its own line, the two commands on separate lines, and
a closing "```" on its own line with a blank line before and after the block
(locate the snippet containing "git worktree remove <worktree-path>" / "git
branch -d <branch-name>" to apply the fix).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
…arity - Add "Detecting File Overlap" subsection per CodeRabbit suggestion - Reword origin/HEAD to reference default branch explicitly (Copilot) - Qualify "name flows into branch" for manual worktrees (Copilot) - Quote isolation: "worktree" consistently in YAML example (Copilot) - Add git branch -D fallback for squash/rebase merges (Copilot) - Fix markdown blank lines and language specifiers (CodeRabbit) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Why
Multiple agents working on the same repo were creating conflicting branches and stepping on each other's changes. Git worktrees are the industry-standard isolation primitive used by Claude Code, Cursor, Windsurf, Augment Intent, and dmux. This codifies the strategy so all agents and contributors follow the same rules.
Key rules
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
.gitignorerecommendations, and a human coordination checklist.