Guide OpenClaw agents to execute Ralph Wiggum loops using exec and process tools. Agent orchestrates coding agents (Codex, Claude Code, OpenCode, Goose) with proper TTY support via pty:true. Plans/builds code via PROMPT.md + AGENTS.md, SPECS and IMPLEMENTATION_PLAN.md. Includes PLANNING vs BUILDING modes, backpressure, sandboxing, and completion conditions. Users request loops, agents execute using tools.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install ralph-loop-agent或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install ralph-loop-agent⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/ralph-loop-agent/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: ralph-loop description: Guide OpenClaw agents to execute Ralph Wiggum loops using exec and process tools. Agent orchestrates coding agents (Codex, Claude Code, OpenCode, Goose) with proper TTY support via pty:true. Plans/builds code via PROMPT.md + AGENTS.md, SPECS and IMPLEMENTATION_PLAN.md. Includes PLANNING vs BUILDING modes, backpressure, sandboxing, and completion conditions. Users request loops, agents execute using tools. version: 1.1.0 author: OpenClaw Community keywords: [ralph-loop, ai-agent, coding-agent, pty, tty, automation, loop, opencode, codex, claude, goose, exec-tool, process-tool] license: MIT ---
This skill guides OpenClaw agents to execute Ralph Loop workflows using the exec and process tools. The agent orchestrates AI coding agent sessions following the Ralph playbook flow:
1) Define Requirements → JTBD → Focus Topics → specs/*.md 2) PLANNING Loop → Create/update IMPLEMENTATION_PLAN.md (do not implement) 3) BUILDING Loop → Implement tasks, run tests (backpressure), update plan, commit
The loop persists context via PROMPT.md + AGENTS.md (loaded each iteration) and the plan/specs on disk.
This skill generates instructions for OpenClaw agents to execute Ralph Loops using the exec and process tools.
exec tool with the coding agent commandpty: true to provide TTY for interactive CLIsbackground: true for monitoring capabilitiesprocess tool to monitor progress and detect completionImportant: Users don't run these scripts directly - the OpenClaw agent executes them using its tool capabilities.
---
Some coding agents require a real terminal (TTY) to work properly, or they will hang:
Interactive CLIs (need TTY):
Non-interactive CLIs (file-based):
Solution: Use exec + process mode for interactive CLIs, simple loops for file-based tools.
---
For OpenCode, Codex, Claude Code, Pi, and Goose - these require TTY support:
When I (the agent) receive a Ralph Loop request, I will:
``` exec tool with parameters: - command: "opencode run --model
``` process tool with: - action: "poll" - sessionId:
process tool with: - action: "log" - sessionId:
IMPLEMENTATION_PLAN.md for sentinel text ``` process tool with: - action: "kill" - sessionId:
Benefits: TTY support, real-time logs, timeout handling, parallel sessions, workdir isolation
---
Required:
opencode, codex, claude, goose, pi, other)PLANNING, BUILDING, or BOTH)Optional:
STATUS: COMPLETE in IMPLEMENTATION_PLAN.md)$PWD)--full-auto, --yolo, --dangerously-skip-permissions)Auto-detect:
If requirements are unclear:
specs/.md for eachPROMPT.md references:
specs/*.mdIMPLEMENTATION_PLAN.mdAGENTS.md includes:
PLANNING Prompt (no implementation):
You are running a Ralph PLANNING loop for this goal: <goal>.
Read specs/* and the current codebase. Only update IMPLEMENTATION_PLAN.md.
Rules:
- Do not implement
- Do not commit
- Create a prioritized task list
- Write down questions if unclear
Completion:
When plan is ready, add: STATUS: PLANNING_COMPLETE
BUILDING Prompt:
You are running a Ralph BUILDING loop for this goal: <goal>.
Context: specs/*, IMPLEMENTATION_PLAN.md, AGENTS.md
Tasks:
1) Pick the most important task
2) Investigate code
3) Implement
4) Run backpressure commands from AGENTS.md
5) Update IMPLEMENTATION_PLAN.md
6) Update AGENTS.md with learnings
7) Commit with clear message
Completion:
When all done, add: STATUS: COMPLETE
The agent constructs command strings using these patterns:
| CLI | Command String Pattern | |-----|----------------------| | OpenCode | opencode run --model | | Codex | codex exec (requires git) | | Claude Code | claude | | Pi | pi --provider | | Goose | goose run "$(cat PROMPT.md)" |
Common flags:
--full-auto, --yolo, --model --dangerously-skip-permissions---
Agent executes this sequence:
Step 1: Launch OpenCode with exec tool
{
command: "opencode run --model github-copilot/claude-opus-4.5 \"$(cat PROMPT.md)\"",
workdir: "/path/to/project",
background: true,
pty: true,
timeout: 3600,
yieldMs: 60000
}
Step 2: Capture session ID from response
sessionId: "abc123"
Step 3: Monitor with process tool every 10-30 seconds
{
action: "poll",
sessionId: "abc123"
}
Step 4: Check recent logs
{
action: "log",
sessionId: "abc123",
offset: -30
}
Step 5: Read IMPLEMENTATION_PLAN.md to check for completion
- Look for: "STATUS: COMPLETE" or "STATUS: PLANNING_COMPLETE"
Step 6: If complete or timeout, cleanup
{
action: "kill",
sessionId: "abc123"
}
Agent tool calls:
exec tool:
{
command: "codex exec --full-auto --model anthropic/claude-opus-4 \"$(cat PROMPT.md)\"",
workdir: "/path/to/project",
background: true,
pty: true,
timeout: 3600
}
# Then monitor with process tool as above
---
Use flexible regex to match variations:
grep -Eq "STATUS:?\s*(PLANNING_)?COMPLETE" IMPLEMENTATION_PLAN.md
Matches:
STATUS: COMPLETESTATUS:COMPLETESTATUS: PLANNING_COMPLETE## Status: PLANNING_COMPLETE---
--full-auto (sandboxed, auto-approve) or --yolo (no sandbox!)--dangerously-skip-permissionsCtrl+Cgit reset --hard HEAD~N---
...
安装 Ralph Loop (Agent Mode) 后,可以对 AI 说这些话来触发它
Help me get started with Ralph Loop (Agent Mode)
Explains what Ralph Loop (Agent Mode) does, walks through the setup, and runs a quick demo based on your current project
Use Ralph Loop (Agent Mode) to guide OpenClaw agents to execute Ralph Wiggum loops using exec and ...
Invokes Ralph Loop (Agent Mode) with the right parameters and returns the result directly in the conversation
What can I do with Ralph Loop (Agent Mode) in my ai agent & automation workflow?
Lists the top use cases for Ralph Loop (Agent Mode), with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/ralph-loop-agent/ 目录(个人级,所有项目可用),或 .claude/skills/ralph-loop-agent/(项目级)。重启 AI 客户端后,用 /ralph-loop-agent 主动调用,或让 AI 根据上下文自动发现并使用。
Ralph Loop (Agent Mode) 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Ralph Loop (Agent Mode) 可免费安装使用。请查阅仓库了解许可证信息。
Guide OpenClaw agents to execute Ralph Wiggum loops using exec and process tools. Agent orchestrates coding agents (Codex, Claude Code, OpenCode, Goose) with proper TTY support via pty:true. Plans/builds code via PROMPT.md + AGENTS.md, SPECS and IMPLEMENTATION_PLAN.md. Includes PLANNING vs BUILDING modes, backpressure, sandboxing, and completion conditions. Users request loops, agents execute using tools.
Automate my ai agent & automation tasks using Ralph Loop (Agent Mode)
Identifies repetitive steps in your workflow and sets up Ralph Loop (Agent Mode) to handle them automatically
Ralph Loop (Agent Mode) 属于「AI Agent & Automation」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。