home / skills / glittercowboy / taches-cc-resources / setup-ralph

setup-ralph skill

/skills/setup-ralph

This skill helps you initialize and configure a Ralph Wiggum autonomous coding loop with proper structure, prompts, and backpressure.

npx playbooks add skill glittercowboy/taches-cc-resources --skill setup-ralph

Review the files below or copy the command above to add this skill to your agents.

Files (16)
SKILL.md
4.3 KB
---
name: setup-ralph
description: Set up and configure Geoffrey Huntley's original Ralph Wiggum autonomous coding loop in any directory with proper structure, prompts, and backpressure.
---

<essential_principles>
## What is Ralph?

Ralph is Geoffrey Huntley's autonomous AI coding methodology that uses iterative loops with task selection, execution, and validation. In its purest form, it's a Bash loop:

```bash
while :; do cat PROMPT.md | claude ; done
```

The loop feeds a prompt file to Claude, the agent completes one task, updates the implementation plan, commits changes, then exits. The loop restarts immediately with fresh context.

### Core Philosophy

**The Ralph Wiggum Technique is deterministically bad in an undeterministic world.** Ralph solves context accumulation by starting each iteration with fresh context—the core insight behind Geoffrey's approach.

### Three Phases, Two Prompts, One Loop

1. **Planning Phase**: Gap analysis (specs vs code) outputs prioritized TODO list—no implementation, no commits
2. **Building Phase**: Picks tasks from plan, implements, runs tests (backpressure), commits
3. **Observation Phase**: You sit on the loop, not in it—engineer the setup and environment that allows Ralph to succeed

### Key Principles

**Your Role**: Ralph does all the work, including deciding which planned work to implement next and how to implement it. Your job is to engineer the environment.

**Backpressure**: Create backpressure via tests, typechecks, lints, builds that reject invalid/unacceptable work.

**Observation**: Watch, especially early on. Prompts evolve through observed failure patterns.

**Context Efficiency**: With ~176K usable tokens from 200K window, allocating 40-60% to "smart zone" means tight tasks with one task per loop achieves maximum context utilization.

**File I/O as State**: The plan file persists between isolated loop executions, serving as deterministic shared state—no sophisticated orchestration needed.

**Remote Backup**: The loop automatically creates a private GitHub repo and pushes after each commit. This protects against accidental data loss from autonomous operations. Requires `gh` CLI authenticated. Disable with `RALPH_BACKUP=false`.

**Safety Rules**: PROMPT_build.md includes critical safety rules prohibiting dangerous operations like `rm -rf` on project directories. Tests must run in isolated temp directories.
</essential_principles>

<intake>
What would you like to do?

1. **Set up a new Ralph loop** - Initialize Ralph structure in a directory
2. **Understand Ralph concepts** - Learn about the technique and how it works
3. **Customize existing loop** - Modify prompts or configuration
4. **Troubleshoot Ralph** - Debug loop issues or improve performance

Wait for response before proceeding.
</intake>

<routing>
| Response | Workflow |
|----------|----------|
| 1, "set up", "setup", "new", "initialize", "create" | `workflows/setup-new-loop.md` |
| 2, "understand", "learn", "concepts", "explain", "how" | `workflows/understand-ralph.md` |
| 3, "customize", "modify", "change", "update", "edit" | `workflows/customize-loop.md` |
| 4, "troubleshoot", "debug", "fix", "problem", "issue" | `workflows/troubleshoot-loop.md` |
| Other | Clarify intent, then select appropriate workflow |

After reading the workflow, follow it exactly.
</routing>

<reference_index>
## Domain Knowledge

All in `references/`:

**Core Concepts:** ralph-fundamentals.md - Three phases, two prompts, one loop
**Structure:** project-structure.md - Required files and directory layout
**Prompts:** prompt-design.md - Planning vs building mode instructions
**Backpressure:** validation-strategy.md - Tests, lints, builds as steering
**Best Practices:** operational-learnings.md - AGENTS.md guidance and evolution
</reference_index>

<workflows_index>
| Workflow | Purpose |
|----------|---------|
| setup-new-loop.md | Initialize Ralph structure in a directory |
| understand-ralph.md | Learn Ralph concepts and philosophy |
| customize-loop.md | Modify prompts or loop configuration |
| troubleshoot-loop.md | Debug loop issues and improve performance |
</workflows_index>

<success_criteria>
Skill is successful when:
- User understands which workflow they need
- Appropriate workflow loaded based on intent
- All required references loaded by workflow
- User can set up and run Ralph loops independently
</success_criteria>

Overview

This skill sets up Geoffrey Huntley’s Ralph Wiggum autonomous coding loop in any directory, creating the proper file structure, prompts, and safety/backpressure mechanisms. It provides commands and templates to initialize the loop, enable automated commits and optional GitHub backups, and enforce tests and safety rules. The goal is to let the agent iterate reliably while you observe and tune the environment.

How this skill works

The setup creates a deterministic loop: a planning prompt produces a prioritized TODO list, a building prompt implements one task and runs validation, and the loop restarts with fresh context. It installs project files (PROMPT_plan.md, PROMPT_build.md, plan state, validation scripts), example CI-style tests for backpressure, and optional GitHub push hooks via the gh CLI. Safety rules and isolated test execution are included to prevent destructive operations.

When to use it

  • Initialize a new autonomous Claude/Anthropic loop in a repository or directory
  • Try Ralph when you want continuous, single-task iterations with minimal context bleed
  • Add deterministic backpressure via tests, linters, and typechecks
  • Create a safe sandbox for agent-driven development with remote backups
  • Prototype autonomous coding workflows before scaling to multiple agents

Best practices

  • Use one task per loop to maximize context efficiency and keep prompts focused
  • Provide strong backpressure: failing tests should block commits and force rework
  • Keep PROMPT_plan.md and PROMPT_build.md separate; plan must not implement code
  • Run tests in temporary isolated directories to limit side effects
  • Enable automatic GitHub push only after confirming gh CLI is authenticated; set RALPH_BACKUP=false to disable

Example use cases

  • Bootstrap a new project directory with Ralph structure and starter prompts
  • Convert an existing repo into an autonomous loop that iterates on one task at a time
  • Experiment with different backpressure strategies (unit tests, builds, linters) to guide agent behavior
  • Customize build prompts to enforce company coding standards and safety rules
  • Use the loop as a reproducible environment for prompt engineering and failure-mode observation

FAQ

How does the loop avoid accumulating context?

Each iteration runs with fresh context because the agent reads the prompt files anew and the persistent plan file is the only shared state, preventing hidden context growth.

Is remote backup required?

No. The setup supports automatic GitHub pushes using the gh CLI, which is strongly recommended for safety, but you can disable it by setting RALPH_BACKUP=false.