Gepetto
Orchestrates a multi-step planning process: Research → Interview → Spec Synthesis → Plan → External Review → Sections
CRITICAL: First Actions
BEFORE anything else, do these in order:
1. Print Intro
Print intro banner immediately:
2. Validate Spec File Input
Check if user provided @file at invocation AND it's a spec file (ends with .md).
If NO @file was provided OR the path doesn't end with .md, output this and STOP:
Do not continue. Wait for user to re-invoke with a .md file path.
3. Setup Planning Session
Determine session state by checking existing files:
-
Set
planning_dir= parent directory of the spec file -
Set
initial_file= the spec file path -
Scan for existing planning files:
claude-research.mdclaude-interview.mdclaude-spec.mdclaude-plan.mdclaude-integration-notes.mdclaude-ralph-loop-prompt.mdclaude-ralphy-prd.mdreviews/directorysections/directory
-
Determine mode and resume point:
- Create TODO list with TodoWrite based on current state
Print status:
If resuming:
Logging Format
Workflow
4. Research Decision
See research-protocol.md [blocked].
- Read the spec file
- Extract potential research topics (technologies, patterns, integrations)
- Ask user about codebase research needs
- Ask user about web research needs (present derived topics as multi-select)
- Record which research types to perform in step 5
5. Execute Research
See research-protocol.md [blocked].
Based on decisions from step 4, launch research subagents:
- Codebase research:
Task(subagent_type=Explore) - Web research:
Task(subagent_type=Explore)with WebSearch
If both are needed, launch both Task tools in parallel (single message with multiple tool calls).
Important: Subagents return their findings - they do NOT write files directly. After collecting results from all subagents, combine them and write to <planning_dir>/claude-research.md.
Skip this step entirely if user chose no research in step 4.
6. Detailed Interview
See interview-protocol.md [blocked]
Run in main context (AskUserQuestion requires it). The interview should be informed by:
- The initial spec
- Research findings (if any)
7. Save Interview Transcript
Write Q&A to <planning_dir>/claude-interview.md
8. Write Initial Spec (Spec Synthesis)
Combine into <planning_dir>/claude-spec.md:
- Initial input (the spec file)
- Research findings (if step 5 was done)
- Interview answers (from step 6)
This synthesizes the user's raw requirements into a complete specification.
9. Generate Implementation Plan
Create detailed plan → <planning_dir>/claude-plan.md
IMPORTANT: Write for an unfamiliar reader. The plan must be fully self-contained - an engineer or LLM with no prior context should understand what we're building, why, and how just from reading this document.
10. External Review
See external-review.md [blocked]
Launch TWO subagents in parallel to review the plan:
- Gemini via Bash
- Codex via Bash
Both receive the plan content and return their analysis. Write results to <planning_dir>/reviews/.
11. Integrate External Feedback
Analyze the suggestions in <planning_dir>/reviews/.
You are the authority on what to integrate or not. It's OK if you decide to not integrate anything.
Step 1: Write <planning_dir>/claude-integration-notes.md documenting:
- What suggestions you're integrating and why
- What suggestions you're NOT integrating and why
Step 2: Update <planning_dir>/claude-plan.md with the integrated changes.
12. User Review of Integrated Plan
Use AskUserQuestion:
Options: "Done reviewing"
Wait for user confirmation before proceeding.
13. Create Section Index
See section-index.md [blocked]
Read claude-plan.md. Identify natural section boundaries and create <planning_dir>/sections/index.md.
CRITICAL: index.md MUST start with a SECTION_MANIFEST block. See the reference for format requirements.
Write index.md before proceeding to section file creation.
14. Write Section Files — Parallel Subagents
See section-splitting.md [blocked]
Launch parallel subagents - one Task per section for maximum efficiency:
- First, parse
sections/index.mdto get the SECTION_MANIFEST list - Then launch ALL section Tasks in a single message (parallel execution):
Wait for ALL subagents to complete before proceeding.
15. Generate Execution Files — Subagent
Delegate to subagent to reduce main context token usage:
Wait for subagent completion before proceeding.
16. Final Status
Verify all files were created successfully:
- All section files from SECTION_MANIFEST
claude-ralph-loop-prompt.mdclaude-ralphy-prd.md
17. Output Summary
Print generated files and next steps:

