ralph is an autonomous loop task runner that uses GitHub Copilot CLI to iteratively work on tasks until completion. It
creates a feedback loop where Copilot learns from previous attempts and adjusts its approach accordingly.
- Autonomous iteration:
ralphruns GitHub Copilot in a loop, allowing it to learn from previous attempts - Short-term memory: Each iteration has access to the history of what was already tried
- Task file support: Define tasks in markdown or text files
- Completion detection: Automatically stops when the task is marked as done
- Verbose mode: See detailed execution logs
- Bash shell (Linux, macOS, or WSL on Windows)
- GitHub Copilot CLI
To install ralph system-wide (defauls to /usr/local/bin, requiring sudo):
make installTo install to a different location:
make install PREFIX=${HOME}/binYou can also run ralph directly without installing:
./src/ralph.bash [options] [subcommand]Or create a symlink to the script:
ln -s "$(pwd)/src/ralph.bash" "/usr/local/bin/ralph"ralph --verbose << 'EOF'
Create a function in src/math.js that:
1. Exports a function called 'isPrime'
2. Takes a number as input
3. Returns true if the number is prime, false otherwise
4. Includes proper error handling
EOFecho "Fix all TODO comments in the codebase" | ralph --iterations 15ralph --file .ralph/refactor-task.md --verbose-
Initialize ralph in your project directory:
ralph init
-
Create a task file in
.ralph/tasks:echo "Create a function that calculates fibonacci numbers" > .ralph/tasks
-
Run ralph:
ralph
ralph --file my-tasks.mdecho "Fix all linting errors" | ralphralph --iterations 20ralph --forceralph -m gpt-5
# or
ralph --model gpt-4.1Note: Model names supported depend on your installed GitHub Copilot CLI; check its documentation for available models.
ralph --verboseSDD mode lets ralph iterate over a folder of structured spec files instead of a single flat task file. Each spec is processed independently with its own iteration history and completion sentinel.
- Explicit: pass
-s <dir>/--specs <dir>to point at a specs folder - Auto-detect: if
.ralph/specs/exists and contains.mdfiles, SDD mode activates automatically - Auto-generate: if no specs folder exists, ralph calls the agent once to split your task file into specs
Use --no-sdd to disable SDD and fall back to the flat task loop.
ralph --specs path/to/specs/ralph --file my-big-task.md
# ralph will generate .ralph/specs/001-*.md, 002-*.md, etc. then process themGenerate specs without running the loop:
ralph --file my-task.md generate-specsEach spec file should have these sections:
## Overview
Brief description of the feature or work unit.
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
## Out of Scope
Items explicitly excluded from this spec.
## Notes
Additional context or implementation hints.Each spec is considered complete when a sibling .done file exists (e.g., 001-feature.done for 001-feature.md). Use --force to re-run completed specs.
ralph --sdd-model gpt-5 --file tasks.mdralphreads a task description from a file or stdin- It creates an iteration directory to store the execution history
- For each iteration:
- ralph builds a prompt that includes the original task and the history of previous iterations
- GitHub Copilot CLI processes the prompt and attempts to complete the task
- The output is saved to a log file
- If Copilot creates a
.ralph/DONEfile, the task is considered complete
- The loop continues until the task is complete or the maximum number of iterations is reached
Install all required development tools:
make setupThis will install:
- Copilot CLI
- ShellCheck (shell script linter)
The project uses a Makefile for common development tasks:
make helpCheck code for linting issues:
make checkRemove the .ralph directory:
make clean- ShellCheck: Static analysis tool for shell scripts
- Makefile: Automation for common development tasks
- Make your changes to
src/ralph.bash - Run checks:
make check - Test your changes locally
- Submit a pull request
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
If you discover a security vulnerability, please see SECURITY.md for reporting instructions.
This project is licensed under the terms specified in the LICENSE file.
- Inspired by Geoffrey Huntley
- Loop approach adapted from this gist
- Powered by GitHub Copilot CLI