Ralph is an autonomous agent loop that runs AI via Opencode repeatedly until all
PRD items are complete. Each iteration is a fresh instance with clean context.
Memory persists via git history, progress.txt, and prd.json.
This version is optimized for Web UI development. Ralph uses the Playwriter skill to control a browser, verify UI changes, take screenshots, and debug frontend issues autonomously.
Based on Geoffrey Huntley's Ralph pattern.
- Opencode
- jq
- Git repository with an
AGENTS.mdfile - Playwriter - Browser automation for UI verification (optional but recommended)
Copy the skills and ralph folder to your project:
cp -r .opencode/skills/* /path/to/your/project/.opencode/skills/
cp -r ralph /path/to/your/project/Load the prd skill and create a PRD for [your feature description]
Answer the clarifying questions. Output saves to tasks/prd-[feature-name].md.
Load the ralph skill and convert tasks/prd-[feature-name].md to prd.json
./ralph/ralph.sh # Default: kimi-k2.5-free, 10 iterations
./ralph/ralph.sh --model opencode/kimi-k2.5 # Custom model
./ralph/ralph.sh --model github-copilot/claude-opus-4.5 20 # Custom model + iterationsEach iteration Ralph will:
- Create/checkout the feature branch from
prd.json - Pick the highest priority story where
passes: false - Implement that single story
- Run quality checks (typecheck, lint, test)
- Commit if checks pass
- Mark story as
passes: trueinprd.json - Append learnings to
ralph/progress.txt - Repeat until complete or max iterations reached
For UI stories, Ralph uses Playwriter to verify changes in a real browser:
-
Start your dev server (e.g.,
npm run dev) -
Ralph will automatically load the playwriter skill for UI stories, navigate to pages, interact with elements, and take screenshots to verify changes work as expected.
