Pipeline Architecture
The pipeline pattern runs each phase of development in a fresh agent context, passing artifacts (not context) between stages. This maximizes context purity — each agent starts clean and focused.
Pipeline Stages
Section titled “Pipeline Stages”-
Research Agent
- Fresh context window
- Explores codebase extensively (may read 30+ files)
- Produces:
.sdlc/research/[topic].md - Context cost: high (but isolated)
-
Planning Agent
- Fresh context window
- Reads only the research summary (not raw files)
- Produces:
.sdlc/plans/[feature].md - Context cost: low
-
Implementation Agent
- Fresh context window (often in worktree)
- Reads only the plan (not research or raw files)
- Produces: code commits
- Context cost: medium
-
Review Agent
- Fresh context window
- Reads the spec + the diff
- Produces: review feedback
- Context cost: low-medium
-
Iteration Agent (if needed)
- Fresh context window
- Reads review feedback + plan
- Produces: fixes
- Context cost: low
Pipeline Implementation
Section titled “Pipeline Implementation”Using Named Sessions
Section titled “Using Named Sessions”Start each pipeline stage in a fresh agent session, passing only the output artifact from the previous stage:
# Stage 1: Research (new session)# Prompt: "Research how the auth system works. Save to .sdlc/research/auth.md"
# Stage 2: Planning (new session, fresh context)# Prompt: "Read .sdlc/research/auth.md and create implementation plan. Save to .sdlc/plans/auth-v2.md"
# Stage 3: Implementation (new session, fresh context)# Prompt: "Follow .sdlc/plans/auth-v2.md using TDD. Commit after each step."
# Stage 4: Review (new session, fresh context)# Prompt: "Review the auth-v2 branch against .sdlc/specs/auth-v2.md"Using Non-Interactive Mode
Section titled “Using Non-Interactive Mode”For tools that support non-interactive (headless) execution, run each stage as a separate invocation. See the Tool Configuration Reference for the exact syntax in your tool.
# Automated pipeline — run your agent in non-interactive mode for each stage:
# Stage 1: Research# Prompt: "Research the payment integration. Save to .sdlc/research/payments.md"
# Stage 2: Planning# Prompt: "Read .sdlc/research/payments.md. Create plan at .sdlc/plans/payments.md"
# Stage 3: Implementation# Prompt: "Implement .sdlc/plans/payments.md with TDD. Commit incrementally."# Restrict allowed tools to: Read, Write, Edit, Bash(pnpm *), Bash(git *)Information Flow
Section titled “Information Flow”The pipeline’s power comes from controlled information flow:
Raw Codebase (millions of tokens) │ ▼ [Research Agent: reads broadly]Research Summary (2,000 tokens) │ ▼ [Planning Agent: reasons about approach]Implementation Plan (1,500 tokens) │ ▼ [Implementation Agent: follows plan]Code Changes (varies) │ ▼ [Review Agent: validates against spec]Review Feedback (500 tokens)At each stage, information is compressed — the raw codebase (millions of tokens) becomes a research summary (2,000 tokens), which becomes a plan (1,500 tokens). Each downstream agent works with increasingly refined context.
When Pipeline Beats Hierarchical
Section titled “When Pipeline Beats Hierarchical”| Factor | Pipeline Wins | Hierarchical Wins |
|---|---|---|
| Task complexity | Very high | Moderate |
| Quality requirements | Critical | Standard |
| Time pressure | Can wait | Need speed |
| Human review | Between each stage | At key points |
| Context purity | Maximum | Good |
| Information preservation | Lower (lossy compression) | Higher |
Hybrid Approaches
Section titled “Hybrid Approaches”You can combine pipeline and hierarchical patterns:
Research Phase (pipeline stage 1)├── Sub-agent A: Research auth system├── Sub-agent B: Research payment system ← Hierarchical├── Sub-agent C: Research notification system within pipeline└── Combined research summary
Planning Phase (pipeline stage 2, fresh context)└── Lead agent creates unified plan
Implementation Phase (pipeline stage 3, fresh context)├── Worktree agent A: Auth changes ← Hierarchical├── Worktree agent B: Payment changes within pipeline└── Worktree agent C: Notification changes
Review Phase (pipeline stage 4, fresh context)└── Review agent checks all changes