// engine/universal-rules/rules/agent-teams.ts — SPEC-779
// Universal rule: Agent Teams (migrated from rules-generator.ts)
function buildBody() {
    return `# Agent Teams (MANDATORY when 3+ specs in parallel)

This rule file is auto-generated by Planu \`init_project\`. Do not edit manually — re-run \`init_project\` to update.

## When to Use Agent Teams

Use Agent Teams when ALL of the following apply:
- 3+ independent specs are ready to implement simultaneously
- Estimated total effort > 8h
- Specs touch different modules/packages (clear file ownership boundaries)
- Monorepo or multi-layer architecture with well-defined interfaces

## File Ownership (MANDATORY)

**Two teammates MUST NEVER modify the same file.** This is non-negotiable.

- \`plan_team_distribution\` auto-assigns exclusive file ownership per agent
- Review the distribution before spawning — resolve any conflicts first
- If two specs require the same shared file, implement them sequentially, not in parallel

## Workflow

\`\`\`
1. plan_team_distribution   # input: spec IDs → output: file ownership map
2. generate_teammate_prompt # input: teammate assignment → output: isolated prompt
3. spawn N agents           # claude -p "<prompt>" for each teammate (run in parallel)
4. validate_team_results    # input: projectPath → verifies merged code integrity
\`\`\`

## Available Team Patterns

- **implement-and-test** — one agent implements, another writes tests (zero shared files)
- **full-stack** — frontend and backend agents with a contract-first API boundary
- **research-then-build** — researcher gathers context first, builder implements after
- **parallel-specs** — N agents implement N fully independent specs simultaneously

## Quick Reference

| Goal | Tool |
|------|------|
| Plan team distribution | \`plan_team_distribution\` with spec IDs array |
| Get teammate context | \`generate_teammate_prompt\` with assignment object |
| Validate merged result | \`validate_team_results\` after all agents complete |

## Prohibited Patterns

- NEVER spawn teammates without running \`plan_team_distribution\` first
- NEVER assign the same file to two different teammates
- NEVER skip \`validate_team_results\` after parallel implementation
- NEVER use Agent Teams for 1-2 specs — sequential is faster and safer
`;
}
export const agentTeamsRule = {
    id: 'agent-teams',
    name: 'Agent Teams',
    description: 'Mandatory rules for parallel spec implementation using Agent Teams.',
    category: 'workflow',
    applicableHosts: ['all'],
    defaultEnabled: true,
    buildContent: (_host) => buildBody(),
};
//# sourceMappingURL=agent-teams.js.map