Loading...
Loading...
适用于AI CLI工具的自引用完成循环。在每一轮迭代中,都会使用全新的上下文让Agent重新执行同一任务,直到检测到完成标识或达到最大迭代次数为止。
npx skill4agent add supercent-io/skills-template ralphAfterAgent/ralph "你的任务描述" --completion-promise "DONE"AfterAgent/ralph "<任务描述>" [--completion-promise=TEXT] [--max-iterations=N]DONE100AfterAgent<promise>DONE</promise>/ralph:cancel/ralph "构建一个具备完整测试覆盖率的Python CLI任务管理器"/ralph "构建一个待办事项REST API。当所有CRUD端点正常工作且测试覆盖率超过80%时,输出TASK_COMPLETE" --completion-promise="TASK_COMPLETE"/ralph "尝试重构认证模块" --max-iterations=20/ralph "遵循TDD流程实现功能X:
1. 为该功能编写失败的测试用例。
2. 实现代码使测试通过。
3. 运行测试套件。
4. 如果有测试失败,分析错误并调试。
5. 重构代码以提升清晰度和效率。
6. 重复上述步骤直到所有测试通过。
7. 完成后输出 <promise>TESTS_PASSED</promise>" --completion-promise="TESTS_PASSED"/ralph:cancel/ralph:help--completion-promise/ralph "构建一个待办事项REST API。当所有CRUD端点正常工作且所有测试通过、覆盖率超过80%时,任务完成。" --completion-promise="TASK_COMPLETE"--max-iterations/ralph "尝试重构认证模块" --max-iterations=20-ygemini -s -ygemini extensions install https://github.com/gemini-cli-extensions/ralph --auto-update~/.gemini/settings.json{
"hooksConfig": { "enabled": true },
"context": {
"includeDirectories": ["~/.gemini/extensions/ralph"]
}
}bash <your-agent-skills>/ralph/scripts/setup-codex-hook.sh~/.codex/config.tomldeveloper_instructions~/.codex/prompts/ralph.md/prompts:ralph--dry-run使用方法:
bash <your-agent-skills>/ralph/scripts/setup-codex-hook.sh
bash <your-agent-skills>/ralph/scripts/setup-codex-hook.sh --dry-run/prompts:ralph| 平台 | 当前支持方式 | 核心条件 |
|---|---|---|
| Gemini-CLI | 原生支持 | 安装 |
| Claude Code | 原生支持(推荐) | 加载Skill/编排后使用 |
| OpenCode | 原生支持(路径一致) | 注册 |
| Codex | 修正模式 | 执行 |
setup-codex-hook.sh| 操作 | 命令 |
|---|---|
| 启动循环 | |
| 自定义完成标识 | |
| 限制迭代次数 | |
| 取消循环 | |
| 查看帮助 | |