/rpi
Orchestrate the Research-Plan-Implement workflow for maximum effectiveness. Guides complex tasks through three phases, each producing a compressed artifact for the next phase.
Quick Start
/agileflow:rpiThe command assesses your task complexity and guides you through the appropriate phases.
Parameters
| Parameter | Required | Description |
|---|---|---|
TASK | No | Description of what to implement |
PHASE | No | Start at specific phase: research, plan, or implement |
SKIP_RESEARCH | No | Set true to skip research phase for simpler tasks |
The Three Phases
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ RESEARCH │ ──► │ PLAN │ ──► │ IMPLEMENT │
│ │ │ │ │ │
│ Understand │ │ Design │ │ Execute │
│ the system │ │ the change │ │ the plan │
│ │ │ │ │ │
│ Output: │ │ Output: │ │ Output: │
│ research.md │ │ plan.md │ │ code + tests│
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
NEW CONVERSATION NEW CONVERSATION DONE
Each phase produces a compressed artifact for the next phase. Start a new conversation between phases to maintain fresh context.
Complexity Scaling
The command assesses task complexity and determines which phases to use:
| Complexity | Signs | Approach |
|---|---|---|
| Trivial | Typo, config tweak | Just do it |
| Simple | Single file, clear path | Plan → Implement |
| Moderate | Multi-file, known patterns | Plan → Implement |
| Complex | Brownfield, unfamiliar code | Research → Plan → Implement |
| Exploratory | Unknown territory, multi-repo | Full RPI with iteration |
Usage Examples
Quick assessment
/agileflow:rpiAsks you to describe the task, assesses complexity, suggests approach.
Specific task
/agileflow:rpi TASK="Add OAuth 2.0 authentication to API"Analyzes the task and determines which phases to run.
Skip research (simple task)
/agileflow:rpi TASK="Fix typo in README" SKIP_RESEARCH=trueGoes directly to plan and implement phases.
Start at specific phase
/agileflow:rpi PHASE=implement TASK="Implement from the plan"Assumes previous phases are complete, starts implementation.
Phase Details
Phase 1: Research
When to use: Complex work in unfamiliar areas
Workflow:
- Generate research prompt
- You paste it to external AI (ChatGPT, Claude web, Perplexity)
- Get back research results
- Save research artifact
- Transition to plan phase
Output: docs/10-research/YYYYMMDD-topic.md
- Exact files and line numbers that matter
- How the system actually works (from code inspection)
- Key patterns and constraints discovered
- Risks and edge cases identified
Phase 2: Plan
When to use: Before implementing anything
Workflow:
- Reference research artifact (if exists)
- Use plan mode for read-only exploration
- Design implementation approach
- Save plan artifact
- Get user approval
- Transition to implement phase
Output: .claude/plans/[slug].md
- Exact steps with file paths and line numbers
- Actual code snippets (not pseudocode)
- Testing strategy per change
- Edge cases and risks
Plan quality is LEVERAGE:
- Bad plan = 100+ bad lines of code
- Good plan = smooth implementation
- Take time to get it right
Phase 3: Implement
When to use: Following the plan
Workflow:
- Reference plan artifact
- Execute step-by-step
- Test after each change
- Follow plan exactly (don't deviate)
- Mark story complete
Output: Code + tests
- Implementation follows plan exactly
- Tests passing
- Stories marked complete
Context Health Warning
If conversation grows too large, the command warns:
⚠️ Context Health Warning
This conversation has grown significantly.
We may be approaching the "dumb zone" where quality degrades.
Current phase: [phase]
Recommendation: Complete phase and start fresh
The "dumb zone" is 70%+ context utilization where performance degrades significantly.
The Dumb Zone
Context utilization affects performance:
| Utilization | Zone | Performance |
|---|---|---|
| 0-40% | Smart Zone | Full reasoning capability |
| 40-70% | Diminishing Returns | Reduced quality |
| 70%+ | Dumb Zone | Significant degradation |
Signs you're in the Dumb Zone:
- Agent makes obvious mistakes
- Responses become repetitive
- Less accurate tool calls
- Loss of context awareness
Solution: Complete current phase, save artifact, start fresh.
Output Format
Phase Transition
At the end of each phase:
---
## Phase Complete: [PHASE_NAME]
**Artifact saved**: `[path/to/artifact.md]`
### Key Findings Summary
- [3-5 bullet points]
### Recommended Next Step
Start a **new conversation** with this context:
> I need to [NEXT_PHASE] based on the [ARTIFACT_TYPE] at `[path]`.
>
> [Brief summary of artifact content]
**Why new conversation?** Fresh context window starts in the "smart zone"
(<40% utilization). The artifact compresses all previous understanding.
---
Examples
Complex Feature Implementation
Task: Add OAuth 2.0 authentication to multi-tenant SaaS API
Assessment: Complex (brownfield, unfamiliar OAuth patterns)
→ Use: Research → Plan → Implement
Phase 1: Research
✓ Understand OAuth 2.0 flow
✓ Check current auth implementation
✓ Identify integration points
→ Save research artifact
Phase 2: Plan
✓ Design OAuth integration approach
✓ Plan changes step-by-step
✓ Get approval
→ Save plan artifact
Phase 3: Implement
✓ Add OAuth library
✓ Create login endpoint
✓ Add token storage
✓ Update middleware
✓ Write tests
→ Tests pass, story complete
Simple Bug Fix
Task: Fix authentication timeout issue
Assessment: Simple (single file, known pattern)
→ Use: Plan → Implement (skip research)
Phase 1: Plan
✓ Understand current timeout logic
✓ Plan fix
→ Save plan artifact
Phase 2: Implement
✓ Update timeout value
✓ Test change
→ Tests pass, done
Leverage Math
Bad line of code = 1 bad line
Bad part of plan = 100+ bad lines
Bad line of research = entire direction is hosed
Human review focus should be on highest leverage:
- Research quality - Is our understanding correct?
- Plan quality - Are these the right steps?
- Code quality - Implementation details
Best Practices
- Assess complexity first - Don't skip phases for complex work
- Complete research - Understand system before planning
- Get plan approval - Don't implement without consensus
- Start fresh between phases - New conversation preserves context
- Follow plan exactly - Don't deviate during implementation
- Monitor context health - Complete phase before hitting 70%
Integration
RPI works with other commands:
- Research:
/agileflow:research:askgenerates prompts - Planning:
EnterPlanModefor read-only exploration - Implementation:
/agileflow:babysitfor interactive guidance - Documentation:
/agileflow:adrto document decisions
Related Commands
/research:ask- Generate research prompts/research:import- Save research artifacts/babysit- Interactive implementation mentor/adr- Document architectural decisions
On This Page
/rpiQuick StartParametersThe Three PhasesComplexity ScalingUsage ExamplesQuick assessmentSpecific taskSkip research (simple task)Start at specific phasePhase DetailsPhase 1: ResearchPhase 2: PlanPhase 3: ImplementContext Health WarningThe Dumb ZoneOutput FormatPhase TransitionExamplesComplex Feature ImplementationSimple Bug FixLeverage MathBest PracticesIntegrationRelated Commands