Ralph

From sigridjineth/oh-my-codex · View interactive version

Ralph is an AI agent skill from the GitHub repository sigridjineth/oh-my-codex. Self-referential loop until task completion with architect verification

How to use this skill

Skill file

[RALPH + ULTRAWORK - ITERATION {{ITERATION}}/{{MAX}}]

Your previous attempt did not output the completion promise. Continue working on the task.

<Purpose>

Ralph is a persistence loop that keeps working on a task until it is fully complete and architect-verified. It wraps ultrawork's parallel execution with session persistence, automatic retry on failure, and mandatory verification before completion.

</Purpose>

<Use_When>

</Use_When>

<Do_Not_Use_When>

</Do_Not_Use_When>

<Why_This_Exists>

Complex tasks often fail silently: partial implementations get declared "done", tests get skipped, edge cases get forgotten. Ralph prevents this by looping until work is genuinely complete, requiring fresh verification evidence before allowing completion, and using tiered architect review to confirm quality.

</Why_This_Exists>

<Execution_Policy>

</Execution_Policy>

<Steps>

  1. Review progress: Check TODO list and any prior iteration state
  2. Continue from where you left off: Pick up incomplete tasks
  3. Delegate in parallel: Route tasks to specialist agents at appropriate tiers
  1. Run long operations in background: Builds, installs, test suites use run_in_background: true
  2. Verify completion with fresh evidence:

a. Identify what command proves the task is complete

b. Run verification (test, build, lint)

c. Read the output -- confirm it actually passed

d. Check: zero pending/in_progress TODO items

  1. Architect verification (tiered):
  1. On approval: Run /oh-my-codex:cancel to cleanly exit and clean up all state files
  2. On rejection: Fix the issues raised, then re-verify at the same tier

</Steps>

<Tool_Usage>

</Tool_Usage>

<Examples>

<Good>

Correct parallel delegation:

Task(subagent_type="oh-my-codex:executor-low", model="haiku", prompt="Add type export for UserConfig")
Task(subagent_type="oh-my-codex:executor", model="sonnet", prompt="Implement the caching layer for API responses")
Task(subagent_type="oh-my-codex:executor-high", model="opus", prompt="Refactor auth module to support OAuth2 flow")

Why good: Three independent tasks fired simultaneously at appropriate tiers.

</Good>

<Good>

Correct verification before completion:

1. Run: npm test           → Output: "42 passed, 0 failed"
2. Run: npm run build      → Output: "Build succeeded"
3. Run: lsp_diagnostics    → Output: 0 errors
4. Spawn architect-medium  → Verdict: "APPROVED"
5. Run /oh-my-codex:cancel

Why good: Fresh evidence at each step, architect verification, then clean exit.

</Good>

<Bad>

Claiming completion without verification:

"All the changes look good, the implementation should work correctly. Task complete."

Why bad: Uses "should" and "look good" -- no fresh test/build output, no architect verification.

</Bad>

<Bad>

Sequential execution of independent tasks:

Task(executor-low, "Add type export") → wait →
Task(executor, "Implement caching") → wait →
Task(executor-high, "Refactor auth")

Why bad: These are independent tasks that should run in parallel, not sequentially.

</Bad>

</Examples>

<Escalation_And_Stop_Conditions>

</Escalation_And_Stop_Conditions>

<Final_Checklist>

</Final_Checklist>

<Advanced>

PRD Mode (Optional)

When the user provides the --prd flag, initialize a Product Requirements Document before starting the ralph loop.

Detecting PRD Mode

Check if {{PROMPT}} contains --prd or --PRD.

PRD Workflow

  1. Create .omc/prd.json and .omc/progress.txt
  2. Parse the task (everything after --prd flag)
  3. Break down into user stories:
{
  "project": "[Project Name]",
  "branchName": "ralph/[feature-name]",
  "description": "[Feature description]",
  "userStories": [
    {
      "id": "US-001",
      "title": "[Short title]",
      "description": "As a [user], I want to [action] so that [benefit].",
      "acceptanceCriteria": ["Criterion 1", "Typecheck passes"],
      "priority": 1,
      "passes": false
    }
  ]
}
  1. Create progress.txt with timestamp and empty patterns section
  2. Guidelines: right-sized stories (one session each), verifiable criteria, independent stories, priority order (foundational work first)
  3. Proceed to normal ralph loop using user stories as the task list

Example

User input: --prd build a todo app with React and TypeScript

Workflow: Detect flag, extract task, create .omc/prd.json, create .omc/progress.txt, begin ralph loop.

Background Execution Rules

Run in background (run_in_background: true):

Run blocking (foreground):

</Advanced>

Original task:

{{PROMPT}}

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.