ralph

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Skill

Ralph Skill

[RALPH + ULTRAWORK - ITERATION {{ITERATION}}/{{MAX}}]
Your previous attempt did not output the completion promise. Continue working on the task.
[RALPH + ULTRAWORK - 迭代 {{ITERATION}}/{{MAX}}]
你之前的尝试未输出完成承诺。请继续处理任务。

PRD MODE (OPTIONAL)

PRD模式(可选)

If the user provides the
--prd
flag, initialize a PRD (Product Requirements Document) BEFORE starting the ralph loop.
如果用户提供
--prd
标志,请在启动ralph循环之前初始化PRD(产品需求文档)。

Detecting PRD Mode

检测PRD模式

Check if
{{PROMPT}}
contains the flag pattern:
--prd
or
--PRD
检查
{{PROMPT}}
是否包含标志模式:
--prd
--PRD

PRD Initialization Workflow

PRD初始化工作流

When
--prd
flag detected:
  1. Create PRD File Structure (
    .omc/prd.json
    and
    .omc/progress.txt
    )
  2. Parse the task (everything after
    --prd
    flag)
  3. Break down into user stories with this structure:
json
{
  "project": "[Project Name]",
  "branchName": "ralph/[feature-name]",
  "description": "[Feature description]",
  "userStories": [
    {
      "id": "US-001",
      "title": "[Short title]",
      "description": "As a [user], I want to [action] so that [benefit].",
      "acceptanceCriteria": ["Criterion 1", "Typecheck passes"],
      "priority": 1,
      "passes": false
    }
  ]
}
  1. Create progress.txt:
undefined
当检测到
--prd
标志时:
  1. 创建PRD文件结构
    .omc/prd.json
    .omc/progress.txt
  2. 解析任务
    --prd
    标志之后的所有内容)
  3. 拆解为用户故事,结构如下:
json
{
  "project": "[Project Name]",
  "branchName": "ralph/[feature-name]",
  "description": "[Feature description]",
  "userStories": [
    {
      "id": "US-001",
      "title": "[Short title]",
      "description": "As a [user], I want to [action] so that [benefit].",
      "acceptanceCriteria": ["Criterion 1", "Typecheck passes"],
      "priority": 1,
      "passes": false
    }
  ]
}
  1. 创建progress.txt
undefined

Ralph Progress Log

Ralph进度日志

Started: [ISO timestamp]
开始时间: [ISO时间戳]

Codebase Patterns

代码库模式

(No patterns discovered yet)


5. **Guidelines for PRD creation**:
   - Right-sized stories: Each completable in one focused session
   - Verifiable criteria: Include "Typecheck passes", "Tests pass"
   - Independent stories: Minimize dependencies
   - Priority order: Foundational work (DB, types) before UI

6. **After PRD created**: Proceed to normal ralph loop execution using the user stories as your task list
(尚未发现任何模式)


5. **PRD创建指南**:
   - 合理拆分故事:每个故事可在一个专注的会话内完成
   - 可验证的标准:包含“类型检查通过”、“测试通过”
   - 独立的故事:最小化依赖关系
   - 优先级排序:基础工作(数据库、类型定义)优先于UI

6. **PRD创建完成后**:使用用户故事作为任务列表,执行常规ralph循环

Example Usage

使用示例

User input:
--prd build a todo app with React and TypeScript
Your workflow:
  1. Detect
    --prd
    flag
  2. Extract task: "build a todo app with React and TypeScript"
  3. Create
    .omc/prd.json
    with user stories
  4. Create
    .omc/progress.txt
  5. Begin ralph loop using user stories as task breakdown
用户输入:
--prd build a todo app with React and TypeScript
你的工作流:
  1. 检测到
    --prd
    标志
  2. 提取任务:“build a todo app with React and TypeScript”
  3. 创建包含用户故事的
    .omc/prd.json
  4. 创建
    .omc/progress.txt
  5. 以用户故事为任务拆解,启动ralph循环

ULTRAWORK MODE (AUTO-ACTIVATED)

ULTRAWORK模式(自动激活)

Ralph is a persistence wrapper that includes Ultrawork as a component for maximum parallel execution. You MUST follow these rules:
Ralph是一个持久化包装器,包含Ultrawork组件以实现最大程度的并行执行。你必须遵循以下规则:

Parallel Execution Rules

并行执行规则

  • PARALLEL: Fire independent calls simultaneously - NEVER wait sequentially
  • BACKGROUND FIRST: Use Task(run_in_background=true) for long operations (10+ concurrent)
  • DELEGATE: Route tasks to specialist agents immediately
  • 并行执行:同时发起独立调用——绝不要按顺序等待
  • 优先后台执行:对长时间操作使用Task(run_in_background=true)(10+并发)
  • 任务委派:立即将任务路由给专业Agent

Smart Model Routing (SAVE TOKENS)

智能模型路由(节省Token)

Task ComplexityTierExamples
Simple lookupsLOW (haiku)"What does this function return?", "Find where X is defined"
Standard workMEDIUM (sonnet)"Add error handling", "Implement this feature"
Complex analysisHIGH (opus)"Debug this race condition", "Refactor auth module"
任务复杂度层级示例
简单查询低级(haiku)"这个函数返回什么?", "查找X的定义位置"
标准工作中级(sonnet)"添加错误处理", "实现此功能"
复杂分析高级(opus)"调试此竞态条件", "重构认证模块"

Available Agents by Tier

各层级可用Agent

FIRST ACTION: Before delegating any work, read the agent reference file:
Read file: docs/shared/agent-tiers.md
This provides the complete agent tier matrix, MCP tool assignments, and selection guidance.
CRITICAL: Always pass
model
parameter explicitly!
Task(subagent_type="oh-my-claudecode:architect-low", model="haiku", prompt="...")
Task(subagent_type="oh-my-claudecode:executor", model="sonnet", prompt="...")
Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="...")
首要操作:在委派任何工作之前,读取Agent参考文件:
Read file: docs/shared/agent-tiers.md
该文件提供完整的Agent层级矩阵、MCP工具分配和选择指南。
关键:始终显式传递
model
参数!
Task(subagent_type="oh-my-claudecode:architect-low", model="haiku", prompt="...")
Task(subagent_type="oh-my-claudecode:executor", model="sonnet", prompt="...")
Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="...")

Background Execution Rules

后台执行规则

Run in Background (set
run_in_background: true
):
  • Package installation (npm install, pip install, cargo build, etc.)
  • Build processes (project build command, make, etc.)
  • Test suites (project test command, etc.)
  • Docker operations: docker build, docker pull
Run Blocking (foreground):
  • Quick status checks: git status, ls, pwd
  • File reads, edits
  • Simple commands
后台运行(设置
run_in_background: true
):
  • 包安装(npm install, pip install, cargo build等)
  • 构建流程(项目构建命令、make等)
  • 测试套件(项目测试命令等)
  • Docker操作:docker build, docker pull
阻塞运行(前台):
  • 快速状态检查:git status, ls, pwd
  • 文件读取、编辑
  • 简单命令

COMPLETION REQUIREMENTS

完成要求

Before claiming completion, you MUST:
  1. Verify ALL requirements from the original task are met
  2. Ensure no partial implementations
  3. Check that code compiles/runs without errors
  4. Verify tests pass (if applicable)
  5. TODO LIST: Zero pending/in_progress tasks
在声明任务完成之前,你必须:
  1. 验证原始任务的所有要求均已满足
  2. 确保无部分实现的内容
  3. 检查代码可编译/运行且无错误
  4. 验证测试通过(如适用)
  5. 待办列表:无待处理/进行中的任务

VERIFICATION BEFORE COMPLETION (IRON LAW)

完成前验证(铁则)

NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
Before outputting the completion promise:
无新鲜验证证据,不得声明任务完成
在输出完成承诺之前:

Steps (MANDATORY)

步骤(强制性)

  1. IDENTIFY: What command proves the task is complete?
  2. RUN: Execute verification (test, build, lint)
  3. READ: Check output - did it actually pass?
  4. ONLY THEN: Proceed to Architect verification
  1. 确定:什么命令可以证明任务已完成?
  2. 执行:执行验证操作(测试、构建、代码检查)
  3. 查看:检查输出——是否真的通过?
  4. 仅在此时:进行架构师验证

Red Flags (STOP and verify)

危险信号(停止并验证)

  • Using "should", "probably", "seems to"
  • About to output completion without fresh evidence
  • Expressing satisfaction before verification
  • 使用“应该”、“可能”、“似乎”等词汇
  • 未获取新鲜证据就准备输出完成承诺
  • 在验证前表示满意

Evidence Chain

证据链

  1. Fresh test run output showing pass
  2. Fresh build output showing success
  3. lsp_diagnostics showing 0 errors
  4. THEN Architect verification
  5. THEN completion promise
Skipping verification = Task NOT complete
  1. 显示通过的新鲜测试运行输出
  2. 显示成功的新鲜构建输出
  3. lsp_diagnostics显示0个错误
  4. 然后进行架构师验证
  5. 然后输出完成承诺
跳过验证 = 任务未完成

VERIFICATION PROTOCOL (TIERED)

验证协议(分层)

Ralph uses tiered verification to save tokens while maintaining quality.
Ralph使用分层验证以在保证质量的同时节省Token。

Verification Tier Selection

验证层级选择

Before spawning architect for verification, determine the appropriate tier:
Change ProfileTierAgent
<5 files, <100 lines, full testsLIGHTarchitect-low (haiku)
Standard changesSTANDARDarchitect-medium (sonnet)
>20 files, security/architecturalTHOROUGHarchitect (opus)
在生成架构师进行验证之前,确定合适的层级:
变更概况层级Agent
<5个文件,<100行代码,完整测试轻量architect-low (haiku)
标准变更标准architect-medium (sonnet)
>20个文件,安全/架构相关全面architect (opus)

Ralph Minimum Verification Tier

Ralph最低验证层级

Floor: STANDARD (architect-medium / sonnet)
Even for small changes (<5 files), ralph requires at least STANDARD tier verification. The LIGHT tier (haiku) is insufficient for ralph's completion guarantee. When tier selection returns LIGHT, upgrade to STANDARD.
下限:标准(architect-medium / sonnet)
即使是小变更(<5个文件),ralph也至少需要标准层级的验证。轻量层级(haiku)不足以满足ralph的完成保证。当层级选择为轻量时,升级为标准层级。

Verification Flow

验证流程

  1. Collect change metadata: Count files, lines, detect security/architectural patterns
  2. Select tier: Apply rules from
    /docs/shared/verification-tiers.md
  3. Spawn appropriate architect:
    // LIGHT - small, well-tested changes
    Task(subagent_type="oh-my-claudecode:architect-low", model="haiku", prompt="Quick verification: [describe changes]")
    
    // STANDARD - most changes
    Task(subagent_type="oh-my-claudecode:architect-medium", model="sonnet", prompt="Verify implementation: [describe changes]")
    
    // THOROUGH - large/security/architectural changes
    Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="Full verification: [describe changes]")
  4. Wait for verdict
  5. If approved: Run
    /oh-my-claudecode:cancel
    to cleanly exit
  6. If rejected: Fix issues and re-verify (same tier)
For complete tier selection rules, read:
docs/shared/verification-tiers.md
  1. 收集变更元数据:统计文件数量、代码行数,检测安全/架构模式
  2. 选择层级:应用
    /docs/shared/verification-tiers.md
    中的规则
  3. 生成合适的架构师
    // 轻量 - 小型、测试完善的变更
    Task(subagent_type="oh-my-claudecode:architect-low", model="haiku", prompt="Quick verification: [describe changes]")
    
    // 标准 - 大多数变更
    Task(subagent_type="oh-my-claudecode:architect-medium", model="sonnet", prompt="Verify implementation: [describe changes]")
    
    // 全面 - 大型/安全/架构变更
    Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="Full verification: [describe changes]")
  4. 等待裁决
  5. 如果通过:运行
    /oh-my-claudecode:cancel
    以干净退出
  6. 如果被拒绝:修复问题并重新验证(同一层级)
完整的层级选择规则,请阅读:
docs/shared/verification-tiers.md

External Model Consultation (Preferred)

外部模型咨询(推荐)

During architect verification, the architect agent SHOULD consult Codex for validation cross-check.
在架构师验证期间,架构师Agent应咨询Codex以进行验证交叉检查。

Protocol

协议

  1. Architect forms OWN verification analysis first
  2. Consults Codex with
    agent_role: "architect"
  3. Never blocks on unavailable tools
  4. Verification proceeds regardless of Codex availability
  1. 架构师首先形成自己的验证分析
  2. 使用
    agent_role: "architect"
    咨询Codex
  3. 绝不因工具不可用而阻塞
  4. 无论Codex是否可用,验证都将继续进行

When Architect Should Consult

架构师应咨询的场景

  • Security-sensitive changes
  • Architectural refactoring
  • Complex multi-system integration
  • 安全敏感变更
  • 架构重构
  • 复杂多系统集成

When to Skip

可跳过的场景

  • Simple feature additions
  • Well-tested changes
  • Time-critical verification
  • 简单功能添加
  • 测试完善的变更
  • 时间紧迫的验证

ZERO TOLERANCE

零容忍规则

  • NO Scope Reduction - deliver FULL implementation
  • NO Partial Completion - finish 100%
  • NO Premature Stopping - ALL TODOs must be complete
  • NO TEST DELETION - fix code, not tests
  • 不得缩小范围——交付完整实现
  • 不得部分完成——100%完成
  • 不得提前停止——所有待办事项必须完成
  • 不得删除测试——修复代码,而非测试

STATE CLEANUP ON COMPLETION

完成时的状态清理

IMPORTANT: Use the cancel skill for proper state cleanup
When work is complete and Architect verification passes, run
/oh-my-claudecode:cancel
to cleanly exit ralph mode. This handles:
  • Deletion of ralph state files (both local and global)
  • Cleanup of linked ultrawork or ecomode state
  • Proper termination of the ralph loop
This ensures clean state for future sessions without leaving stale state files behind.
重要:使用cancel skill进行适当的状态清理
当工作完成且架构师验证通过后,运行
/oh-my-claudecode:cancel
以干净退出ralph模式。这将处理:
  • 删除ralph状态文件(本地和全局)
  • 清理关联的ultrawork或ecomode状态
  • 正确终止ralph循环
这确保未来会话的状态干净,不会留下陈旧的状态文件。

INSTRUCTIONS

指令

  • Review your progress so far
  • Continue from where you left off
  • Use parallel execution and background tasks
  • When FULLY complete AND Architect verified: Run
    /oh-my-claudecode:cancel
    to cleanly exit and clean up all state files
  • Do not stop until the task is truly done
Original task: {{PROMPT}}
  • 回顾你目前的进度
  • 从上次中断的地方继续
  • 使用并行执行和后台任务
  • 当完全完成且通过架构师验证后:运行
    /oh-my-claudecode:cancel
    以干净退出并清理所有状态文件
  • 直到任务真正完成才停止
原始任务: {{PROMPT}}