How to use these tihngs.
Like most people, I have had success with splitting things into a planning stage followed by an implementation stage. The implementation phase can be kind of synchronous/interactive, or can be a fully auto Ralph loop.
Models have a limited context window. You want to use the plan phase to create a written document that another instance can easily follow. You want short, discrete tasks.
See the basic workflow -- brainstorming command
and writing-plans command.
specify, plan, tasks, implement, in that order.
- The blog post -- Spec-driven development with AI: Get started with a new open source toolkit
- the repo
The plan is where the real 'work' happens. It's where you create your specs. The execution can usually switch to a cheaper model to save tokens.
These plugins are nice because they tend to give
you specific instructions about what to do next, ie what to
do after the plan phase -- things like /clear the context window, then tell
the next machine to read the doc at abc/123.md. Note the chart for the
plan-and-execute plugin:
Rough Idea
│
▼
/start-design-plan ──────► Design Document (committed to git)
│
▼
/start-implementation-plan ──► Implementation Plan (phase files)
│
▼
/execute-implementation-plan ──► Working Code (reviewed & committed)
Each step breaks it into pieces.
Just type /plan. Instruct it to create a written list of tasks.
I highly recommend this video.
The name Ralph Wiggum Loop made me think it was a joke or something, but it's actually a kind of sophisticated protocol for optimizing the "context window". These things perform better with smaller amounts of context. The Ralph loop is about breaking down a problem into many small, atomic tasks that can be completed before the context window fills up too much.
It is a bash loop.
Good old bash.
It creates an agent, the agent aims to complete 1 task, then it kills the agent and starts a fresh one. That way the context never becomes overly saturated.
It has this basic form:
while :; do cat PROMPT.md | claude ; doneOf course there is more to it than that. The video is the best intro imo.
See this gist for a more realistic example of a loop, and also nearestnabors/ralph-wiggum-loop-starter
Have the agent interview you to determine the PRD document.
I have a skill installed in my ~/.claude/skills directory at
path ~/.claude/skills/prd/SKILL.md. That's how you install a skill.
You just paste some markdown to a specific location in your home directory.
See skills/prd.
I've been using a ralph skill for this.
- nearestnabors/ralph-wiggum-loop-starter
- Navigator's Guild, a Discord server
- ed3d.net, Discord server
- Impeccable -- Design fluency for AI harnesses (this is good)
- github.com/ghuntley -- The Ralph Playbook.
- The Ralph Playbook 2
- everything is a ralph loop
- repomirror/repomirror.md
- github.com/nichoth/ralph -- an expanded form of this document
- github.com/snarktank/ralph