Ralph Mode - Autonomous Development Loops
Autonomous development loops with iteration, backpressure gates, and completion criteria. Use for sustained coding sessions that require multiple iterations, test validation, and structured progress t
Autonomous development loops with iteration, backpressure gates, and completion criteria. Use for sustained coding sessions that require multiple iterations, test validation, and structured progress t
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
Ralph Mode implements the Ralph Wiggum technique adapted for OpenClaw: autonomous task completion through continuous iteration with backpressure gates, completion criteria, and structured planning.
Use Ralph Mode when:
Phase 1: Requirements Definition
specs/ (one file per topic of concern)Phase 2: Planning
IMPLEMENTATION_PLAN.md with prioritized tasksPhase 3: Building (Iterative)
Reject incomplete work automatically through validation:
Programmatic Gates (Always use these):
[test command] - Must pass before committing[typecheck command] - Catch type errors early[lint command] - Enforce code quality[build command] - Verify integrationSubjective Gates (Use for UX, design, quality):
Create this structure for each Ralph Mode project:
project-root/ ├── IMPLEMENTATION_PLAN.md # Shared state, updated each iteration ├── AGENTS.md # Build/test/lint commands (~60 lines) ├── specs/ # Requirements (one file per topic) │ ├── topic-a.md │ └── topic-b.md ├── src/ # Application code └── src/lib/ # Shared utilities
Priority task list - single source of truth. Format:
# Implementation PlanIn Progress
- Task name (iteration N)
- Notes: discoveries, bugs, blockers
Completed
- Task name (iteration N)
Backlog
Future task
Can you describe the topic in one sentence without "and"?
Succinct guide for running the project. Keep under 60 lines:
# Project OperationsBuild Commands
npm run dev # Development server npm run build # Production build
Validation
npm run test # All tests npm run lint # ESLint npm run typecheck # TypeScript npm run e2e # E2E tests
Operational Notes
Tests must pass before committing
Typecheck failures block commits
Use existing utilities from src/lib over ad-hoc copies
Specialized roles for different tasks:
Hat: Architect (
@architect)
Hat: Implementer (
@implementer)
Hat: Tester (
@tester)
Hat: Reviewer (
@reviewer)
Usage:
"Spawn a sub-agent with @architect hat to design the data model"
Your job as main agent: engineer setup, observe, course-correct.
Each sub-agent iteration:
Loop ends when:
Define success upfront - avoid "seems done" ambiguity.
[test_command] returns 0For quality criteria that resist automation:
## Completion Check - UX Quality Criteria: Navigation is intuitive, primary actions are discoverable Test: User can complete core flow without confusionCompletion Check - Design Quality
Criteria: Visual hierarchy is clear, brand consistency maintained Test: Layout follows established patterns
Run LLM-as-judge sub-agent for binary pass/fail.
specs/ ├── authentication.md ├── database.md └── api-routes.mdsrc/ ├── app/ # App Router ├── components/ # React components ├── lib/ # Utilities (db, auth, helpers) └── types/ # TypeScript types
AGENTS.md: Build: npm run dev Test: npm run test Typecheck: npx tsc --noEmit Lint: npm run lint
specs/ ├── data-pipeline.md ├── model-training.md └── api-endpoints.mdsrc/ ├── pipeline.py ├── models/ ├── api/ └── tests/
AGENTS.md: Build: python -m src.main Test: pytest Typecheck: mypy src/ Lint: ruff check src/
specs/ ├── model-architecture.md ├── training-data.md └── inference-pipeline.mdsrc/ ├── models/ ├── training/ ├── inference/ └── utils/
AGENTS.md: Train: python train.py Test: pytest tests/ Lint: ruff check src/ GPU Check: nvidia-smi
Start a Ralph Mode session:
"Start Ralph Mode for my project at ~/projects/my-app. I want to implement user authentication with JWT.
I will:
When Ralph patterns emerge, update AGENTS.md:
## Discovered Patterns
When adding API routes, also add to OpenAPI spec
Use existing db utilities from src/lib/db over direct calls
Test files must be co-located with implementation
When trajectory goes wrong:
For subjective criteria (tone, aesthetics, UX):
Create
src/lib/llm-review.ts:
interface ReviewResult { pass: boolean; feedback?: string; }async function createReview(config: { criteria: string; artifact: string; // text or screenshot path }): Promise<ReviewResult>;
Sub-agents discover and use this pattern for binary pass/fail checks.
Based on empirical usage, enforce these practices to avoid silent failures:
Ralph MUST write to PROGRESS.md after EVERY iteration. This is non-negotiable.
Create
PROGRESS.md in project root at start:
# Ralph: [Task Name]Iteration [N] - [Timestamp]
Status
- In Progress | [ ] Blocked | [ ] Complete
What Was Done
- [Item 1]
- [Item 2]
Blockers
- None | [Description]
Next Step
[Specific next task from IMPLEMENTATION_PLAN.md]
Files Changed
path/to/file.ts
- [brief description]
Why: External observers (parent agents, crons, humans) can tail one file instead of scanning directories or inferring state from session logs.
Before spawning a new Ralph session:
sessions_listAnti-pattern: Spawning Ralph v2 while v1 is still running = file conflicts, race conditions, lost work.
Never assume directory structure. At start of each iteration:
// Verify current working directory const cwd = process.cwd(); console.log(`Working in: ${cwd}`);// Verify expected paths exist if (!fs.existsSync('./src/app')) { console.error('Expected ./src/app, found:', fs.readdirSync('.')); // Adapt or fail explicitly }
Why: Ralph may be spawned from different contexts with different working directories.
When done, Ralph MUST:
PROGRESS.md with "## Status: COMPLETE"Example completion PROGRESS.md:
# Ralph: Influencer Detail PageStatus: COMPLETE ✅
Finished: [ISO timestamp]
Final Verification
- TypeScript: Pass
- Tests: Pass
- Build: Pass
Files Created
src/app/feature/page.tsxsrc/app/api/feature/route.tsTesting Instructions
- Run:
npm run dev- Visit:
http://localhost:3000/featureVerify: [specific checks]
If Ralph encounters unrecoverable errors:
Do not silently fail. A Ralph that stops iterating with no progress log is indistinguishable from one still working.
Set explicit iteration timeouts:
## Operational Parameters - Max iteration time: 10 minutes - Total session timeout: 60 minutes - If iteration exceeds limit: Log blocker, exit
Why: Prevents infinite loops on stuck tasks, allows parent agent to intervene.
After each Ralph Mode session, document:
## [Date] Ralph Mode SessionProject: [project-name] Duration: [iterations] Outcome: success / partial / blocked Learnings:
What worked well
What needs adjustment
Patterns to add to AGENTS.md
Common anti-patterns observed:
| Anti-Pattern | Consequence | Prevention |
|---|---|---|
| No progress logging | Parent agent cannot determine status | Mandatory PROGRESS.md |
| Silent failure | Work lost, time wasted | Explicit error logging |
| Overlapping sessions | File conflicts, corrupt state | Check/cleanup before spawn |
| Path assumptions | Wrong directory, wrong files | Explicit verification |
| No completion signal | Parent waits indefinitely | Clear COMPLETE status |
| Infinite iteration | Resource waste, no progress | Time limits + blockers |
| Complex initial prompts | Sub-agent never starts (empty session logs) | SIMPLIFY instructions |
Evidence: Empty session logs (2 bytes), no tool calls, 0 tokens used
## Task: [ONE specific thing]File: exact/path/to/file.ts What: Exact description of change Validate: Exact command to run Then: Update PROGRESS.md and exit
Rules
- Do NOT look at other files
- Do NOT "check first"
Make the change, validate, exit
Fix all TypeScript errors across these files: - lib/db.ts has 2 errors - lib/proposal-service.ts has 5 errors - route.ts has errors Check which ones to fix first, then...
Fix lib/db.ts line 27: Change: PoolClient to pg.PoolClient Validate: npm run typecheck Exit immediately after
Each Ralph iteration gets ONE file. Not "all errors", not "check then decide". ONE file, ONE change, validate, exit.
MANDATORY: After EVERY iteration, update PROGRESS.md with:
## Iteration [N] - [Timestamp]Status: Complete ✅ | Blocked ⛔ | Failed ❌
What Was Done
- [Specific changes made]
Validation
- [Test/lint/typecheck results]
Next Step
[What should happen next]
Why this matters: Cron job reads PROGRESS.md for status updates. If not updated, status appears stale/repetitive.
If Ralph stalls:
If cron reports same status repeatedly:
Ralph works when: Single file focus + explicit change + validate + exit Ralph stalls when: Complex decisions + multiple files + conditional logic
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.