Team Coordination Rules
These rules apply exclusively when agents operate as teammates inside an Agent Team session. They have no effect on standard single-agent or subagent workflows.
File Ownership (Critical)
Every teammate must own a distinct, non-overlapping set of files. Ownership is declared via glob patterns in the task description.
File ownership: src/api/*, src/models/*
Rules:
- Never edit a file you do not own — even for a “quick fix”
- The tester agent reads implementation files but never edits them; it owns only
tests/* - If you detect an ownership violation — your own or someone else’s — stop immediately and report to the lead
The lead resolves conflicts by restructuring tasks or absorbing the shared file directly.
Git Safety
- Prefer git worktrees — each developer agent gets its own worktree, eliminating branch conflicts entirely
- Never force-push from a teammate session
- If using a worktree, commit and push to the worktree branch, never to
mainordev - Pull before every push to catch merge conflicts early
- Commit frequently with descriptive conventional commit messages
# Each agent works in its own worktree
git worktree add ../project-feature-auth feature/auth
cd ../project-feature-auth
# Commit to worktree branch only
git commit -m "feat: add JWT validation middleware"
git push origin feature/auth
Communication Protocol
| Use case | Tool and type |
|---|---|
| Direct message to a specific teammate | SendMessage(type: "message", recipient: "alice") |
| Critical blocker affecting the whole team | SendMessage(type: "broadcast") |
| Completing a task | TaskUpdate(status: "completed") then message lead |
Additional rules:
- Always refer to teammates by name, not agent ID
- Mark a task
completedviaTaskUpdatebefore sending the completion message — never after - Include actionable findings in messages, not just “I’m done”
- Never send structured JSON in messages — plain text only
Task Claiming
- Run
TaskListto see available tasks - Claim the lowest-ID unblocked task first — earlier tasks establish context for later ones
- Set the task to
in_progressbefore beginning any work - After completing a task, run
TaskListagain to discover newly unblocked work - If all available tasks are blocked, notify the lead and offer to help unblock
Plan Approval Flow
When plan_mode_required is set on a task:
- Research your approach (read-only — no file edits)
- Submit your plan via
ExitPlanMode— this triggers an approval request to the lead - Wait for
plan_approval_response - If rejected, revise based on feedback and resubmit
- If approved, proceed with implementation
Conflict Resolution
| Situation | Action |
|---|---|
| Two agents need the same file | Escalate to lead immediately |
| Teammate’s plan rejected twice | Lead takes over the task |
| Reviewers reach conflicting findings | Lead synthesizes and documents the disagreement |
| Blocked by incomplete teammate work | Message the teammate directly first; escalate to lead if unresponsive |
Shutdown Protocol
When you receive a shutdown request:
- Extract
requestIdfrom the shutdown request JSON - Mark your current task as completed (if it is)
- Reply via
SendMessage(type: "shutdown_response")with therequestId - Only reject shutdown if you are mid-critical-operation — explain why concisely
Idle State
Going idle after sending a message is normal behavior, not an error. Idle means waiting for input. A new message from the lead or a teammate will wake the agent. Do not treat idle notifications as task completion signals — check TaskList instead.
Related Guides
- File Ownership & Conflict Resolution — deeper dive on ownership patterns and git worktree setup
- Multi-Agent Team Orchestration — how the lead coordinates the full team
- Development Rules: YAGNI, KISS, DRY — baseline rules that apply inside and outside teams