"Me fail English? That's unpossible!" β Ralph Wiggum
Autonomous AI coding agent framework for GitHub Copilot CLI using the Ralph Loop methodology.
Ralph runs AI coding agents in continuous iterationsβreading specs, creating plans, implementing tasks, validating, and continuing until complete. Each iteration uses fresh context to maintain AI performance.
USE AT YOUR OWN RISK
Ralph autonomously modifies your codebase:
- Always use Git version control
- Review changes carefully
- Start with small, non-critical tasks
- Monitor execution
Filesystem Access: By default, Ralph grants Copilot CLI unrestricted filesystem access (--allow-all-paths) to enable autonomous operation across directories. This means the AI agent can read and write files anywhere on your system. You can restrict this in ralph/config.json by setting allow_all_paths to false and using additional_dirs to whitelist specific directories instead.
Token Usage Warning: Continuous autonomous loops consume significant AI tokens. Complex projects may require 20-50+ iterations. Monitor your GitHub Copilot usage and billing.
# Install GitHub Copilot CLI
npm install -g @github/copilot
# Authenticate
copilot auth
# Verify
copilot --versionRequires active GitHub Copilot subscription (Pro, Pro+, Business, or Enterprise).
Run this at the root of any project to install and start Ralph:
PowerShell (Windows/macOS/Linux):
irm https://raw.githubusercontent.com/niittymaa/Copilot-Ralph/main/install.ps1 | iexBash (Linux/macOS/WSL):
curl -fsSL https://raw.githubusercontent.com/niittymaa/Copilot-Ralph/main/install.sh | bashThis downloads only the ralph/ folder into your project, sets up update tracking, and starts Ralph automatically.
| Option | PowerShell | Bash |
|---|---|---|
| Install only (don't start) | iex "& { $(irm .../install.ps1) } -NoStart" |
curl ... | bash -s -- --no-start |
| Force (skip prompts) | iex "& { $(irm .../install.ps1) } -Force" |
curl ... | bash -s -- --force |
| Step | Action | Command |
|---|---|---|
| 1 | Copy ralph/ folder to your project |
Manual copy |
| 2 | Run Ralph | ./ralph/ralph.ps1 or ./ralph/ralph.sh |
First run auto-creates .github/instructions/, .github/agents/, and .ralph/.
| Command | Function |
|---|---|
./ralph/ralph.ps1 |
Auto mode: session menu β plan β build |
./ralph/ralph.ps1 -Mode continue |
Continue with spec menu |
./ralph/ralph.ps1 -Mode plan |
Plan only |
./ralph/ralph.ps1 -Mode build |
Build only (skip planning) |
./ralph/ralph.ps1 -Mode sessions |
Session management |
./ralph/ralph.ps1 -Mode benchmark |
Run Tetris benchmark |
./ralph/ralph.ps1 -Mode agents |
Update AGENTS.md |
./ralph/ralph.ps1 -NewSession "Name" |
Create new session |
./ralph/ralph.ps1 -Session "id" |
Switch session |
./ralph/ralph.ps1 -DryRun |
Preview (no tokens/changes) |
./ralph/ralph.ps1 -Model <name> |
Specify AI model |
./ralph/ralph.ps1 -ListModels |
Show available models |
./ralph/ralph.ps1 -MaxIterations N |
Limit iterations |
./ralph/ralph.ps1 -ShowVerbose |
Detailed output |
./ralph/ralph.ps1 -Memory status/on/off |
Memory system control |
./ralph/ralph.ps1 -CheckUpdate |
Check for updates |
./ralph/ralph.ps1 -Update |
Apply updates |
Same functionality with different syntax:
-mfor Mode (e.g.,-m plan,-m build,-m agents)-Mfor Model-Lfor ListModels-nfor MaxIterations-Vfor ShowVerbose--memoryfor Memory--new-sessionfor NewSession--sessionfor Session--check-updatefor CheckUpdate--updatefor Update
Run Ralph without specs. Choose:
- Interview Mode: Focused Q&A
- Quick Mode: Single-prompt description
Create .md files in ralph/specs/:
# Feature Name
## Overview
What you're building.
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
## Technical Requirements
- Requirement 1
- Requirement 2
## Out of Scope
- What's NOT includedSee ralph/specs/_example.template.md for full template.
Create new projects from scratch with guided setup.
Select [B] Project Boilerplate Wizard from session menu.
- π Web Application
- β‘ API / Backend
- π» Command-Line Tool
- π₯οΈ Desktop Application
- π± Mobile Application
- π§ Full-Stack
- π¦ Library / Package
- React + TypeScript
- Vue 3 + TypeScript
- Next.js
- Node + Express
- Python + FastAPI
- Python CLI
- Electron + React
- 30+ more presets
Facebook, X (Twitter), Instagram, Reddit, Discord, GitHub, Spotify, Netflix, Slack, Notion, Figma, Uber, Airbnb, Tinder architectures.
Select individual technologies:
- Language: JavaScript, TypeScript, Python, Go, Rust, C#, Dart
- Framework: React, Vue, Express, FastAPI, Django, etc.
- UI: Tailwind, shadcn/ui, Material UI, Bootstrap
- Database: SQLite, PostgreSQL, MongoDB, Prisma, Drizzle
- Testing: Vitest, Jest, pytest, Playwright, Cypress
- Build Tools: Vite, Webpack, tsup, Poetry
- Linting: ESLint, Prettier, Ruff, Black
Ready-to-use specifications in ralph/presets/:
| Priority | Preset | Description |
|---|---|---|
| π₯ 5 | Security Hardening | Adversarial security audit |
| βΏ 6 | Accessibility Audit | WCAG compliance |
| π 6 | Internationalization | i18n support |
| ποΈ 7 | Database Migration | Schema migration with rollback |
| β‘ 7 | Performance Optimization | Bottleneck resolution |
| β 8 | Test Coverage | Coverage improvement |
| π§ 10 | Code Refactoring | Professional standards |
| π§Ή 15 | Codebase Cleanup | Remove redundancy, modernize |
| π 20 | Project Structure Analysis | Architecture blueprint |
| π 25 | Project Documentation | Comprehensive markdown docs |
| π¬ 30 | Competitor Analysis | Research competitors |
| π 35 | Functions & Classes Listing | Complete API reference |
Lower priority numbers = higher priority tasks.
Ralph analyzes specs, images (wireframes/mockups), and structured data for planning.
Session menu β [R] Use existing references
- π Text/Markdown:
.md,.txt,.markdown - π Structured Data:
.json,.yaml,.yml,.xml,.csv,.toml - πΌοΈ Images:
.png,.jpg,.jpeg,.gif,.webp,.svg - π» Code:
.py,.js,.ts,.ps1,.cs,.java,.go, etc.
Images analyzed for UI structure, interactions, and functionality.
Isolated project contexts with independent plans, progress, and specs.
./ralph/ralph.ps1 # Session selection menu
./ralph/ralph.ps1 -Mode sessions # Interactive management
./ralph/ralph.ps1 -NewSession "Todo App" # Create new
./ralph/ralph.ps1 -Session "todo-app-123456" # Switch existing- Isolated (default): Session-specific
specs/folder - Shared: Uses
ralph/specs/across sessions
.ralph/
βββ active-task # Current session ID
βββ memory.md # Cross-session learnings
βββ settings.json # Memory enabled/disabled
βββ tasks/
βββ <session-id>/
βββ task.json # Metadata
βββ IMPLEMENTATION_PLAN.md # Plan
βββ progress.txt # Progress log
βββ specs/ # Isolated specs (optional)
Cross-session knowledge persistence in .ralph/memory.md.
- Accumulate knowledge over time
- Avoid repeated mistakes
- Maintain consistent patterns
- Store working commands
- Patterns: Code conventions, best practices
- Commands: Build, test, lint commands
- Gotchas: Pitfalls, edge cases
- Decisions: Architectural choices
./ralph/ralph.ps1 -Memory status # Show status
./ralph/ralph.ps1 -Memory on # Enable
./ralph/ralph.ps1 -Memory off # DisableEnabled by default. Manually edit .ralph/memory.md to add entries.
Automatic checkpoints at key points:
- Before each phase
- After task completion
- On errors
Recovery menu appears after interruption:
- [R] Resume from checkpoint
- [F] Start fresh
- [Q] Quit
Checkpoint location: .ralph/tasks/<session-id>/checkpoint.json
your-project/
βββ ralph/ # Self-contained framework (copy this)
β βββ ralph.ps1 # PowerShell entry point
β βββ ralph.sh # Bash entry point
β βββ init.ps1 # State reset
β βββ agents/ # Agent prompts
β β βββ ralph.agent.md
β β βββ ralph-planner.agent.md
β β βββ ralph-spec-creator.agent.md
β β βββ ralph-agents-updater.agent.md
β βββ core/ # 27 core modules
β β βββ loop.ps1 / loop.sh
β β βββ tasks.ps1 / tasks.sh
β β βββ display.ps1
β β βββ initialization.ps1
β β βββ statistics.ps1
β β βββ spinner.ps1 / spinner.sh
β β βββ venv.ps1 / venv.sh
β β βββ memory.ps1 / memory.sh
β β βββ dryrun.ps1
β β βββ specs.ps1
β β βββ presets.ps1 / presets.sh
β β βββ references.ps1
β β βββ boilerplate.ps1
β β βββ menus.ps1
β β βββ recovery.ps1
β β βββ checkpoint.ps1
β β βββ errors.ps1
β β βββ update.ps1
β β βββ logging.ps1
β β βββ github-auth.ps1
β β βββ pathutils.ps1
β βββ cli/ # Zero-dependency CLI framework
β β βββ ps/ # PowerShell implementation
β β βββ sh/ # POSIX shell implementation
β βββ menus/ # YAML menu definitions
β βββ optimizer/ # Benchmarking framework
β β βββ optimizer.ps1
β β βββ benchmark.ps1
β βββ scripts/ # Utilities
β β βββ fork.ps1 / fork.sh
β β βββ reset-to-upstream.ps1 / reset-to-upstream.sh
β βββ templates/ # Setup templates
β βββ tests/ # Test suite (184 tests)
β β βββ ralph.tests.ps1
β βββ specs/ # Default/shared specs
β βββ presets/ # Preset specifications
β βββ boilerplates/ # Project templates
β βββ references/ # Reference materials
βββ .github/ # Auto-created by Ralph
β βββ agents/ # Agent prompts (copied from ralph/agents/)
β βββ instructions/
β βββ ralph.instructions.md # Ralph config
βββ .ralph/ # Runtime data (gitignored)
β βββ active-task
β βββ memory.md
β βββ settings.json
β βββ upstream.json # Fork tracking
β βββ venv/ # Python environment
β βββ tasks/ # Session data
βββ AGENTS.md # Operational guide (optional)
| Provider | Model | Type |
|---|---|---|
| Anthropic | claude-sonnet-4.5 | Default |
| Anthropic | claude-sonnet-4 | Standard |
| Anthropic | claude-haiku-4.5 | Fast/cheap |
| Anthropic | claude-opus-4.6 | Premium |
| Anthropic | claude-opus-4.6-fast | Premium |
| Anthropic | claude-opus-4.5 | Premium |
| OpenAI | gpt-5.2-codex | Standard |
| OpenAI | gpt-5.1-codex | Standard |
| OpenAI | gpt-4.1 | Fast/cheap |
| gemini-3-pro-preview | Standard |
./ralph/ralph.ps1 -ListModels # Show all models
./ralph/ralph.ps1 -Model <name> # Use specific modelPress [M] at startup to change model interactively.
Systematically test agent configurations using standardized Tetris game spec.
./ralph/optimizer/benchmark.ps1 # Standard (15 iterations)
./ralph/optimizer/benchmark.ps1 -Quick # Quick (5 iterations)
./ralph/optimizer/benchmark.ps1 -KeepProject # Keep generated project
./ralph/optimizer/benchmark.ps1 -Compare # Compare history
./ralph/optimizer/benchmark.ps1 -Model <name> # Specific modelStructure (40%): File separation, directory organization, modules
Code (30%): Lines, functions, function length, comments
Quality (20%): Test files, coverage ratio
Efficiency (10%): Iteration count, task completion rate
| Score | Grade |
|---|---|
| 90+ | A+ (Excellent) |
| 80-89 | A (Great) |
| 70-79 | B (Good) |
| 60-69 | C (Acceptable) |
| 50-59 | D (Needs Work) |
| <50 | F (Poor) |
./ralph/optimizer/optimizer.ps1 -Mode metrics -ProjectPath "path" # Analyze
./ralph/optimizer/optimizer.ps1 -Mode baseline # Baseline
./ralph/optimizer/optimizer.ps1 -Mode optimize -MaxExperiments 5 # Optimize
./ralph/optimizer/optimizer.ps1 -Mode analyze # CompareResults stored in ralph/optimizer/results/.
Zero-dependency terminal UI framework.
- Arrow-key navigation
- Multi-select checkboxes
- Hotkey support ([Q]uit, [B]ack)
- Scrollable menus
- Progress bars
- Text/password/number input
- Color support (16/256/TrueColor ANSI)
- Cross-platform (PowerShell 7+, POSIX sh)
PowerShell (ralph/cli/ps/):
api.ps1- Unified APIcolorUtils.ps1- Color/formattingkeyReader.ps1- Keyboard inputscreenManager.ps1- Cursor/viewportmenuRenderer.ps1- Single-selectmultiSelect.ps1- Multi-checkboxinputHandler.ps1- Text inputglobalKeyHandler.ps1- Global hotkeys
Shell (ralph/cli/sh/): Parallel POSIX implementations
YAML-based declarative menus in ralph/menus/*.yaml:
- Breadcrumb navigation
- Back button support
- Dynamic visibility
- Template variables
- Consistent UX
Platform support: Windows Terminal, iTerm2, Terminal.app, xterm, GNOME Terminal, Konsole, tmux, screen.
Automatic Python venv creation at .ralph/venv/ (gitignored).
| Mode | Behavior |
|---|---|
auto (default) |
Creates/uses venv |
skip |
Uses system Python |
reset |
Deletes and recreates venv |
./ralph/ralph.ps1 -Venv auto # Default
./ralph/ralph.ps1 -Venv skip # System Python
./ralph/ralph.ps1 -Venv reset # Fresh venvSettings in ralph/config.json (auto-created on first run, gitignored):
| Setting | Type | Default | Description |
|---|---|---|---|
verbose_mode |
bool |
true |
Show detailed output and debug information |
developer_mode |
bool |
false |
Keep screen history between menus |
venv_mode |
string |
"auto" |
Python venv: auto, always, or disabled |
allow_all_paths |
bool |
true |
Grant Copilot CLI unrestricted filesystem access |
additional_dirs |
string[] |
[] |
Specific directories to grant access to via --add-dir |
By default, allow_all_paths is true so Ralph operates autonomously without "Permission denied" errors when accessing files outside the workspace (e.g., reference projects, shared documentation).
To restrict access, set allow_all_paths to false and optionally whitelist specific directories:
{
"allow_all_paths": false,
"additional_dirs": ["D:\\Git\\other-project", "C:\\shared\\docs"]
}See ralph/config.example.json for a fully documented template.
Create Ralph-powered projects:
./ralph/scripts/fork.ps1 # Interactive
./ralph/scripts/fork.ps1 -Name my-app # Named forkCreates fork on GitHub, clones to .ralph/forks/<name>/, saves upstream URL, opens in VS Code.
Reset fork to match upstream exactly:
./ralph/scripts/reset-to-upstream.ps1 # Interactive
./ralph/scripts/reset-to-upstream.ps1 -UpstreamUrl <url> # Manual URL
./ralph/scripts/reset-to-upstream.ps1 -Force # Skip confirmation
./ralph/scripts/reset-to-upstream.ps1 -Branch develop # Specific branchWarning: Permanently deletes all local changes.
Auto-detects upstream from .ralph/upstream.json or Git remote.
Update Ralph from upstream while preserving project files.
./ralph/ralph.ps1 -CheckUpdate # Check availability
./ralph/ralph.ps1 -Update # Apply updatesUpdates ralph/ folder only. Preserves all project files outside ralph/.
Upstream detection order:
.ralph/upstream.json(GitHub forks).ralph/source.json(local copies)- Git remote 'upstream'
- Default:
https://github.com/niittymaa/Copilot-Ralph.git
Comprehensive test suite (184 tests):
./ralph/tests/ralph.tests.ps1 # Run all tests
./ralph/tests/ralph.tests.ps1 -Verbose # Detailed outputCoverage:
- File structure validation
- Mode parsing
- Agent prompt extraction
- Signal detection
- Utility functions
- Documentation consistency
Ralph uses native GitHub Copilot CLI with specific flags:
| Flag | Purpose |
|---|---|
--allow-all-tools |
Non-interactive autonomous operation |
--allow-all-paths |
Unrestricted filesystem access (default: enabled) |
--add-dir <path> |
Grant access to specific additional directories |
-p <prompt> |
Programmatic mode |
--model <model> |
Specify AI model |
--agent <name> |
Use custom agent from .github/agents/ |
--allow-all-tools is native Copilot CLI feature enabling autonomous tool usage without confirmation prompts.
--allow-all-paths is enabled by default so Ralph can operate autonomously across directories (e.g., reading reference files from other projects). Disable in config.json if you need restricted access.
- Fresh Context Each Iteration: Prevents AI confusion
- Backpressure Is Critical: Tests must pass before completion
- Small Steps Only: One task per iteration
- File-Based State: All memory in files
- Let Ralph Ralph: Trust the loop, observe and tune
Add build/test commands to AGENTS.md:
## Validation
- **Lint:** `npm run lint`
- **Test:** `npm test`
- **Build:** `npm run build`Ralph runs these after each implementation.
π Pick Task β π¨ Implement β β
Validate β π¦ Commit β π§Ή Clear Context β π Repeat
File-based memory persists learnings via progress.txt. Backpressure (tests/lints/builds) forces self-correction.
| Problem | Solution |
|---|---|
| "Copilot CLI not found" | npm install -g @github/copilot then copilot auth |
| "Permission denied" from Copilot | Ensure allow_all_paths is true in ralph/config.json (default), or add specific dirs to additional_dirs |
| "Agent file not found" | Ensure .github/agents/ralph.agent.md exists |
| Nothing changed | Check progress.txt |
| Stuck in loop | Break large tasks into smaller ones in IMPLEMENTATION_PLAN.md |
| Appears hung | Press Ctrl+C |
| Python venv not creating | Verify Python 3: python --version |
| Tests failing | Run ./ralph/tests/ralph.tests.ps1 |
Located in .github/agents/:
| Agent | File | Purpose |
|---|---|---|
| ralph | ralph.agent.md |
Main building agent |
| ralph-planner | ralph-planner.agent.md |
Planning/gap analysis |
| ralph-spec-creator | ralph-spec-creator.agent.md |
Spec creation/interview |
| ralph-agents-updater | ralph-agents-updater.agent.md |
Auto-update AGENTS.md |
Invoke in Copilot Chat:
@ralph Implement the next task from IMPLEMENTATION_PLAN.md
Automatic logging per session at .ralph/tasks/<session-id>/session.log.
Captures:
- Command executions
- AI model interactions
- File operations
- Errors and warnings
- Operation timestamps
Ralph Loop methodology created by Geoffrey Huntley.
| Resource | Link |
|---|---|
| Original Ralph | ghuntley.com/ralph |
| Ralph Playbook | claytonfarr.github.io/ralph-playbook |
| Playbook Repo | github.com/ClaytonFarr/ralph-playbook |
| Alternative Implementation | github.com/snarktank/ralph |
| Video Walkthrough | YouTube |
| GitHub Custom Agents | GitHub Blog |
MIT License - Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

