ralph-loop
它能做什么
该技能启动一个迭代循环,智能体在多轮中持续处理同一项任务。适合希望较大任务稳步推进、又不想手动重新开始的人。
适用场景
- ✓当你希望智能体在一项任务上持续迭代,直到达成目标的时候。
- ✓当你想为一项自主任务设定最大轮数的时候。
- ✓当你希望循环在出现特定完成短语时停止的时候。
技能链接
https://github.com/cursor/plugins/blob/main/ralph-loop/skills/ralph-loop/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“启动一个 Ralph 循环,构建一个带测试的待办事项 API,并在二十轮后停止。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把你的任务和循环设置保存在状态文件中,然后开始处理任务。每次它尝试停止时,同一个提示词会被反馈回去,它会继续工作,直到出现完成短语或达到轮数上限。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.
Workflow
Gather the user's task prompt and optional parameters:
max_iterations(number, default 0 for unlimited)completion_promise(text, or "null" if not set)
Create the directory
.cursor/ralph/if it doesn't exist, then write the state file at.cursor/ralph/scratchpad.mdwith this exact format:--- iteration: 1 max_iterations: <N or 0> completion_promise: "<TEXT>" or null --- <the user's task prompt goes here>Example:
--- iteration: 1 max_iterations: 20 completion_promise: "COMPLETE" --- Build a REST API for todos with CRUD operations, input validation, and tests.Confirm to the user that the Ralph loop is active, then begin working on the task.
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.].
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_iterationsas a safety net. - Quote the
completion_promisevalue in the YAML frontmatter if it contains special characters.
Output
Confirm the loop is active (prompt, iteration limit, promise if set), then start working on the task immediately.
常见问题
如果我不设置上限会怎样?
默认没有轮数上限,因此该技能建议你设置一个上限。
什么是完成短语?
只有在任务真正完成时,智能体才会输出的一句话,输出它会结束循环。
智能体可以伪造完成短语吗?
不可以。该技能禁止为了退出循环而输出虚假的完成短语。
详情
作者的原始描述
Start a Ralph Loop for iterative self-referential development. Use when the user asks to run a ralph loop, start an iterative loop, or wants repeated autonomous iteration on a task until completion.
repo: cursor/plugins
热度
- GitHub 星标
- 15k
- 排名
- #11010
- 许可证
- —
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
advisor
15k如果你开启该功能,让你的智能体在关键节点咨询一个更强的第二模型,例如在重大决定之前,或在错误上卡住时。
check-agent-compatibility
15k全面检查 AI 编程智能体能否启动、验证和记录某个代码仓库,并返回一个兼容性评分以及主要问题。
cli-for-agents
15k教你的智能体设计或审查命令行工具,使 AI 智能体无需提示即可运行,并提供清晰的帮助文字和示例。
continual-learning
15k通过把回顾过往对话的工作交给专门的记忆更新程序,使你的 AGENTS.md 笔记保持最新。