ralph-loop
Generate copy-paste bash scripts for Ralph Wiggum/AI agent loops (Codex, Claude Code, OpenCode, Goose). Use when asked for a "Ralph loop", "Ralph Wiggum loop", or an AI loop to plan/build code via PROMPT.md + AGENTS.md, SPECS, and IMPLEMENTATION_PLAN.md, including PLANNING vs BUILDING modes, backpressure, sandboxing, and completion conditions.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/endogen/monitored-ralph-loopRalph Loop (Event-Driven)
Enhanced Ralph pattern with event-driven notifications — Codex/Claude calls OpenClaw when it needs attention instead of polling.
Key Concepts
Clean Sessions
Each iteration spawns a fresh agent session with clean context. This is intentional:
- Avoids context window limits
- Each
codex execis a new process with no memory of previous runs - Memory persists via files:
IMPLEMENTATION_PLAN.md,AGENTS.md, git history
File-Based Notification Fallback
If OpenClaw is rate-limited when Codex sends a wake notification:
- The notification is written to
.ralph/pending-notification.txt - Wake is attempted (may fail)
- When OpenClaw recovers, it checks for pending notifications
- Work is never lost — it's all in git/files
File Structure
project/
├── PROMPT.md # Loaded each iteration (mode-specific)
├── AGENTS.md # Project context, test commands, learnings
├── IMPLEMENTATION_PLAN.md # Task list with status
├── specs/ # Requirements specs
│ ├── overview.md
│ └── <feature>.md
└── .ralph/
├── ralph.log # Execution log
├── pending-notification.txt # Current pending notification (if any)
└── last-notification.txt # Previous notification (for reference)
Notification Format
.ralph/pending-notification.txt:
{
"timestamp": "2026-02-07T02:30:00+01:00",
"project": "/home/user/my-project",
"message": "DONE: All tasks complete.",
"iteration": 15,
"max_iterations": 20,
"cli": "codex",
"status": "pending"
}
Status values:
pending— Wake failed or not attempteddelivered— Wake succeeded
OpenClaw Recovery Procedure
When coming back online after rate limit or downtime, check for pending notifications:
# Find all pending notifications across projects
find ~/projects -name "pending-notification.txt" -path "*/.ralph/*" 2>/dev/null
# Or check a specific project
cat /path/to/project/.ralph/pending-notification.txt
Recovery Actions by Message Prefix
| Prefix | Action |
|---|---|
DONE: | Report completion to user, summarize what was built |
PLANNING_COMPLETE: | Inform user, ask if ready for BUILDING mode |
PROGRESS: | Log it, update user if significant |
DECISION: | Present options to user, wait for answer, inject into AGENTS.md |
ERROR: | Check logs (.ralph/ralph.log), analyze, help or escalate |
BLOCKED: | Escalate to user immediately with full context |
QUESTION: | Present to user, get clarification, inject into AGENTS.md |
Injecting Responses
To answer a decision/question for the next iteration:
echo "## Human Decisions
- [$(date '+%Y-%m-%d %H:%M')] Q: <question>? A: <answer>" >> AGENTS.md
The next Codex session will read AGENTS.md and see the answer.
Clearing Notifications
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-endogen-monitored-ralph-loop": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
xian-sdk
Build applications on the Xian blockchain using the xian-py Python SDK. Use when developing apps that interact with Xian — wallets, transactions, smart contracts, state queries, token transfers. Covers sync and async patterns.
xian-node
Set up and manage Xian blockchain nodes. Use when deploying a Xian node to join mainnet/testnet, creating a new Xian network, or managing running nodes. Covers Docker-based setup via xian-stack, CometBFT configuration, and node monitoring.