home / skills / supercent-io / skills-template / ralph-loop
This skill enforces completion by looping until the task finishes, injecting continuations and signaling DONE or custom promises.
npx playbooks add skill supercent-io/skills-template --skill ralph-loopReview the files below or copy the command above to add this skill to your agents.
---
name: ralph-loop
description: Self-referential completion loop for OpenCode. Re-injects continuation prompts until the task is fully complete with a completion promise.
allowed-tools: [Read, Write, Bash, Grep, Glob]
tags: [opencode, ralph-loop, ultrawork, loop, completion]
platforms: [OpenCode, Claude, Gemini, Codex]
version: 1.0.0
source: sst/opencode + code-yeongyu/oh-my-opencode
---
# ralph-loop - Completion Enforcement Loop
## When to use this skill
- Long-running implementation tasks that tend to stop early
- Tasks that need strict completion signaling
- Workflows using `ultrawork` / `ulw` in OpenCode
- Sessions where the agent must continue until exact completion
---
## 1. Core Command Pattern
Use the built-in command form:
```text
/ralph-loop "<task description>" [--completion-promise=TEXT] [--max-iterations=N]
```
Defaults:
- Completion promise: `DONE`
- Max iterations: `100`
---
## 2. How the Loop Behaves
1. Starts with your task prompt.
2. On each idle cycle, verifies whether the assistant output contains:
```xml
<promise>DONE</promise>
```
3. If not found, injects a continuation prompt and increments iteration.
4. Stops only when:
- Completion promise is detected, or
- Max iterations is reached, or
- You run `/cancel-ralph`.
---
## 3. Practical Usage
### Standard run
```text
/ralph-loop "Refactor auth module and finish all tests"
```
### Custom promise
```text
/ralph-loop "Migrate API clients to v2" --completion-promise=SHIP_IT
```
### Bounded iteration run
```text
/ralph-loop "Fix flaky CI tests" --max-iterations=20
```
### Cancel active loop
```text
/cancel-ralph
```
---
## 4. Integration Notes for skills-template
- Keep this skill as an operational guide for OpenCode workflows.
- Pair with orchestration skills (for example, `ohmg`) when tasks require delegation.
- Require explicit completion tags in final responses to avoid premature stop.
---
## Quick Reference
| Action | Command |
|--------|---------|
| Start loop | `/ralph-loop "task"` |
| Custom promise | `/ralph-loop "task" --completion-promise=TEXT` |
| Iteration cap | `/ralph-loop "task" --max-iterations=N` |
| Cancel | `/cancel-ralph` |
This skill enforces completion by looping on a task until an explicit completion promise appears in the assistant output. It reinjects continuation prompts automatically and stops only when a configured promise tag is detected, a max iteration limit is reached, or a cancel command is issued. The skill is designed for long-running or easily-truncated workflows that require strict finish signaling.
You start the loop with a single command containing the task description and optional parameters for the completion promise and max iterations. On each cycle the skill checks the assistant output for a matching completion tag (for example <promise>DONE</promise>). If the tag is missing it sends a continuation prompt and counts another iteration. The loop terminates when the promise is found, iterations hit the cap, or you cancel the loop.
What is the default completion promise?
The default promise is DONE, represented as <promise>DONE</promise> in output.
How do I stop the loop manually?
Run the cancel command to halt an active loop immediately using /cancel-ralph.