Skip to main content

Iterative work/review loop for Claude Code

Project description

ralphkit

An iterative work/review loop for Claude Code. One model does the work, a different model reviews it. The loop continues until the reviewer says SHIP or max iterations are reached.

Inspired by Goose's Ralph pattern.

Install

pip install ralphkit

With uv:

uv tool install ralphkit

Or run directly without installing:

uvx ralphkit ralph-loop "your task here"

Quick Start

ralph-loop "Create a Python function in prime.py that checks if a number is prime. Include unit tests."

Usage

ralph-loop TASK [--config PATH] [--worker-model MODEL] [--reviewer-model MODEL] [--max-iterations N] [-y]

Arguments:

Argument Description Default
TASK Task description (string or path to .md file) required
--config PATH Load settings from a YAML config file none
--worker-model Model for the work phase opus
--reviewer-model Model for the review phase sonnet
--max-iterations Max work/review cycles 10
-y / --yes Skip confirmation prompt off

Examples:

# Inline task
ralph-loop "Build a REST API"

# Task from a markdown file
ralph-loop task.md

# Override models
ralph-loop "Build a REST API" --worker-model sonnet --reviewer-model haiku

# Use a config file for shared settings
ralph-loop "Build a REST API" --config ralph.yaml

# Skip confirmation
ralph-loop "Build a REST API" -y

Config file

A config file is optional. When provided via --config, its values serve as defaults that CLI args can override.

# ralph.yaml
worker_model: opus
reviewer_model: sonnet
max_iterations: 10

Resolution order: built-in defaults → config file → CLI args.

How It Works

┌─────────────────────────────────────────┐
│  1. Read task                           │
│  2. Worker model does the work          │ ◄─── iteration N
│  3. Reviewer model reviews it           │
│  4. SHIP? -> done. REVISE? -> loop.     │
└─────────────────────────────────────────┘

Each iteration:

  1. Work phase — the worker model reads the task (and any prior review feedback), writes code, runs tests, and summarizes what it did.
  2. Review phase — the reviewer model examines all files, runs tests, and writes either SHIP (approve) or REVISE (with feedback).
  3. If REVISE, the feedback is passed to the next iteration. If SHIP, the loop exits successfully.

State Files

State is persisted in .ralphkit/ in the current working directory so each stateless claude -p invocation can pick up where the last left off.

File Purpose
task.md The task description
iteration.txt Current iteration number
work-summary.txt What the worker did this iteration
work-complete.txt Created when the worker thinks it's done
review-result.txt SHIP or REVISE
review-feedback.txt Specific feedback from the reviewer

Requirements

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

ralphkit-0.1.0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

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

ralphkit-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file ralphkit-0.1.0.tar.gz.

File metadata

  • Download URL: ralphkit-0.1.0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ralphkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35d9b85f920f5f5f4e4ac610873402cd06c14132c85a8b1f5424f35192f677a7
MD5 4a88c562c6287041028a58320ebc19f0
BLAKE2b-256 600d9de75bd88f9b228fcfb7d8039805412af8ddbd3932108a8d1926843f2616

See more details on using hashes here.

File details

Details for the file ralphkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ralphkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ralphkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e6c3c947af23c1e4631296d834c3f93e8f1bcb2678f5128d6359e8c8dcddae7
MD5 42a052d8f741af59c951d944016c00a2
BLAKE2b-256 a617dbbaa7c011e7c4f5e8377cf67856631e7ca24f54c3e9e6d184e16c8230e0

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