Skip to content

Agent Teams - Parallel AI Coding with File Ownership Isolation

Large tasks leverage Claude Code’s Agent Teams feature (TeamCreate) to spawn multiple Builder teammates that code in parallel. Each Builder receives isolated file ownership, preventing conflicts.

Agent Teams is an experimental Claude Code feature that requires an environment variable to enable:

{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}

Add this to the "env" section of ~/.claude/settings.json.

When /ccg:go selects the full-collaborate strategy, the implementation phase automatically spawns Agent Teams:

full-collaborate strategy:
Phase 1-3: Analysis + Plan + HARD STOP
Phase 4: ← Agent Teams triggered here
→ TeamCreate Builder-1 (owns auth/ module)
→ TeamCreate Builder-2 (owns api/ module)
→ TeamCreate Builder-3 (owns tests/)
Phase 5-6: Quality gates + Review

Core rule: Each file can only be modified by one Builder at a time.

The engine generates a file ownership matrix during Phase 3 (planning):

Builder-1: src/auth/jwt.ts, src/auth/middleware.ts
Builder-2: src/api/routes.ts, src/api/controllers.ts
Builder-3: tests/auth.test.ts, tests/api.test.ts

Each Builder’s prompt explicitly states: “Only modify your assigned files. Do not expand scope.”

The subagent-context.js hook automatically injects the following into each Builder during TeamCreate:

  • The task plan (plan.md)
  • Project coding standards (relevant files from .ccg/spec/)
  • The file scope assigned to that Builder
  • Interface contracts (how Builders coordinate with each other)
Main Claude (Lead)
├── spawn Builder-1 → reports on completion
├── spawn Builder-2 → reports on completion
└── spawn Builder-3 → reports on completion
← Wait for all Builders to finish
└── Converge: review + integrate + quality gates

Every Builder’s prompt includes the following hard constraints (auto-injected by the engine):

  1. Only modify assigned files — Cannot touch files outside the ownership matrix
  2. No scope expansion — Must not “discover” new requirements and implement them
  3. Must report verification commands — After completion, output a command that verifies the changes

In v3.0, Agent Teams are automatically managed by /ccg:go’s full-collaborate strategy.

Legacy mode provides 4 standalone Team commands for manual control over each phase:

Legacy CommandCorresponds to full-collaborate Phase
/ccg:team-researchPhase 1-2 (Analysis)
/ccg:team-planPhase 3 (Planning)
/ccg:team-execPhase 4 (Parallel implementation)
/ccg:team-reviewPhase 5-6 (Review)

Agent Teams are ideal for:

  • Feature development spanning 3+ independent modules
  • Tasks requiring 2+ parallel workflows
  • Large tasks with more than 10 total steps
  • Low coupling between files, allowing parallel modification

Not recommended for:

  • Highly coupled single-file modifications
  • Migrations requiring strict sequential execution
  • Simple bug fixes