Ralph (Copilot CLI runner)
Let AI implement your features while you sleep.
Ralph runs GitHub Copilot CLI in a loop, implementing one feature at a time until your PRD is complete.
Quick Start · How It Works · Configuration · Command Reference · Demo
Quick Start
Section titled “Quick Start”# Clone and enter the repogit clone https://github.com/soderlind/ralphcd ralph
# Add your work items to plans/prd.json
# Test with a single run./ralph-once.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe
# Run multiple iterations./ralph.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe 10Check progress.txt for a log of what was done.
How It Works
Section titled “How It Works”Ralph implements the “Ralph Wiggum” technique:
- Read — Copilot reads your PRD (if attached) and progress file
- Pick — It chooses the highest-priority incomplete item
- Implement — It writes code for that one feature
- Verify — It runs your tests (
pnpm typecheck,pnpm test) - Update — It marks the item complete and logs progress
- Commit — It commits the changes
- Repeat — Until all items pass or it signals completion
https://github.com/user-attachments/assets/28206ee1-8dad-4871-aef5-1a9f24625dba
Learn More
Section titled “Learn More”- Matt Pocock’s thread
- Ship working code while you sleep (video)
- 11 Tips For AI Coding With Ralph Wiggum
- Effective harnesses for long-running agents
Configuration
Section titled “Configuration”Choose a Model
Section titled “Choose a Model”Set the MODEL environment variable (default: gpt-5.2):
MODEL=claude-opus-4.5 ./ralph.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe 10Define Your Work Items
Section titled “Define Your Work Items”Create plans/prd.json with your requirements:
[ { "category": "functional", "description": "User can send a message and see it in the conversation", "steps": ["Open chat", "Type message", "Click Send", "Verify it appears"], "passes": false }]| Field | Description |
|---|---|
category | "functional", "ui", or custom |
description | One-line summary |
steps | How to verify it works |
passes | false → true when complete |
See the plans/ folder for more context.
Use Custom Prompts
Section titled “Use Custom Prompts”Prompts are required. Use any prompt file:
./ralph.sh --prompt prompts/my-prompt.txt --allow-profile safe 10Note: Custom prompts require
--allow-profileor--allow-tools.
Command Reference
Section titled “Command Reference”ralph.sh — Looped Runner
Section titled “ralph.sh — Looped Runner”Runs Copilot up to N iterations. Stops early on <promise>COMPLETE</promise>.
./ralph.sh [options] <iterations>Examples:
./ralph.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe 10./ralph.sh --prompt prompts/wp.txt --allow-profile safe 10MODEL=claude-opus-4.5 ./ralph.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe 10ralph-once.sh — Single Run
Section titled “ralph-once.sh — Single Run”Runs Copilot once. Great for testing.
./ralph-once.sh [options]Examples:
./ralph-once.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe./ralph-once.sh --prompt prompts/wp.txt --allow-profile lockedMODEL=claude-opus-4.5 ./ralph-once.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safeOptions
Section titled “Options”| Option | Description | Default |
|---|---|---|
--prompt <file> | Load prompt from file (required) | — |
--prd <file> | Optionally attach a PRD JSON file | — |
--skill <a[,b,...]> | Prepend skills from skills/<name>/SKILL.md | — |
--allow-profile <name> | Permission profile (see below) | — |
--allow-tools <spec> | Allow specific tool (repeatable) | — |
--deny-tools <spec> | Deny specific tool (repeatable) | — |
-h, --help | Show help | — |
Environment:
| Variable | Description | Default |
|---|---|---|
MODEL | Model to use | gpt-5.2 |
Permission Profiles
Section titled “Permission Profiles”| Profile | Allows | Use Case |
|---|---|---|
locked | write only | File edits, no shell |
safe | write, shell(pnpm:*), shell(git:*) | Normal dev workflow |
dev | All tools | Broad shell access |
Always denied: shell(rm), shell(git push)
Custom tools: If you pass --allow-tools, it replaces the profile defaults:
./ralph.sh --prompt prompts/wp.txt --allow-tools write --allow-tools 'shell(composer:*)' 10Try Ralph in a safe sandbox:
# Setupgit clone https://github.com/soderlind/ralph && cd ralphgit worktree add ../ralph-demo -b ralph-democd ../ralph-demo
# Run./ralph-once.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe./ralph.sh --prompt prompts/default.txt --prd plans/prd.json --allow-profile safe 10
# Inspectgit log --oneline -20cat progress.txt
# Cleanupcd .. && git worktree remove ralph-demo && git branch -D ralph-demoProject Structure
Section titled “Project Structure”.├── plans/prd.json # Your work items├── prompts/default.txt # Example prompt├── progress.txt # Running log├── ralph.sh # Looped runner├── ralph-once.sh # Single-run script└── test/run-prompts.sh # Test harnessInstall Copilot CLI
Section titled “Install Copilot CLI”# Check versioncopilot --version
# Homebrewbrew update && brew upgrade copilot
# npmnpm i -g @github/copilot
# Windowswinget upgrade GitHub.CopilotTesting Prompts
Section titled “Testing Prompts”Run all prompts in isolated worktrees:
./test/run-prompts.shLogs: test/log/
Copilot CLI Notes
Section titled “Copilot CLI Notes”Ralph is just a thin wrapper around the Copilot CLI. The important flags it relies on are:
Context attachment (-p "@file ...")
Section titled “Context attachment (-p "@file ...")”Ralph passes context to Copilot by attaching a file directly in the prompt
using Copilot’s @file syntax (for example: -p "@.ralph-context... Follow the attached prompt.").
Ralph builds one temporary “attachment” file per iteration that typically contains:
progress.txt(always)- PRD JSON (only if you pass
--prd <file>) - The selected prompt file (from
--prompt <file>)
This keeps the agent’s input structured and avoids inlining large blobs into command-line flags.
Tool permissions (--allow-* / --deny-*)
Section titled “Tool permissions (--allow-* / --deny-*)”Ralph controls what Copilot is allowed to do by passing tool permission flags:
--allow-profile <safe|dev|locked>: convenience presets implemented by Ralph.--allow-tools <spec>: allow a specific tool spec (repeatable). When you use this, it replaces the profile defaults.--deny-tools <spec>: deny a specific tool spec (repeatable).
For shell tools, prefer the pattern form shell(cmd:*) (for example shell(git:*)).
Ralph always denies a small set of dangerous commands (currently shell(rm) and shell(git push)).
Reliability niceties
Section titled “Reliability niceties”- Single attachment workaround: Ralph combines PRD +
progress.txtinto one context file to avoid Copilot CLI issues with multiple@fileattachments. - Pseudo-TTY capture in the harness:
test/run-prompts.shusesscript(1)to capture output even when Copilot writes directly to the TTY.
Skills (--skill)
Section titled “Skills (--skill)”Skills let you prepend reusable instructions into the same attached context file. Pass a comma-separated list (repeatable):
--skill wp-block-developmentloadsskills/wp-block-development/SKILL.md--skill aa,bb,ccloadsskills/aa/SKILL.md,skills/bb/SKILL.md,skills/cc/SKILL.md
Example:
./ralph.sh --prompt prompts/wordpress-plugin-agent.txt \ --skill wp-block-development,wp-cli \ --prd plans/prd.json \ --allow-profile safe \ 5License
Section titled “License”MIT — see LICENSE.
📦 Source: soderlind/ralph · Edit on GitHub