Research, Plan, Implement (RPI)
Youâve been there. You ask an AI to ârefactor this authentication moduleâ and it generates 500 lines of code using libraries you donât have, invents methods that donât exist, and solves a problem you didnât actually have. Three hours later, youâre untangling hallucinations and wondering if you should have just done it yourself.
The AI isnât broken. Youâre asking it to read your mind without giving it structure.
RPI (Research â Plan â Implement) fixes this. Instead of jumping straight to code generation, you break work into three focused phases with built-in validation. The AI researches what exists, plans the change systematically, then executes mechanically. Itâs slower than âjust do itââand thatâs the point.
The problem with direct prompting
Section titled âThe problem with direct promptingâWhen you ask an AI agent to implement something without structure, youâre gambling on several things going right simultaneously:
- The AI correctly understands your intent
- It discovers all relevant code and patterns
- It makes architectural decisions youâd agree with
- It doesnât hallucinate APIs or libraries
- It stays within scope
What actually happens:
- Context overflow: With too much information, AI loses focus.
- Hallucination: AI invents code that doesnât exist.
- Wrong problem solved: AI misunderstands your requirements.
- Scope creep: Work expands beyond intended boundaries.
- Untestable code: You have no clear success criteria.
The insight: without structure, even brilliant AI assistants become expensive random code generators.
What RPI actually is
Section titled âWhat RPI actually isâRPI is a three-phase framework with validation gates between each phase. Think of it as turning your AI from an eager intern into a seasoned developer with a GPS.
The phases:
- Research: Build context. Document what exists todayâno opinions, no suggestions.
- Plan: Design the change. Use a phased approach with atomic tasks and success criteria.
- Implement. Execute mechanically. Follow the plan, and verify after each phase.
Core principles:
- One goal per session: Keep the LLM laser-focused.
- Validation before progression: Use scoring scales to verify readiness.
- Human judgment preserved: AI doesnât make big decisions without validation.
- Context management: Start with a fresh session for each phase.
The framework trades speed for clarity, predictability, and correctness. Youâll spend more time upfront, but youâll spend far less time debugging hallucinations and fixing architectural mistakes.
Phase 1: Research
Section titled âPhase 1: ResearchâThe research phase builds context and insight. Youâre documenting what exists todayânothing more.
Strict rules:
- Document what exists
- Do NOT suggest changes
- Do NOT critique
- Do NOT plan
- Base everything on facts, not assumptions
In goose:
/research "look through the codebase and research howthe LLM Tool Discovery is implemented"This spawns three parallel sub-agents:
| Sub-agent | Purpose |
|---|---|
find_files | Uses codebase locator to find relevant files |
analyze_code | Reads files fully and documents how they work |
find_patterns | Looks for similar features or conventions in repo |
Output: A structured research document at thoughts/research/YYYY-MM-DD-HHmm-topic.md
The document includes git metadata, file and line references, flow descriptions, key components, open questions, and a technical map of the feature as it exists today.
Reverse prompting
Section titled âReverse promptingâHereâs where things get interesting. Instead of you explaining everything upfront, the AI asks you clarifying questions one at a time:
- âShould this work from the file manager or dashboard?â
- âAny file type restrictions?â
- âWhat happens to shared files?â
This reveals insights you hadnât considered, and prevents wrong assumptions from propagating through the entire workflow.
Validating research: the FAR scale
Section titled âValidating research: the FAR scaleâBefore moving to planning, validate your research against FAR criteria:
| Criterion | Description | What it prevents |
|---|---|---|
| Factual | Based on actual code, not assumptions | Hallucination |
| Actionable | You know exactly what to build | Vague requirements |
| Relevant | Solves the real user need | Wrong problem solved |
Critical: A human must review the research document before proceeding. This informs everything downstream.
Phase 2: Plan
Section titled âPhase 2: PlanâThe planning phase translates research into a phased implementation plan. Youâre designing the change with clear success criteria.
In goose:
/plan a removal of the Tool Selection Strategy featureAIâs Process:
- Read the research document from the previous phase
- Ask clarifying questions (full removal vs deprecation? config cleanup behavior?)
- Present design options where multiple approaches exist
- Produce a phased implementation plan
Output: A detailed plan at thoughts/plans/YYYY-MM-DD-HHmm-description.md
The plan includes:
- Explicit phases (e.g., 10 phases)
- Exact file paths
- Code snippets showing what to change
- Automated success criteria
- Manual verification steps
- Checkboxes for tracking progress
- Atomic tasks per phase
Why atomic tasks matter
Section titled âWhy atomic tasks matterâEach task should be a single, focused unit of workâone command call or file edit. This keeps the AI on track with simple instructions, makes progress easy to verify, prevents context overflow, and allows recovery if the context window fills.
The plan must be explicit enough that someone else (or a fresh AI session) could execute it without additional context.
Validating plans: the FACTS scale
Section titled âValidating plans: the FACTS scaleâValidate each task against FACTS criteria:
| Criterion | Description | What it prevents |
|---|---|---|
| Feasible | Can actually be done with available tools/APIs | Impossible tasks |
| Atomic | Single, focused unit of work | Context overflow, scope creep |
| Clear | Unambiguous instructions | Misinterpretation |
| Testable | Has clear success criteria | Untestable code |
| Scoped | Properly bounded | Runaway execution |
Phase 3: Implement
Section titled âPhase 3: ImplementâThe implementation phase executes the plan step-by-step with verification. This should feel intentionally boring and mechanical. If it feels creative, something upstream is missing.
In goose:
/implement thoughts/plans/2025-12-23-remove-tool-selection-strategy.mdAIâs Process:
- Read the plan completely
- Execute phases in order
- Run verification after each phase
- Update checkboxes directly in the plan file as you go
Feedback loop options
Section titled âFeedback loop optionsâChoose your control level based on confidence in the plan:
| Loop type | When to use | Control level |
|---|---|---|
| Task-by-task validation | Maximum control needed | Highâvalidate after each atomic task |
| Phase-by-phase validation | Balance speed and control | Mediumâvalidate after completing phase |
| Full plan validation | High confidence in plan | Lowâexecute everything, validate at the end |
Verification gates
Section titled âVerification gatesâEvery phase must pass quality gates:
- Tests must pass
- Builds must succeed
- Linters must pass
- No regressions introduced
If any gate fails, the implementation pauses. Fix the issue before proceeding.
Recovery mechanism
Section titled âRecovery mechanismâIf the context window fills mid-implementation, the checkboxes in the plan allow the AI to compact and pick up exactly where it left off. This is why atomic tasks and progress tracking matterâthey enable graceful recovery.
Optional: Iterate
Section titled âOptional: IterateâSometimes plans need adjustment after review or during implementation.
In goose:
/iterate "plan path" + feedbackAIâs Process:
- Read the existing plan
- Research only what needs rethinking
- Propose targeted updates
- Edit the plan surgically (doesnât start over)
This enables refinement without discarding good work. Changed sections must pass FACTS validation again.
File structure
Section titled âFile structureâAll RPI outputs live in predictable locations:
thoughts/âââ research/â âââ YYYY-MM-DD-HHmm-topic.mdâââ plans/ âââ YYYY-MM-DD-HHmm-description.mdA Real-world example
Section titled âA Real-world exampleâLetâs walk through an actual RPI execution: removing the âTool Selection Strategyâ feature from a large codebase.
Complexity:
- Spans 32 files
- Touches Rust core code
- Affects TypeScript
- Changes configuration
- Modifies tests
- Updates documentation
Research phase (9 minutes)
Section titled âResearch phase (9 minutes)âStarted with /research "LLM Tool Discovery". Realized scope was too broadâcourse corrected and reran: /research "Tool Selection Strategy feature specifically".
Output: detailed technical map of the feature.
Human review: validated research accuracy before proceeding.
Plan phase (4 minutes)
Section titled âPlan phase (4 minutes)âRan /plan a removal of the Tool Selection Strategy feature.
AI asked clarifying questions:
- Full removal vs deprecation?
- How should config cleanup behave?
- Should artifacts be regenerated?
- Where do related tests live?
Presented design options. Generated 10-phase plan with atomic tasks.
Human review: validated plan feasibility.
Implement phase (39 minutes)
Section titled âImplement phase (39 minutes)âRan /implement thoughts/plans/2025-12-23-remove-tool-selection-strategy.md.
AI executed mechanically phase by phase. Context window filled mid-wayâAI compacted and resumed from checkboxes.
Human activity during this phase: âI fell asleep.â Intentionally boring and reliable.
Results
Section titled âResultsâ- Total time: 52 minutes (including AI work, testing, human Q&A)
- PR submitted: Build passed on first try
- Code review agent: Zero comments
- Quality: Top-notch
Comparison:
| Approach | Outcome |
|---|---|
| Without AI | Several hours of manual work |
| AI without RPI | Drift, bugs, rework cycles |
| RPI | Slower than direct implementation, but predictable and correct |
When to use RPI
Section titled âWhen to use RPIâIdeal scenarios
Section titled âIdeal scenariosâComplex tasks spanning multiple files:
- Refactors
- Migrations
- Feature additions
- Large upgrades
- Incident cleanup
- Documentation overhauls
Characteristics that signal RPI is worth it:
- Complex integration
- Multiple touchpoints
- High consequences of errors
- Need for systematic approach
- Require clear validation
When to skip it
Section titled âWhen to skip itâSimple, basic tasks:
- Single file changes
- Obvious bug fixes
- Simple feature additions
- Quick prototypes
RPI is deliberately slower. The validation overhead isnât worth it for trivial work.
Why RPI works
Section titled âWhy RPI worksâPrevents common AI failures
Section titled âPrevents common AI failuresâ| Failure mode | How RPI prevents it |
|---|---|
| Context overflow | Atomic tasks keep work focused and bounded |
| Hallucination | FAR validation requires factual evidence |
| Wrong problem solved | Research validates relevance before planning |
| Untestable code | FACTS validation ensures clear success criteria |
| Scope creep | Atomic tasks and validation gates maintain boundaries |
Leverages AI strengths
Section titled âLeverages AI strengthsâ- Pattern matching: AI excels at finding similar code
- Code generation: AI writes boilerplate efficiently
- Systematic execution: AI follows checklists perfectly
Preserves human judgment
Section titled âPreserves human judgmentâ- Humans handle strategy and validation
- Humans make architectural decisions
- Humans verify relevance and correctness
- AI doesnât make big decisions without validation
Built-in quality gates
Section titled âBuilt-in quality gatesâEvery phase has checkpoints:
- Research: FAR validation
- Plan: FACTS validation
- Implement: Tests, builds, lints must pass
Context management
Section titled âContext managementâ- Fresh sessions per phaseâLLM stays focused
- Explicit handoffsâplan has all context for implementation
- Checkpoint systemâcan resume after interruptions
Integration with AI tools
Section titled âIntegration with AI toolsâTool agnostic
Section titled âTool agnosticâRPI works with any AI coding assistant:
- Claude
- GitHub Copilot
- Cursor
- OpenAI
- Gemini
- Any agent that can follow structured prompts
The framework is about structure, not specific tooling.
goose implementation
Section titled âgoose implementationâBlockâs goose tool provides built-in RPI support with slash commands:
| Command | Purpose |
|---|---|
/research "topic" | Research phase |
/plan "feature/task" | Planning phase |
/implement "plan path" | Implementation phase |
/iterate "plan path" + feedback | Plan refinement |
Recipes used:
rpi-codebase-locatorâ Find relevant filesrpi-codebase-analyzerâ Analyze coderpi-pattern-finderâ Find patternsrpi-create-planâ Generate planrpi-implement-planâ Execute implementationrpi-iterate-planâ Refine plan
Without goose
Section titled âWithout gooseâYou can implement RPI manually:
- Create
thoughts/research/andthoughts/plans/directories - Use structured prompts for each phase
- Manually validate with FAR and FACTS scales
- Track progress with checkboxes in markdown
The tooling helps, but the framework works without it.
Common patterns
Section titled âCommon patternsâFeature addition
Section titled âFeature additionâ1. /research "current authentication system"2. /plan "add OAuth2 support"3. /implement [plan path]Bug fix
Section titled âBug fixâ1. /research "payment processing error handling"2. /plan "fix race condition in transaction commits"3. /implement [plan path]Refactor
Section titled âRefactorâ1. /research "current data access layer"2. /plan "migrate from ORM to raw SQL"3. /implement [plan path]4. /iterate [plan path] "need to handle edge case in migrations"Migration
Section titled âMigrationâ1. /research "React class components in codebase"2. /plan "convert to functional components with hooks"3. /implement [plan path]The skill shift
Section titled âThe skill shiftâTraditional AI coding asks: âHow do I get the perfect prompt?â
RPI asks: âHow do I structure work so AI can execute reliably?â
You stop directing the AI step-by-step and start designing workflows that converge on correct solutions. The AIâs job is systematic execution. Your job is defining what âdoneâ looks like and validating at checkpoints.
The mindset shift:
- From: âAI, build this featureâ
- To: âAI, help me understand what exists, plan the change systematically, then execute with validationâ
Resources
Section titled âResourcesâOfficial
Section titled âOfficialâ- READ: Research â Plan â Implement Pattern | goose â Official tutorial with demonstrations
- READ: Introducing the RPI Strategy â Creatorâs blog post explaining the approach
Community
Section titled âCommunityâ- LISTEN: The RPI workflow - Build Wiz AI Show (Podcast) â Audio discussion on advanced AI coding
Origins
Section titled âOriginsâOriginally inspired by a YouTube video that sparked the idea for systematic AI development. Developed and popularized by HumanLayer (framework creators), Blockâs goose team (implementation and tooling), and Patrick Robinson (documentation and evangelism).
Using RPI in production? Share your experienceâwhat worked, what didnât, and what you learned along the way.