Back to Skills

ralph-methodology

verified

Technical mechanics for autonomous AI coding loops

View on GitHub

Marketplace

majestic-marketplace

majesticlabs-dev/majestic-marketplace

Plugin

majestic-ralph

Repository

majesticlabs-dev/majestic-marketplace
19stars

plugins/majestic-ralph/skills/ralph-methodology/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/majesticlabs-dev/majestic-marketplace/blob/main/plugins/majestic-ralph/skills/ralph-methodology/SKILL.md -a claude-code --skill ralph-methodology

Installation paths:

Claude
.claude/skills/ralph-methodology/
Powered by add-skill CLI

Instructions

# Ralph Loop Mechanics

## How It Works

1. **Start:** User runs `/majestic-ralph:start "<prompt>" --max-iterations N --completion-promise "WORD"`
2. **Loop:** Stop hook intercepts session exit, re-feeds same prompt
3. **Exit:** Output `<promise>WORD</promise>` to signal genuine completion

## State File

Location: `.claude/ralph-loop.local.yml`

```yaml
iteration: 1
max_iterations: 50
completion_promise: DONE
started_at: 2024-01-15T10:30:00Z
prompt: |
  Your prompt here.
  Can be multiline.
```

## Completion Signal

Output exactly: `<promise>YOUR_PHRASE</promise>`

- Only output when genuinely complete
- Lying restarts the loop
- Max iterations is a hard stop

## Safety Rules

| Rule | Reason |
|------|--------|
| Idempotent operations | Migrations with `IF NOT EXISTS`, etc. |
| Non-interactive commands | No `-i` flags, no prompts |
| Clear exit criteria | Vague goals loop forever |

## Monitoring

```bash
# Check iteration
grep '^iteration:' .claude/ralph-loop.local.yml

# Cancel loop
/majestic-ralph:cancel
```

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
1012 chars