What this skill does
This skill runs an autonomous Ralph Wiggum coding loop using the ralph CLI with OpenCode as the agent provider.
It repeatedly executes the same coding prompt until:
- - The success criteria are met, OR
- The completion promise is printed, OR
- Max iterations are reached
The loop is optimized for free OpenCode Zen models and includes a fallback chain in case models are rate-limited, disabled, or removed.
When to use
Use this skill when you want autonomous coding execution such as:
- - Fixing failing tests
- Implementing scoped features
- Refactoring codebases
- Resolving lint/type errors
- Running build-fix loops
- Multi-iteration debugging
You MUST be inside a git repository before running Ralph.
Free model fallback order
Always attempt models in this order:
- 1.
opencode/kimi-k2.5-free ← Best coding performance (limited time free) - INLINECODE2
- INLINECODE3
- INLINECODE4 ← Free stealth model fallback
If a model fails due to availability or quota, immediately retry using the next model without changing the prompt or loop parameters.
Failure triggers for fallback
Fallback if you encounter errors like:
- - model disabled
- model not found
- insufficient quota
- quota exceeded
- payment required
- rate limit
- provider unavailable
How to run the loop
Attempt #1 (primary model)
Run:
ralph "
Success criteria:
Completion promise:
COMPLETE" \
--agent opencode \
--model opencode/kimi-k2.5-free \
--completion-promise "COMPLETE" \
--max-iterations 20
Attempt #2 (fallback)
If attempt #1 fails due to model issues, rerun with:
--model opencode/minimax-m2.1-free
Attempt #3 (fallback)
If attempt #2 fails:
--model opencode/glm-4.7-free
Attempt #4 (final fallback)
If attempt #3 fails:
--model opencode/big-pickle
Tasks mode (for large projects)
For multi-step execution:
ralph "" \
--agent opencode \
--model opencode/kimi-k2.5-free \
--tasks \
--max-iterations 50
Fallback model order still applies.
Plugin troubleshooting
If OpenCode plugins interfere with loop execution, rerun with:
--no-plugins
Sanity check available Zen models
If free model availability changes, check:
https://opencode.ai/zen/v1/models
Update fallback order if needed.
Safety notes
- - Always run inside a git repo
- Set iteration limits to avoid runaway loops
- Ensure prompts contain verifiable success criteria
- Review diffs before merging autonomous changes
Example usage
Fix failing TypeScript errors:
ralph "Fix all TypeScript errors in the repo.
Success criteria:
- - tsc passes
- Build succeeds
Completion promise:
COMPLETE" \
--agent opencode \
--model opencode/kimi-k2.5-free \
--completion-promise "COMPLETE" \
--max-iterations 20
该技能的功能
该技能使用 ralph 命令行工具,以 OpenCode 作为代理提供程序,运行一个自主的 Ralph Wiggum 编码循环。
它会重复执行相同的编码提示,直到:
- - 满足成功标准,或
- 打印完成承诺,或
- 达到最大迭代次数
该循环针对 免费的 OpenCode Zen 模型 进行了优化,并包含一个备用链,以防模型受到速率限制、被禁用或移除。
使用场景
当您希望进行自主编码执行时使用此技能,例如:
- - 修复失败的测试
- 实现限定范围的功能
- 重构代码库
- 解决 lint/类型错误
- 运行构建修复循环
- 多轮迭代调试
在运行 Ralph 之前,您必须位于 git 仓库内。
免费模型备用顺序
始终按以下顺序尝试模型:
- 1. opencode/kimi-k2.5-free ← 最佳编码性能(限时免费)
- opencode/minimax-m2.1-free
- opencode/glm-4.7-free
- opencode/big-pickle ← 免费隐形模型备用
如果某个模型因可用性或配额问题失败,立即使用下一个模型重试,不更改提示或循环参数。
触发备用的失败情况
遇到以下错误时触发备用:
- - 模型已禁用
- 模型未找到
- 配额不足
- 配额超限
- 需要付费
- 速率限制
- 提供商不可用
如何运行循环
尝试 #1(主模型)
运行:
ralph <任务提示>
成功标准:
完成承诺:
COMPLETE \
--agent opencode \
--model opencode/kimi-k2.5-free \
--completion-promise COMPLETE \
--max-iterations 20
尝试 #2(备用)
如果尝试 #1 因模型问题失败,使用以下参数重新运行:
--model opencode/minimax-m2.1-free
尝试 #3(备用)
如果尝试 #2 失败:
--model opencode/glm-4.7-free
尝试 #4(最终备用)
如果尝试 #3 失败:
--model opencode/big-pickle
任务模式(适用于大型项目)
用于多步骤执行:
ralph <大型任务提示> \
--agent opencode \
--model opencode/kimi-k2.5-free \
--tasks \
--max-iterations 50
备用模型顺序仍然适用。
插件故障排除
如果 OpenCode 插件干扰循环执行,使用以下参数重新运行:
--no-plugins
可用 Zen 模型检查
如果免费模型可用性发生变化,请检查:
https://opencode.ai/zen/v1/models
根据需要更新备用顺序。
安全注意事项
- - 始终在 git 仓库内运行
- 设置迭代限制以避免失控循环
- 确保提示包含可验证的成功标准
- 在合并自主更改前审查差异
使用示例
修复失败的 TypeScript 错误:
ralph 修复仓库中的所有 TypeScript 错误。
成功标准:
完成承诺:
COMPLETE \
--agent opencode \
--model opencode/kimi-k2.5-free \
--completion-promise COMPLETE \
--max-iterations 20