Skip to main content

ralphify

PyPI version Python versions License Documentation

Put your AI coding agent in a while True loop and let it ship.

Ralphify is a minimal harness for running autonomous AI coding loops, inspired by the Ralph Wiggum technique. The idea is simple: pipe a prompt to an AI coding agent, let it do one thing, commit, and repeat. Forever. Until you hit Ctrl+C.

while :; do cat RALPH.md | claude -p ; done

Ralphify wraps this pattern into a proper tool with commands, iteration tracking, and clean shutdown.

Install

uv tool install ralphify    # recommended

Or if you don't have uv:

pipx install ralphify       # isolated install via pipx
pip install ralphify         # plain pip (use a virtualenv or --user)

Any of these gives you the ralph command.

Quickstart

A ralph is a directory with a RALPH.md file. Scaffold one:

ralph init my-ralph

Then edit my-ralph/RALPH.md:

---
agent: claude -p --dangerously-skip-permissions
commands:
  - name: tests
    run: uv run pytest
---

You are an autonomous coding agent working in a loop.

## Test results

{{ commands.tests }}

If any tests are failing, fix them before continuing.

## Task

Implement the next feature from the TODO list.

Run it:

ralph run my-ralph           # Starts the loop (Ctrl+C to stop)
ralph run my-ralph -n 5      # Run 5 iterations then stop

What ralph run does

Each iteration:

  1. Runs commands — executes all commands, captures output
  2. Assembles prompt — reads RALPH.md body, replaces {{ commands.<name> }} placeholders with output
  3. Pipes to agent — executes the agent command with the assembled prompt on stdin
  4. Repeats — goes back to step 1

What it looks like

$ ralph run my-ralph -n 3

── Iteration 1 ──
  Commands: 1 ran
✓ Iteration 1 completed (52.3s)

── Iteration 2 ──
  Commands: 1 ran
✗ Iteration 2 failed with exit code 1 (23.1s)

── Iteration 3 ──
  Commands: 1 ran
✓ Iteration 3 completed (41.7s)

Done: 3 iteration(s) — 2 succeeded, 1 failed

The technique

The Ralph Wiggum technique works because:

  • One thing per loop. The agent picks the most important task, implements it, tests it, and commits. Then the next iteration starts fresh.
  • Fresh context every time. No context window bloat. Each loop starts clean and reads the current state of the codebase.
  • Progress lives in git. Code, commits, and a plan file are the only state that persists between iterations. If something goes wrong, git reset --hard and run more loops.
  • The prompt is a tuning knob. When the agent does something dumb, you add a sign. Like telling Ralph not to jump off the slide — you add "SLIDE DOWN, DON'T JUMP" to the prompt.

Read the full writeup: Ralph Wiggum as a "software engineer"

Core concepts

A ralph is a directory containing a RALPH.md file. That's it. Everything the ralph needs lives in that directory.

my-ralph/
├── RALPH.md              # the prompt (required)
├── check-coverage.sh     # script (optional)
├── style-guide.md        # reference doc (optional)
└── test-data.json        # any supporting file (optional)

RALPH.md is the only file the framework reads. It has YAML frontmatter for configuration and a body that becomes the prompt:

Frontmatter field Required Description
agent Yes The agent command to run
commands No List of commands (name + run) whose output fills {{ commands.<name> }} placeholders
args No Declared argument names for {{ args.<name> }} placeholders
credit No Append co-author trailer instruction to prompt (default: true)

Commands run before each iteration. Their output replaces {{ commands.<name> }} placeholders in the prompt. Use them for test results, git history, lint output — anything that changes between iterations.

No project-level configuration. No ralph.toml. No .ralphify/ directory. A ralph is fully self-contained.

AI-guided setup

ralph new my-task

Launches an interactive agent conversation to scaffold a new ralph with the right commands and prompt for your project.

Documentation

Full documentation at ralphify.co/docs — getting started tutorial, prompt writing guide, cookbook, and troubleshooting.

Requirements

License

MIT

Metadata

Release files for ralphify 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ralphify 0.3.0
File Size Uploaded Provenance
ralphify-0.3.0.tar.gz 525.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ralphify 0.3.0
File Interpreter ABI Platform
ralphify-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 564.7 kB

Release files / ralphify-0.3.0.tar.gz

Download URL ralphify-0.3.0.tar.gz
Size 525.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a70eb8ba27d8a5c49ca9f66ef12113d44e183dff491473c560bbacd910fe3785
BLAKE2b-256 checksum
How to use checksums
bfc622b8831261d7126a4581a1f31a23b9285b0768a1e22a1420546b1bccff16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / ralphify-0.3.0-py3-none-any.whl

Download URL ralphify-0.3.0-py3-none-any.whl
Size 39.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f19ea4478a96f1eb8cf4fd64aa5664b22d1d86d930087194e39cb7734586a03
BLAKE2b-256 checksum
How to use checksums
4ed0d62dfbda0b38185c05709f7e0767135be8c1f3e45af186237a672cebd62f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Security for ralphify 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ralphify-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page