mapJanuary 11, 2026

Ralph Guide

The Ralph Wiggum technique: a bash loop that runs AI agents autonomously, resetting context each iteration to stay in the 'smart zone'

Ralphs ships code while you sleep. Created by Geoffrey Huntley, this technique runs AI coding agents in a loop—each iteration gets fresh context, implements one task, commits, and repeats. Results: $50K contracts completed for $297 in API costs, 6 repos shipped overnight, entire programming languages built autonomously.

The Core Insight

Context windows are arrays. When you chat, you allocate to the array. When tools execute, they auto-allocate. The LLM slides a window over this array—the less sliding required, the better the results.

Ralph exploits this by resetting context between iterations. Each task gets the full "smart zone" instead of degrading as context fills.

while :; do cat PROMPT.md | claude --dangerously-skip-permissions; done

Learning Path

Start here, progress downward:

  1. ralph-wiggum-as-a-software-engineer - Geoffrey Huntley's original article introducing the technique
  2. ralph-wiggum-loop-from-first-principles - First principles: context as arrays, deterministic allocation, the economics ($10.42/hour)
  3. a-brief-history-of-ralph - Dex Horthy chronicles the evolution from fringe experiment to mainstream methodology

Getting Started

Deep Dives

Tools

  • ralph - Ryan Carson's TypeScript implementation for Amp (GitHub)

Pure Ralph vs Plugin Ralph

A critical distinction:

When NOT to Use

From community discussion:

  • Exploratory work without clear outcomes
  • Major refactors without explicit acceptance criteria
  • Security-critical code requiring human review
  • Brownfield codebases with complex implicit requirements

Ralph works best for greenfield projects with auto-validatable success criteria.

Alternative Approach

  • 12-factor-agents - HumanLayer's contrasting philosophy: deterministic workflows over "loop until solved" patterns

Connections

Connections (34)