Ralph Loop for Openclaw

A framework to generate autonomous bash scripts that run AI coding agents in continuous planning and building loops.

jordyvandomselaar
v0.1.1
Jan 27, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install ralph-loop

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install ralph-loop using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Ralph Loop?

The Ralph Loop is a structured workflow designed to manage the lifecycle of AI-driven code generation. By leveraging Openclaw Skills, it transitions through requirement definition, specification drafting, and iterative loops for planning and building. It ensures that AI agents like Claude Code or Codex remain aligned with project goals through persistent context files such as PROMPT.md and AGENTS.md, providing a robust mechanism for autonomous development.

This approach solves the problem of context loss during long-running tasks by reloading critical project metadata and instructions at every iteration. Whether you are using a minimal shell loop or a controlled bash script with safety guardrails, the Ralph Loop ensures that the AI stays on track until a specific completion condition is met.

Ralph Loop Use Cases

  • Automating complex code refactoring across multiple files using a BUILDING loop.
  • Generating comprehensive technical specifications and implementation plans before writing code.
  • Running continuous test-driven development cycles where the AI agent fixes bugs until tests pass.
  • Scaling AI-driven development by using auto-approve flags in sandboxed environments.

How Ralph Loop Works

  1. Requirements are gathered and broken down into individual topics of concern stored in spec files within the project directory.
  2. A PLANNING loop is initiated to create or update an IMPLEMENTATION_PLAN.md without performing any actual code implementation.
  3. A BUILDING loop executes tasks from the plan, runs backpressure commands like tests or lints, and commits changes to the repository.
  4. Persistent context is maintained via PROMPT.md and AGENTS.md, which are reloaded and fed into the AI agent in every iteration.
  5. The loop terminates automatically once a predefined completion condition, such as a promise phrase or a sentinel value in the implementation plan, is detected.

Ralph Loop Setup

To begin using this skill with Openclaw Skills, ensure you are inside a git repository and create the required structure:

# Create the necessary context files
touch PROMPT.md AGENTS.md IMPLEMENTATION_PLAN.md

# Prepare the Ralph directory for logging
mkdir -p .ralph

# Configure your specific AI CLI (e.g., Claude Code or Codex)
# Example of a minimal loop execution:
while :; do cat PROMPT.md | claude ; done

Ralph Loop Data Schema & Taxonomy

The skill organizes data through a specific file-based taxonomy to maintain state across agent iterations:

File Purpose
specs/*.md Individual technical specifications for each topic of concern.
PROMPT.md The core instructions sent to the AI agent during the current iteration.
AGENTS.md Contains backpressure commands, build instructions, and operational learnings.
IMPLEMENTATION_PLAN.md A living document tracking task progress and the completion sentinel.
.ralph/ralph.log Detailed logs of every iteration and CLI output.

Ralph Loop Advanced Features

  • Support for multiple AI coding CLIs including Codex, Claude Code, OpenCode, and Goose.
  • Configurable backpressure commands to enforce linting and testing standards automatically.
  • Multi-mode operations allowing for distinct PLANNING versus BUILDING logic via prompt swapping.
  • Integration with sandboxing solutions like Docker or E2B for secure, automated execution.
  • Custom completion sentinels and regex-based stop conditions for autonomous exits.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*