ralph-wiggum
Implements the Ralph Wiggum technique for autonomous iterative development with deliberate context and state management.
Install
mkdir -p .claude/skills/ralph-wiggum && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1872" && unzip -o skill.zip -d .claude/skills/ralph-wiggum && rm skill.zipInstalls to .claude/skills/ralph-wiggum
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Implements the Ralph Wiggum autonomous iteration technique with deliberate context management. Use when building greenfield projects, iterating on well-defined tasks, or when continuous autonomous development is needed. Manages context like memory - tracks allocations, prevents redlining, and knows when to start fresh.Key capabilities
- →Execute iterative coding loops
- →Manage context as a finite resource
- →Accumulate guardrails from failure patterns
- →Track progress in persistent state files
- →Detect gutter situations for fresh starts
How it works
It treats the LLM context window as memory that cannot be freed, forcing a fresh start when context limits are reached or circular failures occur. It uses local files to persist state and guardrails across these resets.
Inputs & outputs
When to use ralph-wiggum
- →Iterating on greenfield development
- →Running autonomous coding loops
- →Managing long-running development context
- →Handling recursive coding tasks
About this skill
Ralph Wiggum: Autonomous Iteration with Context Engineering
Ralph is a technique for autonomous AI development. In its purest form, Ralph is a loop that repeatedly feeds the same prompt to an AI agent, letting it iterate on a task until completion. The key insight is that context is like memory - when you malloc() data into the context window, it cannot be free()'d except by starting fresh.
Core Philosophy
"That's the beauty of Ralph - the technique is deterministically bad in an undeterministic world."
Ralph will make mistakes. That's expected. Each mistake is an opportunity to add a "sign" (guardrail) that prevents that mistake in the future. Like tuning a guitar, you adjust Ralph until it plays the right notes.
The malloc/free Metaphor
- Context is memory: Everything loaded into the LLM's context window stays there
- You cannot free() context: The only way to clear context is to start a new conversation
- One task per context: Mixed concerns lead to autoregressive failure
- Don't redline: Pushing context to limits degrades performance
- Gutter detection: Once the bowling ball is in the gutter, start fresh
How This Skill Works
State Files (The Persistent Memory)
Ralph tracks state in files, NOT in context:
.ralph/
├── state.md # Current iteration, task, completion criteria
├── guardrails.md # Accumulated "signs" from observed failures
├── context-log.md # What's been loaded into context
├── failures.md # Failure patterns for learning
└── progress.md # What's been accomplished
The Iteration Cycle
- Read state files to understand current task and progress
- Check guardrails for relevant "signs" to follow
- Work on the task - implement, test, refine
- Update progress in files (not just context)
- Commit checkpoint via git
- Evaluate completion against criteria
- If not complete: Signal for next iteration
- If stuck: Detect gutter, suggest fresh context
Guardrails ("Signs")
When Ralph makes a mistake, add a sign:
## Sign: Don't Jump Off The Slide
- **Trigger**: When implementing authentication
- **Instruction**: Always validate tokens before trusting claims
- **Added after**: Iteration 5 - security vulnerability introduced
Signs accumulate in guardrails.md and are injected into future iterations.
Usage
Starting a Ralph Loop
Create a RALPH_TASK.md file in your project root:
---
task: Build a REST API for task management
completion_criteria:
- All CRUD endpoints working
- Input validation implemented
- Tests passing with >80% coverage
- API documentation complete
max_iterations: 50
---
## Requirements
Build a task management API with the following endpoints:
- POST /tasks - Create a task
- GET /tasks - List all tasks
- GET /tasks/:id - Get a task
- PUT /tasks/:id - Update a task
- DELETE /tasks/:id - Delete a task
## Constraints
- Use TypeScript
- Use Express.js
- Use SQLite for storage
- Follow REST conventions
Then tell Cursor: "Start a Ralph loop on this task"
Monitoring Progress
Check .ralph/progress.md to see what's been accomplished:
## Iteration 1
- Created project structure
- Implemented POST /tasks endpoint
- Status: Partial progress
## Iteration 2
- Added GET endpoints
- Fixed validation bug
- Status: Continuing
When to Start Fresh
Ralph will detect "gutter" situations:
- Same error repeated 3+ times
- Context approaching limits
- Circular failure patterns
When detected, Ralph will suggest: "Context is polluted. Recommend starting fresh conversation."
Best Practices
1. Clear Completion Criteria
❌ Bad: "Make a good API" ✅ Good: "All tests passing, coverage >80%, docs complete"
2. Incremental Goals
❌ Bad: "Build complete e-commerce platform" ✅ Good: Phase 1: Auth, Phase 2: Products, Phase 3: Cart
3. Let Failures Teach
Don't intervene too quickly. Let Ralph fail, then add signs.
4. Trust the Files
Progress is in files and git, not in your head or the context.
5. Fresh Context is Cheap
Don't hesitate to start fresh. State persists in files.
Integration with Cursor Hooks
This skill uses Cursor hooks for:
- beforeSubmitPrompt: Inject guardrails and context awareness
- beforeReadFile: Track context allocations
- afterFileEdit: Update progress tracking
- stop: Evaluate completion, trigger next iteration or fresh start
See scripts/ for hook implementations.
Learn More
- Original technique: https://ghuntley.com/ralph/
- Context engineering: https://ghuntley.com/gutter/
- malloc/free metaphor: https://ghuntley.com/allocations/
When not to use it
- →For simple, one-off tasks that do not require iteration
- →When the task scope is too large to break into incremental goals
Prerequisites
Limitations
- →Requires manual intervention to add signs after failures
- →Context pollution necessitates frequent conversation resets
How it compares
It replaces manual, continuous prompting with a structured loop that uses persistent state files to maintain progress across context resets.
Compared to similar skills
ralph-wiggum side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| ralph-wiggum (this skill) | 11 | 6mo | Review | Intermediate |
| command-development | 16 | 9mo | Review | Intermediate |
| skill-forge | 11 | 9mo | Review | Intermediate |
| codex-skill | 12 | 5mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
command-development
anthropics
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
skill-forge
WilliamSaysX
Automated skill creation workshop with intelligent source detection, smart path management, and end-to-end workflow automation. This skill should be used when users want to create a new skill or convert external resources (GitHub repositories, online documentation, or local directories) into a skill. Automatically fetches, organizes, and packages skills with proactive cleanup management.
codex-skill
feiskyer
Use when user asks to leverage codex, gpt-5, or gpt-5.1 to implement something (usually implement a plan or feature designed by Claude). Provides non-interactive automation mode for hands-off task execution without approval prompts.
agent-factory
alirezarezvani
Claude Code agent generation system that creates custom agents and sub-agents with enhanced YAML frontmatter, tool access patterns, and MCP integration support following proven production patterns
subagent-driven-development
davila7
Use when executing implementation plans with independent tasks in the current session
peekaboo
openclaw
Capture and automate macOS UI with the Peekaboo CLI.