Ralph Mode: Why AI Agents Should Forget

Gordon Mickel6 min read

Since I started posting about autonomous agent loops, I've been getting questions. "How do I set this flow-next thing up?" "What's Ralph?" "How do you use it?"

This tweet started it all:

Also had to explain to my wife why I'm searching for Ralph Wiggum images. With modest results.

But before I explain my flow-next plugin, understand Ralph first. Not my implementation-the technique itself.

As Geoffrey Huntley says, start with first principles.

Start at the Source

Essential reading:

My point: try building a dumb bash loop yourself first. See what happens when you externalize state to files. You'll learn more in an hour than from any thread.

What Ralph Actually Is

Ralph isn't "an agent that remembers forever." It's an agent that controls what it remembers.

Context pollution vs fresh context - traditional agent loops accumulate garbage while Ralph mode starts fresh each iteration

LLM context windows only grow-add tokens, never delete. Wrong turns, failed attempts, hallucinations accumulate. Context pollution.

Most tools try "compaction"-summarizing when context gets long. But summarization is lossy. Details vanish. The model invents things. Forgets to implement the task as requested.

Ralph takes a different approach: treat context like managed memory.

Geoff calls it a "malloc orchestrator." Don't dump everything in and hope. Deliberately control what goes in. Pin a stable frame of reference. Let the session end. Start fresh.

while :; do cat task.md | agent; done

Simple loop. Deeper insight: state lives in files, not conversation.

Each iteration reconstructs reality from the filesystem-not from a polluted transcript of what went wrong.

Progress persists. Failures evaporate.

The Anthropic Connection

Anthropic's own context engineering guidance emphasizes re-anchoring from sources of truth. Their long-context documentation warns about context rot. They recommend fresh context windows with structured progress files.

Their sample ralph-wiggum plugin takes a different approach-single session, accumulating context, a stop hook that re-feeds the prompt without clearing history.

Flow-next follows the re-anchoring philosophy. Fresh context each iteration.

What Flow-Next Adds

Flow-Next cross-model review loop - Claude builds, GPT reviews, nobody ships until SHIP verdict

Cross-Model Review Gates

Same model writing code AND reviewing it = same blind spots. Context steers generation. The system converges to local coherence, not global correctness.

Self-testing is self-consistency. Not falsification.

Flow-next gates on cross-model review. A different model checks the work. Different weights, different priors. Use RepoPrompt (macOS) or Codex CLI (any platform) with GPT 5.2 High, or whatever reviewer you trust.

Two models > one.

Reviews Block, Not Flag

Most tools: "warning, proceed anyway?"

Flow-next: SHIP or fix it. No proceeding until the reviewer approves. Enforced re-reviews until SHIP verdict or max retry attempts (configurable, default 3).

Plan Before Work

Subagents gather context, analyze patterns, fetch docs, run gap analysis.

Plans get reviewed too-architecture, approach, scope checked by a different model before implementation starts.

Catches design issues when they're cheap to fix.

Structured Task Management

Full task graph in .flow/:

  • Epics and tasks with dependencies
  • Status tracking (todo → in_progress → done)
  • Evidence (commits, tests, PRs)
  • Review receipts

Everything version-controlled. Full audit trail.

Auto-Block Stuck Tasks

After N failures (default 3), the system blocks the task and moves on. No infinite loops burning your API budget or Claude Max subscription.

Re-Anchoring Every Iteration

Every iteration re-reads the epic spec, task spec, and git state. Reconstruct reality from sources of truth. Drift-proof.

Watch Mode

--watch streams tool calls in real-time so you can see what's happening without blocking autonomy. --watch verbose includes model responses too.

How I Actually Use Flow-Next

Full loop from idea to shipped code.

Phase 1: Spec

Start with what I want to build. Rough notes, bullet points, whatever works. Thinking time, not typing time.

Phase 2: Interview

/flow-next:interview

This is the underrated step. Claude asks probing questions:

  • Edge cases I didn't consider
  • Ambiguities that would cause implementation drift
  • Dependencies I forgot
  • Acceptance criteria that are actually testable

10-15 minutes of back-and-forth refines a rough spec into something precise.

This is where most of the value is. A crisp spec prevents 10x the debugging later. Often surfaces 2-3 things I didn't even consider.

Phase 3: Plan

/flow-next:plan <spec>

Claude breaks the spec into:

  • Epic (the objective)
  • Tasks (specific implementable units)
  • Task specs with acceptance criteria
  • Dependencies and ordering

This is the manual/automated cutoff.

After planning, I review. Does the breakdown make sense? Tasks small enough? Dependencies right?

If doing interactive work: run /flow-next:work <task> one at a time, staying in the loop.

If going fully autonomous: run the Ralph loop and let it execute the entire backlog.

For full autonomous mode, I prepare 5-10 plans before starting.

Phase 4a: Interactive Work

/flow-next:work fn-1.1 --review=rp

Work on an entire epic (fn-1) or single task (fn-1.1).

For each task:

  1. Claude implements
  2. Cross-model review via RepoPrompt or Codex
  3. If NEEDS_WORK → fix, re-review
  4. If SHIP → commit, next task

I'm watching, can intervene. Good for complex tasks, learning a new codebase, anything where taste matters.

Phase 4b: Ralph Mode

/flow-next:ralph-init  # one-time setup
scripts/ralph/ralph.sh --watch

The loop runs unattended:

  1. Fresh Claude session
  2. Re-anchor from filesystem (epic spec, task spec, git state)
  3. Plan review until SHIP
  4. Implement each task with review gates
  5. Auto-block after N failures
  6. Continue until epic complete

Kick it off before bed. Wake up to completed features or clear visibility into what's stuck.

Ralph autonomous loop terminal output showing multiple iterations with plan reviews, implementation reviews, and SHIP verdicts

Phase 5: Review and Merge

Whether interactive or autonomous, I review the PR before merging. AI generates, human approves.

Full audit trail-every review receipt, every commit, every status change.

When to Use What

  • Interview - Refining rough idea into crisp spec
  • Interactive work - Complex tasks, judgment calls, learning codebase
  • Ralph mode - Clear specs, bulk implementation, overnight runs

The heuristic: If you can write checkboxes, you can Ralph it. If you can't, you're not ready to loop-you're ready to think.

Get Started

Install:

/plugin marketplace add https://github.com/gmickel/gmickel-claude-marketplace
/plugin install flow-next
/flow-next:setup

Initialize Ralph mode:

/flow-next:ralph-init

Resources:

Two models > one. Process failures, not model failures. Agents that actually finish what they start.