Opinionated implementation of the Ralph Wiggum AI technique.
Ralph solves the AI context window problem in the most simplistic way possible; keep feeding new AI sessions the same prompt until the job is done.
"Ralph is a Bash loop." - Geoffrey Huntley
Anthropic's official ralph plugin gets the core principle of Ralph wrong by preventing a single instance of claude from exiting, rather than continuously starting new sessions.
Installation
Prerequisites
- This package depends on Bun being installed globally
- Claude Code must be must be installed and configured
# Create a global `ralph` cli command
npm i -g ralph-wiggum-aiUsage
Create a PRD file
Before setting Ralph to work, you need to create a PRD (product requirements document) prd.json file that defines the tasks for Ralph to perform.
You can generate a PRD in two ways:
Option 1: Generate a sample PRD to manually edit
# Generate a sample prd.json file for you to edit
ralph prd --sampleOption 2: Generate a PRD interactively with Claude Code
# Provide task description inline ralph prd -m "Add a user dashboard with profile and settings" # Or read task description from a file ralph prd -f requirements.md
When using -m or -f flags, Claude Code will:
- Ask you clarifying questions about the feature
- Generate a comprehensive PRD based on your answers
- Create both
prd.jsonandprogress.txtfiles
Feel free to modify the shape of the tasks, so long as the
startedandcompletefields remain as booleans.This default PRD task shape was inspired by this article from Anthropic
Using AI to iterate on this PRD file itself is a great way to bootstrap Ralph's work!
Start the Ralph Wiggum loop:
Flags
-i, --max-iterations <number> Maximum number of iterations to run (default: 10) -s, --sequential Process tasks in sequential order instead of by priority -v, --version Print version number -h, --help Print help information
Subcommands
prd <options> Generate a prd.json file --sample Generate sample prd.json file -m, --message <text> Task description for interactive PRD generation -f, --file <path> File containing task description
Development
You must have Bun installed globally.
To install dependencies:
To run:
To link the global ralph command to this local development version: