Set up and run an autonomous experiment loop for any optimization target. Gathers what to optimize, then starts the loop immediately. Use when asked to "run autoresearch", "optimize X in a loop", "set up autoresearch for X", or "start experiments".
This skill should be used when the user asks to "run autoresearch", "optimize X in a loop", "set up autonomous experiments", "start autoresearch", "optimize X overnight", or "experiment loop". Sets up and runs an autonomous experiment loop for any optimization target.
MUST use when the user wants autonomous, iterative optimization — letting Claude run experiments unattended. Trigger: "autoloop", "autoresearch", "experiment loop", "hill-climbing", "optimize overnight", "karpathy loop", "let Claude optimize while I sleep", "automate trying different approaches", "set up a loop to improve this", "run experiments overnight", or any request for iterative improvement with a scalar metric. Generates program.md + immutable runner script (auto/run.sh) with tiered quality gates and structured METRIC output, ready to run with claude --dangerously-skip-permissions.
Autonomous self-improving loop for Claude Code skills. Reads a target skill's SKILL.md, runs it multiple times against binary eval assertions, scores the output, and iteratively mutates the skill instructions to maximize the pass rate. Use when user says "improve skill", "optimize skill", "auto-improve", "run self-improvement loop", "make skill better", "eval my skill", "test and improve skill", "autoresearch skill", "skill-improver", "run evals on skill", or wants to autonomously improve a skill overnight.
Ralph Loop 是一种让 AI 持续迭代直到任务真正完成的机制。 适用于有明确、可程序化验证完成标准的长任务。 --- # Ralph Loop 技能 ## 核心概念 ### 什么是 Ralph Loop? Ralph Loop 是一种自主迭代循环机制,核心思想是: ``` while 任务未完成: AI 接收相同的提示词 AI 看到之前的工作(文件、git历史) AI 继续推进任务 Stop Hook 拦截 AI 的"退出"尝试 重新注入提示词 → 继续循环 ``` ### 名称由来 Ralph Wiggum 是《辛普森一家》中的角色——一个看起来不太聪明但异常执着、永不放弃的小孩。正如这个角色的特质,Ralph Loop 让 AI 变得异常"执着"。 ### 解决的核心问题 | 问题 | 传统 Agent | Ralph Loop | |------|-----------|------------| | 自我评估 | 主观判断"完成" → 过早退出 | 外部客观标准 → 强制继续 | | 上下文管理 | 会话重启丢失进度 | 文件/git持久化记忆 | | 人工干预 | 需要频繁介入 | 真正的无人值守 | ## 防止过早退出 ### 为什么会过早退出? Ralph Loop 的核心目标是"持续迭代直到真正完成",但实际上经常会过早退出。原因如下: | 问题 | 症状 | 根因 | |------|------|------| | **主观判断完成** | 标记 `complete: true` 但验证失败 | AI 自我感觉良好 | | **跳过验证** | 不运行验证命令就退出 | 验证被视为可选 | | **忽略 errors** | 只看 "build 成功" 忽略 lint errors | 验证不全面 | | **状态不同步** | PROGRESS.md 显示完成但实际未完成 | 状态是主观标记 | ### 强制规则 ``` 🔴 绝对规则 1:每次迭代结束时必须运行所有 required 验证命令 🔴 绝对规则 2:只有验证结果为 errors == 0 才算通过 🔴 绝对规则 3:所有任务 complete=true 且所有 required 验证通过才能输出 <promise> 🔴 绝对规则 4:验证结果必须写入 PROGRESS.md,不能只靠主观标记 ``` ### 验证结果判断 | 验证命令 | 通过条件 | 失败条件 | |---------|---------|---------| | lint | errors == 0 | errors > 0 | | test | 0 failed | N failed | | build | exit_code == 0 | exit_code != 0 | | coverage | value >= threshold | value < threshold | **注意**:warnings 是可接受的,但应该尽量减少。 --- ## 关键三要素 1. **明确任务 + 完成条件**:可验证的成功标准 2. **Stop Hook**:拦截退出,强制继续 3. **max-iterations**:安全阀,防止无限循环 ## 适用性判断 ### ✅ 适合 Ralph Loop - 有明确的、可程序化验证的完成标准 - 任务可以拆解为增量式改进 - 编程、测试、迁移、重构等机械性任务 - 有现成的验证方法(测试套件、lint、类型检查等) **示例**: - "为项目添加单元测试,覆盖率 >= 80%" - "修复所有 lint 错误" - "将项目从 JavaScript 迁移到 TypeScript" - "重构认证模块,所有测试必须通过" ### ❌ 不适合 Ralph Loop - 需要人工判断或设计决策 - 成功标准模糊或主观 - 需要频繁人工确认的交互式任务 - 没有自动化验证方法 **示例**: - "设计一个漂亮的 UI"(主观) - "写一个好的架构文档"(模糊) - "和用户讨论需求"(交互式) ## 核心概念:Context Rot vs In-Context Learning ### Context Rot(上下文腐化) 当上下文中充满了重复、错误或无价值的信息时,AI 会陷入思维定势。 **症状**: - AI 重复相同的错误 - AI 忽略之前的正确解决方案 - AI 输出越来越冗余 **判断标准**:删除前 N 次尝试记录后,问题是否更容易解决? ### In-Context Learning(上下文学习) 当上下文中增加了有价值的新信息时,AI 能从中学习。 **特征**: - 明确的错误反馈 - 成功的尝试记录