Agent Team Coordination Conventions
Standards for coordinating agent teams — multiple Claude Code instances working in parallel on a shared task.
File Ownership
The #1 risk with agent teams is overwrite conflicts. Prevent them with strict file ownership:
- One teammate per file set: Each teammate owns a distinct set of files. No two teammates edit the same file.
- Ownership by layer: Backend files → backend teammate. Frontend files → frontend teammate. Test files → test teammate.
- Claim files in task description: When creating tasks, list the specific files or directories the teammate will modify.
- If ownership is ambiguous: The team lead decides. When in doubt, the lead owns the file.
Ownership Mapping by Directory
| Directory |
Owner |
Responsibility |
backend/app/models/ |
Backend teammate |
Model definitions, validations, scopes |
backend/app/controllers/ |
Backend teammate |
Controller actions, params, responses |
backend/app/services/ |
Backend teammate |
Business logic service objects |
backend/app/serializers/ |
Backend teammate |
Panko serializers |
backend/app/components/ |
Backend teammate (or Phlex teammate) |
Phlex view components |
backend/db/migrate/ |
Backend teammate |
Database migrations |
backend/spec/ |
Test teammate (or backend teammate) |
RSpec tests |
mobile/src/ |
Mobile frontend teammate |
React Native screens, hooks, stores |
web/src/ |
Web frontend teammate |
Vite SPA pages, components, hooks |
next/app/, next/src/ |
Web frontend teammate |
Next.js pages, components, actions |
terraform/ |
Infrastructure teammate |
Terraform modules and configs |
Task Sizing
- 5-6 tasks per teammate: Enough to be meaningful, not so many that coordination overhead dominates.
- Each task should take 10-30 minutes: If a task is larger, break it down further.
- Tasks should be independently completable: A teammate should be able to finish a task without waiting on others.
- Dependencies go in task metadata: Use
blockedBy to express sequential dependencies.
Task Description Quality
Every task must include:
- What to implement — specific behavior or output expected
- Which files to modify — explicit file paths or directory scope
- Acceptance criteria — how to know the task is done
- Constraints — any patterns, libraries, or conventions to follow
Worktree Isolation
For teams making parallel edits:
- Use
isolation: "worktree" when spawning teammates via the Agent tool
- Each teammate gets an isolated copy of the repository
- Changes are committed to separate branches and merged by the lead
- This eliminates file conflict risk entirely at the cost of merge complexity
When to Use Worktrees
| Scenario |
Use Worktree? |
Reason |
| Teammates edit different directories |
No |
File ownership is sufficient |
| Teammates might touch shared files |
Yes |
Prevents conflicts |
| Quick review/audit tasks |
No |
Read-only work has no conflict risk |
| Large refactoring across many files |
Yes |
Safety net for broad changes |
Communication Protocol
Team Lead Responsibilities
- Create the team and task list before spawning teammates
- Assign tasks with clear ownership and acceptance criteria
- Monitor progress via TaskList — reassign blocked tasks
- Review teammate outputs before synthesizing final deliverables
- Shut down teammates gracefully when all work is complete
Teammate Responsibilities
- Check TaskList after completing each task for the next assignment
- Send a message to the lead when blocked or when a task is complete
- Never edit files outside your assigned scope
- Mark tasks completed only when quality gates pass (hooks enforce this)
Dynamic Spawning Triggers
Suggest creating a team when:
- Cross-layer work: Task touches backend + frontend + tests (3+ layers)
- Multi-dimensional review: "Review this PR for security, architecture, and test coverage"
- Multiple independent deliverables: "Build the API, web page, and mobile screen for user profiles"
- Explicit parallelism: User says "in parallel", "simultaneously", "at the same time"
- Large scope: Task would take a single agent more than 1 hour of work
Do NOT Suggest Teams For
- Simple bug fixes or single-file changes
- Pure research or exploration tasks
- Tasks with tight sequential dependencies (output of step 1 is input to step 2)
- Tasks the user wants done quickly (team setup has overhead)
Quality Gates
Two hooks enforce team quality automatically:
TeammateIdle (teammate-idle-checker.py)
- Checks that modified source files exist when the task implies code changes
- Verifies test files accompany modified source files
- Exit code 2 sends feedback to keep the teammate working
TaskCompleted (task-completed-checker.py, team-task-validator.py)
- Validates uncommitted source files are committed
- Checks for basic linting issues (trailing whitespace)
- Verifies test deliverables if the task mentions testing
- Exit code 2 rejects the completion with feedback
1---2name: std-agent-teams3description: Agent team coordination conventions — file ownership, task sizing, worktree isolation, dynamic spawning, quality gates. Use when coordinating multi-agent teams.4---56# Agent Team Coordination Conventions78Standards for coordinating agent teams — multiple Claude Code instances working in parallel on a shared task.910## File Ownership1112The #1 risk with agent teams is overwrite conflicts. Prevent them with strict file ownership:1314- **One teammate per file set**: Each teammate owns a distinct set of files. No two teammates edit the same file.15- **Ownership by layer**: Backend files → backend teammate. Frontend files → frontend teammate. Test files → test teammate.16- **Claim files in task description**: When creating tasks, list the specific files or directories the teammate will modify.17- **If ownership is ambiguous**: The team lead decides. When in doubt, the lead owns the file.1819### Ownership Mapping by Directory2021| Directory | Owner | Responsibility |22|-----------|-------|---------------|23| `backend/app/models/` | Backend teammate | Model definitions, validations, scopes |24| `backend/app/controllers/` | Backend teammate | Controller actions, params, responses |25| `backend/app/services/` | Backend teammate | Business logic service objects |26| `backend/app/serializers/` | Backend teammate | Panko serializers |27| `backend/app/components/` | Backend teammate (or Phlex teammate) | Phlex view components |28| `backend/db/migrate/` | Backend teammate | Database migrations |29| `backend/spec/` | Test teammate (or backend teammate) | RSpec tests |30| `mobile/src/` | Mobile frontend teammate | React Native screens, hooks, stores |31| `web/src/` | Web frontend teammate | Vite SPA pages, components, hooks |32| `next/app/`, `next/src/` | Web frontend teammate | Next.js pages, components, actions |33| `terraform/` | Infrastructure teammate | Terraform modules and configs |3435## Task Sizing3637- **5-6 tasks per teammate**: Enough to be meaningful, not so many that coordination overhead dominates.38- **Each task should take 10-30 minutes**: If a task is larger, break it down further.39- **Tasks should be independently completable**: A teammate should be able to finish a task without waiting on others.40- **Dependencies go in task metadata**: Use `blockedBy` to express sequential dependencies.4142### Task Description Quality4344Every task must include:451. **What to implement** — specific behavior or output expected462. **Which files to modify** — explicit file paths or directory scope473. **Acceptance criteria** — how to know the task is done484. **Constraints** — any patterns, libraries, or conventions to follow4950## Worktree Isolation5152For teams making parallel edits:53- Use `isolation: "worktree"` when spawning teammates via the Agent tool54- Each teammate gets an isolated copy of the repository55- Changes are committed to separate branches and merged by the lead56- This eliminates file conflict risk entirely at the cost of merge complexity5758### When to Use Worktrees5960| Scenario | Use Worktree? | Reason |61|----------|--------------|--------|62| Teammates edit different directories | No | File ownership is sufficient |63| Teammates might touch shared files | Yes | Prevents conflicts |64| Quick review/audit tasks | No | Read-only work has no conflict risk |65| Large refactoring across many files | Yes | Safety net for broad changes |6667## Communication Protocol6869### Team Lead Responsibilities70- Create the team and task list before spawning teammates71- Assign tasks with clear ownership and acceptance criteria72- Monitor progress via TaskList — reassign blocked tasks73- Review teammate outputs before synthesizing final deliverables74- Shut down teammates gracefully when all work is complete7576### Teammate Responsibilities77- Check TaskList after completing each task for the next assignment78- Send a message to the lead when blocked or when a task is complete79- Never edit files outside your assigned scope80- Mark tasks completed only when quality gates pass (hooks enforce this)8182## Dynamic Spawning Triggers8384Suggest creating a team when:85861. **Cross-layer work**: Task touches backend + frontend + tests (3+ layers)872. **Multi-dimensional review**: "Review this PR for security, architecture, and test coverage"883. **Multiple independent deliverables**: "Build the API, web page, and mobile screen for user profiles"894. **Explicit parallelism**: User says "in parallel", "simultaneously", "at the same time"905. **Large scope**: Task would take a single agent more than 1 hour of work9192### Do NOT Suggest Teams For93- Simple bug fixes or single-file changes94- Pure research or exploration tasks95- Tasks with tight sequential dependencies (output of step 1 is input to step 2)96- Tasks the user wants done quickly (team setup has overhead)9798## Quality Gates99100Two hooks enforce team quality automatically:101102### TeammateIdle (`teammate-idle-checker.py`)103- Checks that modified source files exist when the task implies code changes104- Verifies test files accompany modified source files105- Exit code 2 sends feedback to keep the teammate working106107### TaskCompleted (`task-completed-checker.py`, `team-task-validator.py`)108- Validates uncommitted source files are committed109- Checks for basic linting issues (trailing whitespace)110- Verifies test deliverables if the task mentions testing111- Exit code 2 rejects the completion with feedback