Ralph

March 5, 2026 ยท View on GitHub

A CLI tool for long-running PRD-driven development with AI coding agents

Version License

Ralph Screenshot

Ralph automates the process of working through a Product Requirements Document (PRD) by orchestrating AI coding agents (Cursor, Claude Code, or Codex) to complete tasks one at a time. Ralph is inspired by the Ralph loop methodology created by Geoffrey Huntley and outlines in this article: https://ghuntley.com/ralph/

Installation

Install Ralph with a single command:

curl -fsSL https://raw.githubusercontent.com/nitodeco/ralph/main/scripts/install.sh | bash

Quick Start

1. Initialize a new project

ralph init

This will interactively create all necessary files in the user directory (~/.ralph). You'll be prompted to select your preferred AI agent (Cursor, Claude Code, or Codex).

2. Run the agent

ralph run [iterations]

Runs the configured AI agent in a loop, working through tasks in your PRD. Default is 10 iterations.

The agent workflow:

  1. Run ralph progress and ralph task list to understand the current state
  2. Run ralph task current to find the next incomplete task
  3. Implement that task
  4. Run ralph progress add and ralph task done to record progress
  5. Commit the changes
  6. Repeat until all tasks are complete or iterations are exhausted

PRD Format

Ralph uses JSON under the hood to store the PRD and progress. The PRD can be easily edited using commands in ralph.

Configuration

Custom Instructions

You can provide project-specific instructions to the agent by creating an instructions.md file in your project's Ralph directory (~/.ralph/projects/<project>/instructions.md). The contents of this file will be included in the agent prompt, allowing you to customize behavior, coding standards, or project-specific guidelines.

Configuration Options

Ralph uses a layered configuration system with global (~/.ralph/config.json) and project-level (~/.ralph/projects/<project>/config.json) settings. Project settings override global settings.

OptionTypeDefaultDescription
agent"cursor" | "claude" | "codex""cursor"AI coding agent to use
maxRetriesnumber3Maximum retry attempts per iteration
retryDelayMsnumber5000Delay between retries (ms)
agentTimeoutMsnumber1800000Agent timeout per iteration (30 min)
stuckThresholdMsnumber300000Time without output before considering agent stuck (5 min)
maxRuntimeMsnumber0Maximum total session runtime (0 = unlimited)
logFilePathstring".ralph/ralph.log"Path to log file

Notification Settings

{
  "notifications": {
    "systemNotification": true,
    "webhookUrl": "https://hooks.slack.com/...",
    "markerFilePath": ".ralph/complete.marker"
  }
}
OptionTypeDescription
systemNotificationbooleanEnable OS notifications on completion
webhookUrlstringWebhook URL for completion notifications
markerFilePathstringFile to create when session completes

Memory Settings

{
  "memory": {
    "maxOutputBufferBytes": 5242880,
    "memoryWarningThresholdMb": 500,
    "enableGarbageCollectionHints": true
  }
}
OptionTypeDefaultDescription
maxOutputBufferBytesnumber5242880Max agent output buffer size (5 MB)
memoryWarningThresholdMbnumber500Memory warning threshold
enableGarbageCollectionHintsbooleantrueEnable GC hints for memory management

Example Configuration

{
  "agent": "claude",
  "maxRetries": 5,
  "retryDelayMs": 10000,
  "agentTimeoutMs": 3600000,
  "stuckThresholdMs": 600000,
  "maxRuntimeMs": 28800000,
  "notifications": {
    "systemNotification": true,
    "webhookUrl": "https://hooks.slack.com/services/..."
  }
}

Requirements

One of the following AI coding agents must be installed and available in your PATH:

Development

Contributions are welcome! To get started with development:

# Install dependencies
bun install

# Run in development mode
bun run dev

# Build binaries
bun run build

# Type check
bun run typecheck

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License. See LICENSE for details.