ralph-loop-help

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Loop Help

Ralph Loop 帮助

Trigger

触发条件

The user asks what Ralph Loop is, how it works, or needs usage guidance.
当用户询问Ralph Loop是什么、它的工作原理或需要使用指导时触发。

What to Explain

需要解释的内容

What is Ralph Loop?

什么是Ralph Loop?

Ralph Loop implements the Ralph Wiggum technique — an iterative development methodology based on continuous AI loops, pioneered by Geoffrey Huntley.
Core concept: the same prompt is fed to the agent repeatedly. The "self-referential" aspect comes from the agent seeing its own previous work in the files and git history, not from feeding output back as input.
Each iteration:
  1. The agent receives the SAME prompt
  2. Works on the task, modifying files
  3. Tries to exit
  4. Stop hook intercepts and feeds the same prompt again
  5. The agent sees its previous work in the files
  6. Iteratively improves until completion
Ralph Loop 实现了Ralph Wiggum技术——这是一种由Geoffrey Huntley首创的、基于持续AI循环的迭代开发方法论。
核心概念:将相同的提示重复提供给agent。其“自引用”特性源于agent能在文件和git历史中查看自己之前的工作成果,而非将输出作为输入反馈回去。
每次迭代流程:
  1. agent接收相同的提示
  2. 处理任务,修改文件
  3. 尝试退出
  4. 停止钩子拦截退出操作,并再次提供相同的提示
  5. agent查看文件中自己之前的工作成果
  6. 迭代优化直至任务完成

Starting a Ralph Loop

启动Ralph Loop

Tell the agent your task along with options:
Start a ralph loop: "Build a REST API for todos" --max-iterations 20 --completion-promise "COMPLETE"
Options:
  • --max-iterations N
    — max iterations before auto-stop
  • --completion-promise "TEXT"
    — phrase to signal completion
How it works:
  1. Creates
    .cursor/ralph/scratchpad.md
    state file
  2. Agent works on the task
  3. Stop hook intercepts exit and feeds the same prompt back
  4. Agent sees its previous work and iterates
  5. Continues until promise detected or max iterations reached
向agent告知你的任务及相关选项:
Start a ralph loop: "Build a REST API for todos" --max-iterations 20 --completion-promise "COMPLETE"
选项说明:
  • --max-iterations N
    —— 自动停止前的最大迭代次数
  • --completion-promise "TEXT"
    —— 用于标记任务完成的短语
工作流程:
  1. 创建
    .cursor/ralph/scratchpad.md
    状态文件
  2. agent处理任务
  3. 停止钩子拦截退出操作,并再次反馈相同的提示
  4. agent查看之前的工作成果并进行迭代
  5. 持续执行直至检测到完成标记或达到最大迭代次数

Cancelling a Ralph Loop

取消Ralph Loop

Ask the agent to cancel the ralph loop. It will remove the state file and report the iteration count.
请求agent取消ralph loop,它会删除状态文件并报告已执行的迭代次数。

Completion Promises

完成标记

To signal completion, the agent outputs a
<promise>
tag:
<promise>TASK COMPLETE</promise>
The stop hook looks for this specific tag. Without it (or
--max-iterations
), Ralph runs indefinitely.
agent通过输出
<promise>
标签来标记任务完成:
<promise>TASK COMPLETE</promise>
停止钩子会检测这个特定标签。如果没有该标签(或未设置
--max-iterations
),Ralph会无限运行。

When to Use Ralph

何时使用Ralph

Good for:
  • Well-defined tasks with clear success criteria
  • Tasks requiring iteration and refinement
  • Iterative development with self-correction
  • Greenfield projects
Not good for:
  • Tasks requiring human judgment or design decisions
  • One-shot operations
  • Tasks with unclear success criteria
适用场景:
  • 具有明确成功标准的定义清晰的任务
  • 需要迭代和细化的任务
  • 具备自我修正能力的迭代开发
  • 全新项目(Greenfield projects)
不适用场景:
  • 需要人工判断或设计决策的任务
  • 一次性操作
  • 成功标准不明确的任务

Learn More

了解更多

Output

输出要求

Present the above information clearly to the user, tailored to their specific question.
根据用户的具体问题,清晰呈现上述信息。