Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

The Ralph Wiggum Technique

Join me as I perform a deep-dive into the agentic looping technique known as "Ralph Wiggum." In this series, we’re not just building a script, we’re building the surrounding system that makes an agent reliable enough to collaborate with. We’ll work through permissions, sandbox rules, hooks, and safer ways to run in more autonomous modes.

By the end, we’ll have something much bigger than a typical demo: a working approach for spec-driven agent development that can run locally, in the background, or on a remote machine over SSH. Let's go!

Series trailer thumbnail

Progress

Series Info

Episodes
16
Run Time
1h 56m
Difficulty
Intermediate
Last Updated
May 18, 2026
Version
Latest

Series Episodes

  1. Episodes (16)
    1. What Is Ralph?

      Let’s kick things off by building a simple Ralph.sh loop and seeing how this agentic workflow actually works in practice. We’re not trying to make it fancy yet, just to understand why restarting the model with lightweight memory files like project.md and progress.md can be such a powerful way to ship work.
    2. Improving Our First Ralph Loop

      Now that we have our basic ralph loop in place, let's make it feel a lot less blind by surfacing what the model is doing in real time. We'll move from the old shell script to a small Node.js wrapper that can parse stream-json output into something actually readable while keeping the same overall loop architecture.
    3. What Is A PRD?

      Now that we have a feel for the onboarding problem, we’re going to step back and shape an agent-ready PRD that gives the model the right context, constraints, and success criteria before it writes a single line of code. The goal here is to front load the important decisions so our loop can execute with far less guesswork and a much better shot at shipping the right thing.
    4. Creating A PRD With Our PRD Skill

      Now that we have our PRD skill in place, we are going to put it to work and see how a well scoped spec can drive an agent through a real feature build. Along the way, we will refine the generated plan a bit, feed it into our rel.js loop, and check whether the end result actually holds up in the app.
    5. Running Ralph In The Background

      Let's take a minute to make our terminal setup a lot more resilient so we do not lose long running work every time we accidentally close a window. We will get comfortable with screen and tmux, with extra attention on a simple tmux workflow that lets us keep multiple loops and tools running in the background.
    6. Permissions And Sandboxing

      Now that we have the basic permission flow in place, we’re going to tighten things up and make the CLI a lot less noisy by configuring what can run automatically. We’ll look at allow and deny rules, then move into the native sandbox so we can give the model some freedom without giving up safety.
    7. Configuring Hooks

      Now that we have the sandbox handling the basics, we need to tighten up how permission checks work for mcp tools that live outside that flow. We’ll use pre-tool-use hooks to intercept requests, allow or deny them more intelligently, and even explore how a model driven reviewer can act as a second set of eyes.
    8. A Word On Auto Mode

      Before we jump into bypass permission mode, we should pause for a quick look at Anthropic's new Auto mode, since it overlaps a lot with the hook based approach we just set up in the previous lesson. We'll check out what it does well, where it still feels shaky in practice, and why we're still moving on to a safer way to bypass the permission system ourselves.
    9. Bypassing Permissions Safely

      Now that we have played it safe with permissions, we are going to flip that around and explore what happens when we run in bypass permissions mode. The real focus is figuring out how to keep that power from becoming dangerous by leaning on sandboxes and eventually moving into a more isolated setup like Yolo box.
    10. Turning Our Ralph Script Into a Flexible CLI

      In this lesson, we're taking our simple Ralph.js script and turning it into a polished CLI that feels much more flexible and pleasant to use. We'll lean on Bun, OpenTUI, and a PRD driven workflow to sketch, generate, and test a tabbed terminal interface with support for things like YoloBox.
    11. Agent Workspaces

      Up to this point, we have been letting Ralph run directly on our main branch, and that gets awkward fast once we want to keep coding without stepping on the agent's work. In this lesson, we will give Ralph a proper workspace of its own with approaches like git worktree and copy on write so our loops stay isolated, easier to test, and a lot less disruptive.
    12. Tracking PRDs With Linear

      Up to this point, we’ve been managing PRDs in flat files, but now it’s time to move that workflow into Linear so we can get better hierarchy, richer issue context, and a smoother handoff to Relo. We’ll wire up the integration, generate parent and child issues from a PRD, and watch the whole flow run from tracking to automated pull request creation.
    13. Human In The Loop

      In this lesson, we're going to put some guardrails around Ralph by introducing a human in the loop workflow for the moments when the model is making important architectural calls. We'll let it propose a data shape for menu customizations, step in to review and nudge it, and then watch how that small bit of feedback keeps the rest of the feature on track.
    14. Offloading Loops To A Remote Machine

      Now that we've seen Ralph running locally, let's move it onto a remote machine so we can keep our workflow available across devices and out of our laptop's orbit. We'll set up a remote worker over SSH, lean on tmux for persistence, and then use the built in remote mode to dispatch loops while still keeping a nice local control pane.
    15. Experimenting With A Perpetual Loop

      Now that we've let this autonomous loop run wild, we're going to step back and look at what it actually produced and how far this experiment really got us. Then we'll start zooming out beyond Ralph itself and head toward the bigger idea of agent orchestration.
    16. Beyond Ralph Orchestration

      Now that we have all the core pieces in place, let's zoom out and see what this can look like as a real orchestration system by wiring Linear, multiple workflow.md style files, and our own agent loops together. We'll build a more flexible take on Symphony that supports Claude and routing, so we can watch these ideas move from isolated experiments into something we could actually use day to day.

Continue Learning