Agents
A single agent holding an entire codebase in context misses things. Focused agents with narrow context windows catch what broad agents miss — 3x fewer P0 defects. TRW ships 18 agents across four categories, each with scoped tool access and exclusive file ownership.
How it works
Agent Teams follow a delegation model. The lead decomposes work, each agent operates in isolation, and structured messages replace shared state.
- 1
Lead decomposes the work
The orchestrator reads the sprint plan and PRD execution plans, then creates tasks with explicit file ownership boundaries.
- 2
Each agent gets only what it needs
Implementers receive exclusive file sets. No agent sees another's files. Narrow context means deeper understanding per task.
- 3
Communication via structured messages
Agents exchange interface contracts and completion signals through the task system. No shared mutable state, no merge conflicts.
- 4
Lead verifies integration
Before delivery, the lead checks that all agent outputs wire together correctly. Integration gaps are caught before they ship.
> /trw-sprint-team
[Lead] Reading sprint plan: sprint-52.yaml
[Lead] PRDs to implement: PRD-CORE-064, PRD-CORE-065, PRD-QUAL-032
[Lead] Creating 3 teammate tasks with file ownership...
Task 1: impl-064 → trw-implementer-A
Files: src/scoring.py, src/models/score.py
Contract: ScoreResult dataclass, score_entry() -> ScoreResult
Task 2: impl-065 → trw-implementer-B
Files: src/retrieval.py, src/models/query.py
Contract: retrieve() accepts ScoreResult from Task 1
Task 3: test-suite → trw-tester
Files: tests/test_scoring.py, tests/test_retrieval.py
Blocked by: Task 1, Task 2
[Lead] All agents spawned. Monitoring progress...
[impl-A] Task 1 complete. Build check: PASS (142 tests, 94% coverage)
[impl-B] Task 2 complete. Build check: PASS (158 tests, 91% coverage)
[tester] Task 3 complete. 47 new tests, all passing.
[Lead] Integration check: all contracts satisfied.
[Lead] Sprint delivered. 3 PRDs, 0 integration gaps.Info
Model assignment: High-judgment roles (lead, reviewer, auditor, implementer) run on Opus for deeper reasoning. Execution-focused roles (tester, researcher, specialists) run on Sonnet for speed and cost efficiency. Model assignment is configurable per project.
Core team
The six roles that form every sprint team. The lead orchestrates while specialists handle implementation, testing, research, review, and adversarial verification. These are the only agents required — specialist roles are added when the work demands them.
| Agent | Role | Model |
|---|---|---|
| trw-lead | Team lead and orchestrator. Manages the 6-phase lifecycle, delegates work, enforces gates. Does not write production code. | Opus |
| trw-implementer | Code implementation specialist. Writes production code following TDD, honors interface contracts and file ownership. | Opus |
| trw-tester | Test specialist. Writes comprehensive tests, targets ≥90% diff coverage, parametrizes edge cases. | Sonnet |
| trw-researcher | Research specialist. Explores codebases and the web, gathers evidence, produces structured findings. | Sonnet |
| trw-reviewer | Code review specialist. Read-only, rubric-scored reviews with security auditing. | Opus |
| trw-adversarial-auditor | Adversarial spec-vs-code auditor. Verifies implementation against PRD acceptance criteria. | Opus |
Requirements specialists
Handle the PRD pipeline from drafting through quality review. Use these when you need requirements groomed to sprint-ready quality before implementation begins — they ensure completeness, traceability, and EARS compliance.
| Agent | Role | Model |
|---|---|---|
| trw-prd-groomer | Grooms PRDs to sprint-ready quality (≥0.85 completeness). | Sonnet |
| trw-requirement-writer | Drafts EARS-compliant requirements with confidence scores. | Sonnet |
| trw-requirement-reviewer | Assesses PRD quality, returns READY / NEEDS WORK / BLOCK verdict. | Sonnet |
Quality specialists
Cross-cutting roles that operate across the entire codebase rather than on specific files. Use the traceability checker after sprints to verify that PRDs, code, and tests are linked. Use the code simplifier to reduce complexity after rapid feature work.
| Agent | Role | Model |
|---|---|---|
| trw-traceability-checker | Verifies bidirectional traceability between PRDs, code, and tests. | Sonnet |
| trw-code-simplifier | Simplifies code for clarity and maintainability. | Sonnet |
Review sub-specialists
Seven focused reviewers invoked in parallel by the lead. Each checks one dimension of code quality. The /trw-review-pr skill orchestrates all seven automatically — you get correctness, integration, performance, security, spec-compliance, style, and test-quality in a single pass.
| Agent | Role | Model |
|---|---|---|
| reviewer-correctness | Verifies logic correctness and behavioral accuracy. | Sonnet |
| reviewer-integration | Checks integration points, wiring, and data flow. | Sonnet |
| reviewer-performance | Performance analysis: hotspots, allocation, complexity. | Sonnet |
| reviewer-security | Security vulnerability scanning against OWASP guidelines. | Sonnet |
| reviewer-spec-compliance | Specification compliance checking against PRD requirements. | Sonnet |
| reviewer-style | Code style, naming conventions, and formatting. | Sonnet |
| reviewer-test-quality | Test quality: coverage, assertions, edge case handling. | Sonnet |
Formation patterns
Three common team shapes. Pick the smallest formation that covers the work.
Solo + reviewer
One implementer does the work, an independent reviewer catches what they missed. The lead coordinates handoff.
When: Most common. Single-PRD features, refactors, bug fixes that touch 3-10 files.
Parallel implementers
Each implementer gets exclusive file ownership. No shared state, no merge conflicts. The lead verifies integration seams.
When: Multi-package changes where files have no overlap. API + frontend, or two independent modules.
Full sprint team
Full team with dedicated testing and review. The lead decomposes work from sprint plans and enforces gate checks at every stage.
When: PRD sprints delivering 2-4 PRDs in parallel. Quality-critical or security-sensitive work.
When to use agent teams
Agent teams add coordination overhead. Use them when the benefits outweigh the cost:
- Multi-file features — changes span 3+ files across different modules or packages
- Parallel PRDs — a sprint delivers 2+ PRDs that can be implemented concurrently
- Quality-critical work — security hardening, API migrations, or anything that benefits from independent review
- Large refactors — splitting a god module, migrating a dependency, or restructuring packages
Warning
When NOT to use teams: For single-file fixes, quick config changes, or edits touching fewer than 3 files, a solo agent session is faster. The coordination overhead of a team outweighs the benefit when there is nothing to parallelize.
Quality gates
Agent teams include automatic enforcement at every stage:
- Teammates are blocked from completing tasks until
trw_build_checkpasses - Idle agents with unfinished tasks get nudged automatically
- The lead verifies integration across all agent outputs before delivery
- Each agent performs FR-by-FR self-review before marking work complete
Tip
Lifecycle hooks: TRW runs 10+ lifecycle hooks in the background — blocking agents who skip tests, warning on missed delivery, and preserving state before context compaction. These are automatic. No configuration needed.