Instructions for configuring and running the Runner Ralph autonomous development loop...
This skill provides instructions on how to use scripts/runner-ralph/ralph.py, an autonomous agent runner that implements a PRD-driven development loop.
Runner Ralph runs AI coding agents (Claude Code or Cursor) in a loop to complete user stories defined in a prd.json file. It handles:
Ensure the environment is set up:
uv: curl -LsSf https://astral.sh/uv/install.sh | shcurl https://cursor.com/install -fsS | bash (Preferred)npm install -g @anthropic-ai/claude-codeprd.jsonThe runner is driven by a prd.json file in the project root.
File Format:
{
"projectName": "My Project",
"branchName": "feature/my-feature",
"userStories": [
{
"id": "story-1",
"title": "Implement user authentication",
"description": "Add login and registration functionality",
"type": "feature",
"spec": [
"Support password reset via email",
"Use existing user table"
],
"acceptanceCriteria": [
"Users can register with email/password",
"Users can log in",
"Failed logins show error messages"
],
"passes": false
},
{
"id": "story-2",
"title": "Complex Dashboard",
"description": "Add a complex analytics dashboard",
"type": "feature",
"specFile": "specs/dashboard-spec.md",
"acceptanceCriteria": [
"Dashboard loads within 2 seconds",
"All charts display correct data"
],
"passes": false
}
]
}
Fields:
type: Optional. Can be feature, bug, chore, test. Triggers specialized prompts (e.g., prompt_feature.md).spec: Optional. Inline list of additional requirements or implementation notes.specFile: Optional. Path to an external markdown file containing the full feature specification. This is preferred for complex features.passes: Set to true by the runner when complete.For complex features, it is recommended to use the specFile field instead of inline spec strings. This allows you to provide much more detail, including user flows, UX considerations, and technical constraints, without cluttering the prd.json.
specFile vs Inline specspec: Best for small tasks or simple bug fixes."spec": ["Fix CSS padding on mobile", "Update logo to new SVG"]
specFile: Best for new features or significant refactors."specFile": "specs/new-onboarding-flow.md"
generate-specYou can use the gemini ralph generate-spec command to help you think through a feature and generate a high-quality markdown spec file.
gemini ralph generate-spec "Add a multi-step wizard for project creation"
This command will act as a Senior PM, ask you clarifying questions, and then write a detailed specification to a file in your specs/ directory.
Execute the runner using uv.
Best for monitoring progress in real-time.
uv run scripts/runner-ralph/ralph.py
| Flag | Description | Example |
|---|---|---|
--path |
Path to project root (default: current dir) | --path /path/to/project |
--agent |
Agent backend (cursor or claude) |
--agent cursor |
--model |
Specific model to use | --model claude-sonnet-4-20250514 |
--prd |
Path to PRD file (default: prd.json) |
--prd test-prd.json |
--iterations |
Max number of iterations | --iterations 5 |
--review |
Enable post-implementation code review | --review |
--no-git |
Disable git branching/commits | --no-git |
--use-main |
Branch from main instead of current branch | --use-main |
When you run Ralph, it follows this cycle:
prd.json.ralph/<story-id>.AGENTS.md, prompt.md, prd.json, and current progress.worklogs/<story-id>.md.<promise>COMPLETE</promise>.ralph/<story-id> back to the base branch.prd.json.agent for Cursor, claude for Claude) is in your PATH.progress.txt or the specific worklogs/<story-id>.md to see what the agent is struggling with. You may need to refine the story description or add hints to AGENTS.md.This skill is provider-agnostic but requires a compatible Agent CLI (Cursor or Claude) to perform the actual coding work.
Ensure @anthropic-ai/claude-code is installed globally or available in the environment.
Ensure the Cursor CLI is installed. The command is typically agent.