Skip to main content

A CLI application for running Claude Code iteratively on design documents

Project description

ralph-py-cli

Note: this is a cli that allows one to run claude code in yolo mode for a given number of iterations. Use caution and other best practices when going degen mode.

A CLI tool for running Claude Code iteratively on a project until completion.

What is a Ralph Loop?

A Ralph loop automates repeated Claude Code runs against a codebase. Instead of running Claude Code once and manually re-running it to continue work, Ralph handles the iteration automatically.

Each iteration:

  1. Sends your plan/design document to Claude Code
  2. Claude works on the task and reports progress
  3. If the task isn't complete, Ralph starts another iteration
  4. Continues until the task is done, an error occurs, or max iterations reached

This is useful for larger tasks that require multiple Claude Code sessions to complete.

Installation

# Install via pip
pip install ralph-py-cli

# Or install via uv
uv add ralph-py-cli

CLI Usage

Ralph provides two commands: run and plan.

Running the Loop

# Run with inline plan
ralph run ./my-project --plan "Build a REST API with user authentication" --iterations 5

# Run with plan from file
ralph run ./my-project --plan-file design.md --iterations 10

# With options
ralph run ./my-project \
  --plan-file design.md \
  --iterations 10 \
  --timeout 600 \
  --model claude-sonnet-4-20250514 \
  --verbose

Options:

  • --plan, -p - Plan text describing what to build
  • --plan-file, -f - Read plan from a file
  • --iterations, -n - Maximum iterations to run (required)
  • --timeout, -t - Timeout per iteration in seconds (default: 300)
  • --model, -m - Model override for Claude Code
  • --verbose, -v - Show detailed output

Exit codes:

  • 0 - Task completed successfully
  • 1 - Error occurred (timeout, process error, etc.)
  • 2 - Max iterations reached without completion

Improving a Plan

The plan command restructures your plan into small, atomic steps optimized for iterative execution:

# Improve a plan from text
ralph plan --plan "Build a web app with login, dashboard, and settings pages"

# Improve a plan from file
ralph plan --plan-file rough-ideas.md

# Save improved plan to file
ralph plan --plan-file rough-ideas.md --output optimized-plan.md

Options:

  • --plan, -p - Plan text to improve
  • --plan-file, -f - Read plan from a file
  • --output, -o - Write improved plan to file
  • --timeout, -t - Timeout in seconds (default: 120)
  • --model, -m - Model override for Claude Code
  • --verbose, -v - Show detailed output

Example Workflow

  1. Write a rough plan for what you want to build
  2. Use ralph plan to optimize it for iterative execution
  3. Use ralph run to execute the plan iteratively
# Start with a rough idea
echo "Build a CLI todo app with add, list, and delete commands" > plan.txt

# Optimize for iterative execution
ralph plan --plan-file plan.txt --output optimized-plan.txt

# Run the loop
ralph run ./todo-project --plan-file optimized-plan.txt --iterations 5

Interactive Loop Menu

When running in an interactive terminal, Ralph pauses between iterations to let you control the loop. This gives you the opportunity to review progress and make adjustments.

Main Menu

After each iteration, you'll see:

What would you like to do next?
  [1] Continue to next iteration
  [2] Edit loop settings
  [3] Skip future prompts (auto-continue)
  [4] Cancel
  • Continue - Proceed to the next iteration with current settings
  • Edit - Open the edit menu to change plan or iterations
  • Skip - Disable prompts and auto-continue for remaining iterations
  • Cancel - Stop the loop immediately

Edit Menu

When you select "Edit loop settings", you can make multiple changes before continuing:

=== Edit Loop Settings ===
Current plan: <first 100 chars of plan>...
Remaining iterations: X

  [1] Change plan (enter text)
  [2] Change plan (load from file)
  [3] Change iteration count
  [4] Confirm and continue
  [5] Cancel (discard changes)
  • Change plan (text) - Enter new plan text directly
  • Change plan (file) - Load plan from a file path
  • Change iteration count - Set remaining iterations
  • Confirm - Apply changes and continue to next iteration
  • Cancel - Discard all changes and return to main menu

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ralph_py_cli-0.1.1.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ralph_py_cli-0.1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file ralph_py_cli-0.1.1.tar.gz.

File metadata

  • Download URL: ralph_py_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ralph_py_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 924c473acb84a135a5ef50e6cb4a291892b77f6b93e8706553af6f3665cea221
MD5 fb759f10e14473b7c84b79405d5229ca
BLAKE2b-256 4bae6acaec0b133ce496aed1f3345fb88a77e0a12c03175cf3eabe2b81edb6af

See more details on using hashes here.

File details

Details for the file ralph_py_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ralph_py_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ralph_py_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fa70a5e0d9f7f5236b7b82f387d3ed6899c7607f59d67bd477d5bd1e10e9b23
MD5 529ffbf0bfacd9ae68f3085481f4527c
BLAKE2b-256 1ecb19b0ea2c647974022b1463c1adaccd09ebf6482e0507be948320f1c105cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page