ralph-patterns

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Loop Patterns

Ralph循环模式

You're running in a Ralph loop - an autonomous issue-to-merged-PR workflow.
你正在运行Ralph循环——一个从Issue到合并PR的自主工作流。

Completion Signals

完成信号

Output these exact XML tags for the shell script to detect:
  • <promise>DONE</promise>
    - Task complete, exit successfully
  • <promise>BLOCKED</promise>
    - Cannot proceed, needs human intervention
Always include the exact XML tag. The shell script greps for it.
输出以下精确的XML标签,供shell脚本检测:
  • <promise>DONE</promise>
    - 任务完成,成功退出
  • <promise>BLOCKED</promise>
    - 无法继续,需要人工干预
务必包含精确的XML标签。Shell脚本会通过grep查找它。

Progress Tracking

进度跟踪

Ralph monitors these for "no progress" circuit breaker:
  • Git HEAD (commits)
  • PR state (reviews, CI status)
Make commits frequently to show progress. Avoid long stretches without commits.
Ralph会监控以下内容以触发“无进展”断路器:
  • Git HEAD(提交记录)
  • PR状态(评审、CI状态)
频繁提交以展示进度。 避免长时间无提交的情况。

Within a Ralph Loop

在Ralph循环中

You have full access to:
  • /spec
    ,
    /architect
    ,
    /build
    ,
    /refactor
    ,
    /update-docs
    ,
    /pr
  • Moonbridge MCP for Codex/Kimi delegation
  • Sentry, PostHog, GitHub MCPs
  • All configured hooks and skills
你拥有以下全部访问权限:
  • /spec
    ,
    /architect
    ,
    /build
    ,
    /refactor
    ,
    /update-docs
    ,
    /pr
  • 用于Codex/Kimi委托的Moonbridge MCP
  • Sentry、PostHog、GitHub MCPs
  • 所有已配置的钩子和技能

Delegation Pattern

委托模式

Use Moonbridge for implementation:
mcp__moonbridge__spawn_agent({
  "prompt": "Implement [feature]. Follow pattern in [ref file].",
  "adapter": "codex",
  "reasoning_effort": "high"
})
使用Moonbridge进行实现:
mcp__moonbridge__spawn_agent({
  "prompt": "Implement [feature]. Follow pattern in [ref file].",
  "adapter": "codex",
  "reasoning_effort": "high"
})

Handling CI Failures

处理CI失败

  1. Get CI logs:
    gh run view --log-failed
  2. Analyze failures
  3. Fix and push
  4. Wait for re-run (CI usually triggers automatically)
  1. 获取CI日志:
    gh run view --log-failed
  2. 分析失败原因
  3. 修复并推送
  4. 等待重新运行(CI通常会自动触发)

Handling Review Feedback

处理评审反馈

  1. Get PR comments:
    gh pr view --comments
  2. Identify critical vs stylistic feedback
  3. Address critical feedback first
  4. Push changes
  5. Respond to reviewers via commit message or PR comment
  1. 获取PR评论:
    gh pr view --comments
  2. 区分关键反馈与风格类反馈
  3. 优先处理关键反馈
  4. 推送变更
  5. 通过提交信息或PR评论回复评审者

When to Output BLOCKED

何时输出BLOCKED

Output
<promise>BLOCKED</promise>
when:
  • Missing required credentials or API keys
  • Ambiguous requirements that need human clarification
  • Conflicting constraints with no clear resolution
  • External dependency is down/unavailable
  • Permissions issues you can't resolve
Include a brief explanation after the tag:
<promise>BLOCKED</promise>
Reason: Need clarification on whether user auth should use JWT or session cookies.
在以下情况输出
<promise>BLOCKED</promise>
  • 缺少必需的凭证或API密钥
  • 需求模糊,需要人工澄清
  • 存在冲突约束且无明确解决方案
  • 外部依赖宕机/不可用
  • 无法解决的权限问题
在标签后附上简短说明:
<promise>BLOCKED</promise>
Reason: Need clarification on whether user auth should use JWT or session cookies.

Anti-Patterns

反模式

  • Don't loop infinitely on the same failing test
  • Don't make empty commits just to show progress
  • Don't ignore reviewer feedback hoping it goes away
  • Don't skip /codify-learning at the end (Ralph does this automatically)
  • 不要在同一个失败测试上无限循环
  • 不要只为了展示进度而创建空提交
  • 不要忽略评审反馈以为它会自动消失
  • 不要在最后跳过/codify-learning(Ralph会自动执行此步骤)