ralphing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRalphing
运行Ralph自主编码循环
Ralph is an autonomous AI coding loop that ships features while you sleep. Each iteration runs in a fresh context window, while memory persists through git history and text files.
Ralph是一款自主AI编码循环工具,能在你休息时完成功能开发并交付。每次迭代都会在全新的上下文窗口中运行,而记忆则通过git历史记录和文本文件得以保留。
When to Use
使用场景
When the user wants to implement a multi-story feature autonomously, or mentions "ralph", "ralphing", or "autonomous loop".
当用户希望自主实现多需求故事的功能,或者提到“ralph”、“ralphing”或“自主循环”时使用。
Workflow
工作流程
Step 1: Get the PRD
步骤1:获取PRD文件
The user provides a PRD file, or you help them create one. Ask:
- Do you have a PRD already, or should we create one together?
- What's the repo path?
- What's the test command? (e.g., ,
bundle exec rake)npm test - How many iterations max? (default: 25)
用户提供PRD文件,或者你协助他们创建。请询问:
- 你已有PRD文件,还是需要我们一起创建?
- 仓库路径是什么?
- 测试命令是什么?(例如:、
bundle exec rake)npm test - 最大迭代次数是多少?(默认值:25)
PRD Format
PRD格式
markdown
undefinedmarkdown
undefinedPRD
PRD
Branch:
<branch-name>Branch:
<branch-name>Stories
Stories
US-001: <Story title>
US-001: <Story title>
- <Acceptance criterion>
- <Acceptance criterion>
- <Acceptance criterion>
- <Acceptance criterion>
US-002: <Story title>
US-002: <Story title>
- <Acceptance criterion>
Guidelines for stories:
- **Small**: Must fit in one context window
- **Explicit criteria**: Avoid vague ("Users can log in"), prefer specific checks
- Story order = priority (first = highest)
Note: Ralph is typically run in a git worktree. If already on the correct branch (or detached HEAD), the branch checkout is skipped.- <Acceptance criterion>
需求故事编写准则:
- **粒度要小**:必须能容纳在一个上下文窗口中
- **验收标准明确**:避免模糊表述(如“用户可以登录”),优先使用可具体验证的检查项
- 故事顺序=优先级(第一个故事优先级最高)
注意:Ralph通常在git worktree中运行。如果已处于正确分支(或分离HEAD状态),则会跳过分支检出步骤。Step 2: Start the Loop
步骤2:启动循环
bash
~/.claude/skills/ralphing/assets/ralph.sh start <repo_path> <prd.md> [max_iterations] [test_cmd]This returns a session directory (e.g., ) and runs the loop in the background.
/tmp/ralph/ABC123-...bash
~/.claude/skills/ralphing/assets/ralph.sh start <repo_path> <prd.md> [max_iterations] [test_cmd]这会生成一个会话目录(例如:)并在后台运行循环。
/tmp/ralph/ABC123-...Step 3: Monitor Progress
步骤3:监控进度
Poll the session status periodically:
bash
~/.claude/skills/ralphing/assets/ralph.sh status <ralph_dir>This outputs:
- :
status,running, orcompletefailed - : current/max iterations
iteration - Full contents of
progress.txt
Keep polling until status is or .
completefailed定期轮询会话状态:
bash
~/.claude/skills/ralphing/assets/ralph.sh status <ralph_dir>该命令会输出:
- :
status(运行中)、running(已完成)或complete(失败)failed - :当前/最大迭代次数
iteration - 的完整内容
progress.txt
持续轮询直到状态变为或。
completefailedHow the Loop Works
循环工作原理
- copies PRD, generates prompt, checks out branch (if needed), and spawns background process
start - Background loop: agent implements story -> commits -> runs tests
- If tests fail, reverts commit and retries (progress.txt preserved)
- Exits when agent signals or max iterations reached
<promise>COMPLETE</promise> - Parent agent polls to observe progress without blocking
status
- 命令会复制PRD、生成提示词、检出分支(如有需要)并启动后台进程
start - 后台循环流程:Agent实现需求故事 -> 提交代码 -> 运行测试
- 如果测试失败,会回滚提交并重试(内容会保留)
progress.txt - 当Agent发出信号或达到最大迭代次数时,循环退出
<promise>COMPLETE</promise> - 父Agent通过轮询来观察进度,不会造成阻塞
status
Resources
相关资源
- - the loop script (start/status commands)
assets/ralph.sh - - prompt template (uses
assets/prompt.mdplaceholder)<RALPH_DIR>
- - 循环脚本(包含start/status命令)
assets/ralph.sh - - 提示词模板(使用
assets/prompt.md占位符)<RALPH_DIR>