Credit: This guide is inspired by JeredBlu's Ralph Wiggum Guide. I've adapted and extended it to fit my specific workflow using the
/create-prdcommand and GitHub Copilot CLI.
Ralph Wiggum is a method for running GitHub Copilot CLI in a continuous autonomous loop. Each iteration runs in a fresh context window, allowing the agent to work through a series of tasks until completion without context bloat.
Ideal for:
- Starting projects from scratch
- Building proof of concepts (POCs) with a clearly defined scope
- Greenfield development where requirements are well-understood
- Projects where you can define "done" precisely
Not ideal for:
- Complex existing codebases
- Vibe coding or exploratory work without clear goals
- Projects with ambiguous requirements
- Situations requiring frequent human judgment calls
The key insight: Ralph Wiggum works best when you have a clear plan. If you don't know exactly what you're building, stop and figure that out first. The @workspace Use .copilot/create-prd.md prompt helps you do exactly that.
Standard chat interfaces have a stateful context that can get bloated or confused over long multi-step tasks. In contrast, the Ralph Wiggum loop (ralph.sh) starts a fresh context window for each iteration, feeding in the concise project state from PROMPT.md, prd.md, and activity.md. This minimizes hallucination and keeps the agent focused on the immediate next task.
You need GitHub Copilot CLI installed and authenticated. See the official documentation for setup.
Install the agent-browser CLI for headless browser automation:
npm install -g agent-browser
agent-browser install # Downloads ChromiumOn Linux, include system dependencies:
agent-browser install --with-depsThis tool allows Copilot to verify its work visually by taking screenshots and interacting with your running application.
This repository includes everything you need:
.copilot/create-prd.md- The instructions for creating the PRD.github/skills/agent-browser-skill/SKILL.md- Agent browser instructionsPROMPT.md- Template for the Ralph loopralph.sh- The bash loop scriptactivity.md- Activity logging templatescreenshots/- Directory for visual verification
Run the copilot --agent=.copilot/create-prd.md --prompt "Run this agent" command in github copilot CLI:
copilot --agent=.copilot/create-prd.md --prompt "Run this agent"
This interactive command will:custom instructions
Use the custom instructions in .copilot/create-prd.md to guide the creation of your PRD. You might say: "Help me create a PRD for my new app using the create-prd instructions."
This process will:
-
Ask discovery questions one at a time:
- What problem are you solving?
- Who is your target audience?
- What are the 3-5 core features?
- What tech stack do you want?
- What architecture approach?
- UI/UX preferences?
- Authentication requirements?
- Third-party integrations?
- Success criteria?
-
Research options if you're unsure about tech stack or architecture
-
Generate
prd.mdwith:- Complete project requirements
- Tech stack decisions
- JSON task list with atomic, verifiable tasks
-
Update
PROMPT.mdwith your specific:- Start commands for your tech stack
- Build/lint commands
- Project-specific instructions
-
Create/verify
activity.mdfor logging progress
After the PRD is created, verify these files before running the loop:
Check prd.md:
- Are all features captured in the task list?
- Are tasks atomic (completable in one iteration)?
- Are tasks in the correct dependency order?
- Is the success criteria clear?
Check PROMPT.md:
- Is the start command correct for your tech stack?
- Are build/lint commands accurate?
This verification step is critical. The quality of your Ralph Wiggum run depends entirely on the quality of your PRD and configuration.
Once verified, start the autonomous loop:
./ralph.sh 20The number is your maximum iterations. Start with 10-20 for smaller projects.
The script will:
- Read
PROMPT.mdand feed it to Copilot CLI - Copilotrations reached
While Ralph runs, you can monitor:
activity.md- Detailed log of what was accomplished each iterationscreenshots/- Visual verification of each completed task- Git commits - One commit per task with clear messages
- Terminal output - Real-time progress
Your Product Requirements Document with a JSON task list:
[
{
"category": "setup",
"description": "Initialize Next.js project with TypeScript",
"steps": [
"Run create-next-app with TypeScript template",
"Install additional dependencies",
"Verify dev server starts"
],
"passes": false
}
]Tasks should be:
- Atomic: One logical unit of work
- Verifiable: Clear success criteria
- Ordered: Respect dependencies
- Categorized: setup, feature, integration, styling, testing
Instructions for each iteration. References @prd.md and @activity.md. Updated by /create-prd with your specific start commands.
Permissions and sandbox configuration. Updated by /create-prd based on your tech stack to ensure the agent can run all necessary commands.
Example permissions that might be added based on your PRD:
Bash(prisma:*)for Prisma CLIBash(supabase:*)for Supabase CLIBash(firebase:*)for Firebase CLIBash(vercel:*)for Vercel CLIBash(docker compose:*)for Docker workflows
the PRD creation process with your specific start commands.
The bash loop script. Key features:
- Fresh context window per iteration
- Completion detection via
<promise>COMPLETE</promise> - File existence validation
- Color-coded output
- Graceful handling of max iterations
- Automatically passes
--allow-all-pathsand--allow-all-urlsfor autonomous operation
Activity log where the agent records:
- Date and time
- Task worked on
- Changes made
- Commands run
- Screenshot filename
- Issues and resolutions
The PRD creation process exists because planning is everything. Don't skip the discovery questions. Don't rush through them. A well-defined PRD is the difference between a successful Ralph run and wasted API credits.
Ralph Wiggum is for proof of concepts, not production applications. Define the minimum viable version of your idea. You can always iterate later.
Always review prd.md and PROMPT.md before starting the loop. Catching issues here saves iterations.
Use 10-20 iterations initially. You can always run more if needed. This prevents runaway costs if something goes wrong.
Watch the first 2-3 iterations to ensure things are working correctly. Check that:
- The dev server starts properly
- Agent-browser can access localhost
- Tasks are being marked as passing correctly
- Activity log is being updated
- Check if the task is too ambiguous
- Review
activity.mdto see what it's attempting - Consider breaking the task into smaller steps
- Verify the dev server is running
- Check that the port in
PROMPT.mdmatches your actual port - Ensure agent-browser is installed correctly
- This shouldn't happen with the bash loop (fresh context each iteration)
- Review remaining tasks in
prd.md - Check if tasks are too large or ambiguous
- Run again with
./ralph.sh 30or more iterations