Agentic Workflow Pattern
Standard multi-agent pipeline for implementation tasks.
Architecture Principles
- Use
run_in_background: truefor all agents to keep main context minimal - Use
Tasktool (neverTaskOutput) to avoid receiving full agent transcripts - Agents write outputs to
.claude/cache/agents/<stage>/for injection into subsequent agents - Main conversation is pure orchestration — no heavy lifting, only coordination
Workflow Stages
1. Research Agent
- Enforce NIA as the research layer
- Output: Research findings
2. Planning Agent
- Receives: Research agent output as context
- Output: Implementation plan
3. Validation Agent
- Reviews plan against research
- Output: Validated plan with amendments
4. Implementation Agent
- Receives: Validated plan + research context
- TDD: Failing tests first
- Output: Implementation + tests
5. Review Agent
- Cross-references all artifacts
- Confirms tests pass
- Output: Review summary
Agent Progress Monitoring
Stuck detection:
- Progress reminders stop arriving
- Task output file size stops growing
- Expected output file not created after reasonable time
Directory Structure
Key Rules
- Never use TaskOutput - floods context with 70k+ token transcripts
- Always run_in_background=true - isolates agent context
- File-based handoff - each agent reads previous agent's output file
- Poll, don't block - check file system for outputs, don't wait
- TDD in implementation - failing tests first, then make them pass
Source
- Session 2026-01-01: SDK Phase 3 implementation using this pattern


