ralph-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Loop

Ralph Loop

Trigger

触发条件

The user wants to start a Ralph loop. An iterative development loop where the same prompt is fed back after every turn, and the agent sees its own previous work each iteration.
用户希望启动Ralph Loop。这是一种迭代开发循环,每一轮后都会反馈相同的提示词,且Agent在每次迭代中都能查看自己之前的工作内容。

Workflow

工作流程

  1. Gather the user's task prompt and optional parameters:
    • max_iterations
      (number, default 0 for unlimited)
    • completion_promise
      (text, or "null" if not set)
  2. Create the directory
    .cursor/ralph/
    if it doesn't exist, then write the state file at
    .cursor/ralph/scratchpad.md
    with this exact format:
    markdown
    ---
    iteration: 1
    max_iterations: <N or 0>
    completion_promise: "<TEXT>" or null
    ---
    
    <the user's task prompt goes here>
    Example:
    markdown
    ---
    iteration: 1
    max_iterations: 20
    completion_promise: "COMPLETE"
    ---
    
    Build a REST API for todos with CRUD operations, input validation, and tests.
  3. Confirm to the user that the Ralph loop is active, then begin working on the task.
  4. The stop hook automatically intercepts each turn end and feeds the same prompt back as a followup message. You will see it prefixed with
    [Ralph loop iteration N.]
    .
  1. 收集用户的任务提示词及可选参数:
    • max_iterations
      (number, default 0 for unlimited)
    • completion_promise
      (text, or "null" if not set)
  2. 如果目录
    .cursor/ralph/
    不存在则创建它,然后按照以下精确格式在
    .cursor/ralph/scratchpad.md
    中写入状态文件:
    markdown
    ---
    iteration: 1
    max_iterations: <N or 0>
    completion_promise: "<TEXT>" or null
    ---
    
    <the user's task prompt goes here>
    示例:
    markdown
    ---
    iteration: 1
    max_iterations: 20
    completion_promise: "COMPLETE"
    ---
    
    Build a REST API for todos with CRUD operations, input validation, and tests.
  3. 向用户确认Ralph Loop已激活,然后开始处理任务。
  4. 停止钩子会自动拦截每一轮的结束,并将相同的提示词作为后续消息反馈回来。你会看到它带有前缀
    [Ralph loop iteration N.]

Guardrails

约束规则

  • If a completion promise is set, you may ONLY output
    <promise>TEXT</promise>
    when the statement is completely and genuinely true.
  • Do not output false promises to escape the loop.
  • Always recommend setting
    max_iterations
    as a safety net.
  • Quote the
    completion_promise
    value in the YAML frontmatter if it contains special characters.
  • 如果设置了完成承诺,只有当表述完全真实时,你才可以输出
    <promise>TEXT</promise>
  • 不要输出虚假承诺以退出循环。
  • 始终建议设置
    max_iterations
    作为安全保障。
  • 如果
    completion_promise
    包含特殊字符,请在YAML前置元数据中用引号括起其值。

Output

输出要求

Confirm the loop is active (prompt, iteration limit, promise if set), then start working on the task immediately.
向用户确认循环已激活(包括提示词、迭代限制、已设置的承诺),然后立即开始处理任务。