Generate structured teammate playbooks with file ownership and YAML interface contracts for Codex subagent teams. Produces per-teammate playbook files and a validated file_ownership.yaml. Use: /trw-team-playbook [sprint-doc-path]
Codex-specific skill: this version is authored for Codex. Follow Codex-native skill and subagent flows, and ignore Claude-only references if any remain.
Generate structured artifacts for subagents: file ownership maps, interface contracts, and per-teammate playbooks. These artifacts prevent the #1 subagents failure mode (file conflicts) and ensure consistent teammate coordination from sprint context through teammate spawn.
Read prds_relative_path from .trw/config.yaml (default: docs/requirements-aare-f/prds) to locate PRD files. Sprint docs are in the sibling sprints/active/ directory. Output artifacts go to the active run's scratch/team-playbooks/ directory.
Check $ARGUMENTS for a sprint document path:
sprints/active/ (sibling of prds_relative_path). If exactly one file exists, use it. If multiple exist, list them and ask the user to pick one.Parse the sprint doc to extract:
Build a teammate list. Each entry has:
name: lowercase hyphenated (e.g., implementer-1, tester-1, reviewer)role: one of implementer, tester, reviewer, researcherassigned_prds: list of PRD IDs this teammate is responsible forIf roles are not assigned in the sprint doc, apply these defaults based on team composition rules:
| PRD Count | Implementers | Testers | Reviewers | Total |
|---|---|---|---|---|
| 1-2 | 1 | 1 | 0 | 2 |
| 3-4 | 2 | 1 | 0 | 3 |
| 5-6 | 2 | 1 | 1 | 4 |
| 7+ | 3 | 1 | 1 | 5 |
For each assigned PRD, read the PRD file and extract:
If an execution plan exists at docs/requirements-aare-f/exec-plans/EXECUTION-PLAN-{PRD-ID}.md, read it and use its micro-task decomposition, wave plan, and file ownership mapping as the primary source for task and file assignments. This eliminates the need to re-derive file ownership from the PRD's Technical Approach section.
Group the extracted FRs by teammate based on the sprint doc's PRD assignments.
For each teammate, derive their exclusive file set:
tests/test_{module_name}.py for each src/trw_mcp/{module_name}.py.Validate zero overlap (source AND test files):
owns + test_owns from every teammate.owns OR test_owns lists.owns): STOP. Report and ask user to resolve.test_owns): STOP. Report and ask user to resolve. Common resolution: assign the test file to ONE teammate (typically the one whose PRD scope covers more of the file's test cases), and have the other teammate's tests go in a NEW test file (e.g., test_module_fr01.py and test_module_fr02.py).Also check: every source file in scope is assigned to exactly one owner. Report any unassigned files and ask the user whether to assign them or mark them as shared read-only.
Write scratch/team-playbooks/file_ownership.yaml:
# file_ownership.yaml -- generated by /trw-team-playbook