ralph-builder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- markdownlint-disable-file MD041 -->
STARTER_CHARACTER = 🔁
<!-- markdownlint-disable-file MD041 -->
STARTER_CHARACTER = 🔁

Ralph Builder

Ralph 构建器

Author the artifacts a ralph loop needs to run autonomously against the current repo. Tasks live in a beads (
bd
) graph database. The plan and two prompt wrappers live in
.llmtmp/
.
编写 ralph 循环针对当前代码库自主运行所需的制品。任务存储在 beads (
bd
) 图数据库中。计划和两个提示词包装器位于
.llmtmp/
。

Arguments

参数

The user provides a goal description. It may reference a file containing a PRD, plan, or task list. Extract the goal from the invocation message.
用户提供目标描述。它可能引用包含 PRD、计划或任务列表的文件。从调用消息中提取目标。

Output Artifacts

输出制品

PathPurpose
.beads/
Beads database (single source of task state)
.llmtmp/ralph-plan.md
Mode-neutral execution plan
.llmtmp/ralph-prompt-insession.md
Slash-command wrapper for the in-session ralph-loop plugin
.llmtmp/ralph-prompt-external.md
Body fed to
claude --print
by
scripts/ralph.sh
Each prompt wrapper carries a mode-specific body: in-session loops continuously, external stops after each task.
路径用途
.beads/
Beads 数据库(任务状态的唯一来源)
.llmtmp/ralph-plan.md
模式无关的执行计划
.llmtmp/ralph-prompt-insession.md
会话内 ralph-loop 插件的 slash-command 包装器
.llmtmp/ralph-prompt-external.md
由
scripts/ralph.sh
传给
claude --print
的正文
每个提示词包装器都包含对应模式的正文:会话内模式会持续循环,外部模式在每个任务后停止。

Procedure

流程

Step 1: Gather Context

第 1 步:收集上下文

Read the repo to ground the plan:
  1. README.md
    (project root)
  2. All
    .md
    files in
    .llmdocs/
  3. Any file referenced in the user's goal arguments
Create
.llmtmp/
if it does not exist.
读取代码库,以便为计划提供依据:
  1. README.md
    (项目根目录)
  2. .llmdocs/
    中的所有
    .md
    文件
  3. 用户目标参数中引用的任何文件
如果
.llmtmp/
不存在,则创建它。

Step 2: Initialize beads and mint the run epic

第 2 步:初始化 beads 并创建本次运行的 epic

The bead graph is shared across worktrees of the same repo. Each ralph run is organized under a per-run epic so concurrent runs in different worktrees stay isolated by
--parent
filtering.
bash
if ! bd list >/dev/null 2>&1; then
  bd init --skip-agents
fi

slug=$(git branch --show-current | tr '/' '-')
epic=$(bd q "Ralph: ${slug}" -t epic -p 1 -l "ralph:${slug}")
--skip-agents
suppresses bd's default
AGENTS.md
generation,
CLAUDE.md
modification, and
.claude/settings.json
injection. The project's existing agent guidance and the
beads
skill provide bd workflow context; bd's per-project agent files are redundant and conflict with project conventions.
The epic carries the label
ralph:${slug}
as run-identity. Children created in Step 3 carry both
--parent "${epic}"
and the same label, providing two independent signals so the reviewer can detect orphans.
同一代码库的所有 worktree 共享 bead 图。每次 ralph 运行都组织在一个按运行划分的 epic 之下,因此通过
--parent
过滤,不同 worktree 中的并发运行能够彼此隔离。
bash
if ! bd list >/dev/null 2>&1; then
  bd init --skip-agents
fi

slug=$(git branch --show-current | tr '/' '-')
epic=$(bd q "Ralph: ${slug}" -t epic -p 1 -l "ralph:${slug}")
--skip-agents
会禁止 bd 默认生成
AGENTS.md
、修改
CLAUDE.md
以及注入
.claude/settings.json
。项目现有的 agent 指引和
beads
skill 为 bd 工作流提供上下文;bd 按项目生成的 agent 文件是冗余的,并且会与项目约定冲突。
本次运行的 epic 携带标签
ralph:${slug}
,作为运行身份标识。第 3 步创建的子 bead 同时带有
--parent "${epic}"
和相同标签,从而提供两个独立信号,让审查者能够检测孤立项。

Step 3: Translate Goal to bd Graph

第 3 步:将目标转换为 bd 图

Every action in a ralph run is a bead. Each bead has a title (imperative one-liner) and a description (the worker's full instructions for that task). Lifecycle scaffolding (branch creation, BEGIN tag, END tag) is encoded as ordinary beads, all parented to the run epic.
Create child beads with
bd create -t task --parent "${epic}" -l "ralph:${slug}" -q --json | jq -r .id
. Capture each ID for downstream
bd link
calls. Set descriptions with
bd update <id> -d "<text>"
(or
--body-file -
heredoc for multi-line). Wire dependencies with
bd link <a> <b>
(b blocks a). Every run starts with a branch task and a BEGIN tag task; every run ends with an END tag task that depends transitively on every other task.
ralph 运行中的每个操作都是一个 bead。每个 bead 都有一个标题(祈使句式的一行摘要)和一段描述(worker 执行该任务的完整指令)。生命周期脚手架(创建 branch、BEGIN tag、END tag)也编码为普通 bead,并全部以本次运行的 epic 为父节点。
使用
bd create -t task --parent "${epic}" -l "ralph:${slug}" -q --json | jq -r .id
创建子 bead。记录每个 ID,供后续
bd link
调用使用。使用
bd update <id> -d "<text>"
设置描述,或者对多行描述使用
--body-file -
heredoc。通过
bd link <a> <b>
连接依赖(b 阻塞 a)。每次运行都以 branch 任务和 BEGIN tag 任务开始;以 END tag 任务结束,该任务传递依赖于所有其他任务。

Example

示例

The block below shows a hypothetical run adding three greeting functions to
lib/greeting.go
and updating the README. The literal values (
SLUG
, file paths, function names, commit prefixes) are illustrative; substitute the real run's facts. Bead descriptions carry task-specific facts only. Each coding task description uses the RED/GREEN/VERIFY structure defined below. Universal rules (conventional commits, persona constraints) already live in
CLAUDE.md
. Run-wide conventions (build, test, lint commands) live in
ralph-plan.md
. Descriptions do not restate either.
bash
DATE=$(date +%Y%m%d)
SLUG=greeting   # derive from the goal; lowercase alphanumeric plus hyphen, max ~20 chars
HASH=$(openssl rand -hex 2 | head -c 3)
RUN="${DATE}-${SLUG}-${HASH}"
BRANCH="ralph/${RUN}"
下面的代码块展示了一次假设性运行:向
lib/greeting.go
添加三个 greeting 函数并更新 README。字面值(
SLUG
、文件路径、函数名、commit 前缀)仅为示例;应替换为真实运行的信息。Bead 描述只包含任务特定的事实。每个编码任务的描述都使用下文定义的 RED/GREEN/VERIFY 结构。通用规则(conventional commits、persona 约束)已位于
CLAUDE.md
中。运行级约定(build、test、lint 命令)位于
ralph-plan.md
中。描述不重复上述任一内容。
bash
DATE=$(date +%Y%m%d)
SLUG=greeting   # derive from the goal; lowercase alphanumeric plus hyphen, max ~20 chars
HASH=$(openssl rand -hex 2 | head -c 3)
RUN="${DATE}-${SLUG}-${HASH}"
BRANCH="ralph/${RUN}"

slug and epic are in scope from Step 2.

slug and epic are in scope from Step 2.

bdc() { bd create "$1" -t task -p 2 --parent "${epic}" -l "ralph:${slug}" -q --json | jq -r .id }
T_BRANCH=$(bdc "Switch to branch ${BRANCH}") bd update "$T_BRANCH" -d "Switch to branch ${BRANCH}, creating it if missing. Verify: git rev-parse --abbrev-ref HEAD prints ${BRANCH}."
T_BEGIN=$(bdc "Tag RALPH-${RUN}-BEGIN") bd link "$T_BEGIN" "$T_BRANCH" bd update "$T_BEGIN" -d "Run: git tag RALPH-${RUN}-BEGIN. Verify: git tag -l RALPH-${RUN}-BEGIN is non-empty."
T1=$(bdc "Add hello() to lib/greeting.go") bd link "$T1" "$T_BEGIN" bd update "$T1" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Create lib/greeting_test.go. Test cases: hello() returns "world".
GREEN phase (then implement): Create hello() in lib/greeting.go returning "world".
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add hello DESC
T2=$(bdc "Add goodbye() to lib/greeting.go") bd link "$T2" "$T_BEGIN" bd update "$T2" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Add to lib/greeting_test.go. Test cases: goodbye() returns "bye".
GREEN phase (then implement): Create goodbye() in lib/greeting.go returning "bye".
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add goodbye DESC
T3=$(bdc "Add greet(name) to lib/greeting.go") bd link "$T3" "$T1" bd link "$T3" "$T2" bd update "$T3" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Add to lib/greeting_test.go. Test cases: greet("Jim") returns "world Jim bye".
GREEN phase (then implement): Create greet(name) in lib/greeting.go composing hello() and goodbye().
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add greet DESC
T4=$(bdc "Document greetings API") bd link "$T4" "$T3" bd update "$T4" -d "Run the docs skill (/docs, $docs) to document hello(), goodbye(), and greet() now exposed by lib/greeting.go. Commit: docs: document greetings API"
T_END=$(bdc "Tag RALPH-${RUN}-END") bd link "$T_END" "$T4" bd update "$T_END" -d "Run: git tag RALPH-${RUN}-END. Verify: git tag -l RALPH-${RUN}-END is non-empty."

The 3-char hash suffix prevents branch and tag collisions when multiple ralph runs share a date and slug.

After authoring, assert no cycles, every child has a description, at least one task is ready, and the parent set equals the label set (excluding the epic):

```bash
bd dep cycles
bd list --parent "${epic}" --json | jq -e 'all(.[]; (.description // "") | length > 0)'
bd ready --parent "${epic}" --json | jq 'length'

parent_ids=$(bd list --parent "${epic}" --json | jq -r '.[].id' | sort)
label_ids=$(bd list --label "ralph:${slug}" --json | jq -r '.[] | select(.issue_type != "epic") | .id' | sort)
[[ "${parent_ids}" == "${label_ids}" ]] || { echo "parent/label set mismatch: orphans or misclassified beads"; exit 1; }
Title rules:
  • Imperative voice, one line
  • Names the deliverable, not the procedure
  • No meta-tasks like "read the codebase" or "understand the architecture"
Description rules:
  • Task-specific facts only: which file, what behavior, the commit message for this task
  • Include a verification command only when it differs from the run's standard test command (typically tag and branch tasks)
  • Do not restate code style or persona rules; those live in
    CLAUDE.md
    . Do not restate run-wide build, test, or lint commands; those live in
    ralph-plan.md
  • Every coding task description uses RED/GREEN/VERIFY structure: RED phase names the test file and enumerates specific test cases with expected behavior. GREEN phase describes implementation only. VERIFY names the test command and conventional commit message. Lifecycle, config, SQL, shell, Helm, and docs beads are exempt.
  • Never create standalone "write tests", "add unit tests", or "integration checkpoint" beads. Tests live inside each coding task via RED phase. No test-only beads, no deferred test-suite beads.
Skill delegations (mandatory):
WorkSkill
Updating
README.md
,
CLAUDE.md
, or any file in
.llmdocs/
docs (/docs, $docs)
Beads in these categories must invoke the skill in the description, not author edits inline. Example:
Run the docs skill to document the new auth middleware
rather than
Edit .llmdocs/architecture.md to add an Authentication subsection
. The skill carries its own guardrails and parallelism; reproducing its job inline loses both.
bdc() { bd create "$1" -t task -p 2 --parent "${epic}" -l "ralph:${slug}" -q --json | jq -r .id }
T_BRANCH=$(bdc "Switch to branch ${BRANCH}") bd update "$T_BRANCH" -d "Switch to branch ${BRANCH}, creating it if missing. Verify: git rev-parse --abbrev-ref HEAD prints ${BRANCH}."
T_BEGIN=$(bdc "Tag RALPH-${RUN}-BEGIN") bd link "$T_BEGIN" "$T_BRANCH" bd update "$T_BEGIN" -d "Run: git tag RALPH-${RUN}-BEGIN. Verify: git tag -l RALPH-${RUN}-BEGIN is non-empty."
T1=$(bdc "Add hello() to lib/greeting.go") bd link "$T1" "$T_BEGIN" bd update "$T1" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Create lib/greeting_test.go. Test cases: hello() returns "world".
GREEN phase (then implement): Create hello() in lib/greeting.go returning "world".
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add hello DESC
T2=$(bdc "Add goodbye() to lib/greeting.go") bd link "$T2" "$T_BEGIN" bd update "$T2" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Add to lib/greeting_test.go. Test cases: goodbye() returns "bye".
GREEN phase (then implement): Create goodbye() in lib/greeting.go returning "bye".
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add goodbye DESC
T3=$(bdc "Add greet(name) to lib/greeting.go") bd link "$T3" "$T1" bd link "$T3" "$T2" bd update "$T3" --body-file - <<'DESC' TDD workflow: write failing tests first, then implement minimum code to pass.
RED phase (write first): Add to lib/greeting_test.go. Test cases: greet("Jim") returns "world Jim bye".
GREEN phase (then implement): Create greet(name) in lib/greeting.go composing hello() and goodbye().
VERIFY: go test ./lib/... passes. Commit: feat(greeting): add greet DESC
T4=$(bdc "Document greetings API") bd link "$T4" "$T3" bd update "$T4" -d "Run the docs skill (/docs, $docs) to document hello(), goodbye(), and greet() now exposed by lib/greeting.go. Commit: docs: document greetings API"
T_END=$(bdc "Tag RALPH-${RUN}-END") bd link "$T_END" "$T4" bd update "$T_END" -d "Run: git tag RALPH-${RUN}-END. Verify: git tag -l RALPH-${RUN}-END is non-empty."

3 字符的 hash 后缀可以防止多个 ralph 运行共享同一日期和 slug 时发生 branch 与 tag 冲突。

编写完成后,断言不存在环、每个子 bead 都有描述、至少有一个任务处于 ready 状态,并且父节点集合等于标签集合(不含 epic):

```bash
bd dep cycles
bd list --parent "${epic}" --json | jq -e 'all(.[]; (.description // "") | length > 0)'
bd ready --parent "${epic}" --json | jq 'length'

parent_ids=$(bd list --parent "${epic}" --json | jq -r '.[].id' | sort)
label_ids=$(bd list --label "ralph:${slug}" --json | jq -r '.[] | select(.issue_type != "epic") | .id' | sort)
[[ "${parent_ids}" == "${label_ids}" ]] || { echo "parent/label set mismatch: orphans or misclassified beads"; exit 1; }
标题规则:
  • 使用祈使语气,保持单行
  • 命名交付物,而不是过程
  • 不设置“阅读代码库”或“理解架构”之类的元任务
描述规则:
  • 只包含任务特定的事实:涉及哪个文件、应有何种行为、该任务的 commit message
  • 仅当验证命令不同于本次运行的标准 test 命令时才包含验证命令(通常是 tag 和 branch 任务)
  • 不重复代码风格或 persona 规则;这些规则位于
    CLAUDE.md
    中。不重复运行级的 build、test 或 lint 命令;这些命令位于
    ralph-plan.md
    中
  • 每个编码任务描述都采用 RED/GREEN/VERIFY 结构:RED 阶段指定测试文件,并枚举具有预期行为的具体测试用例。GREEN 阶段只描述实现。VERIFY 阶段指定 test 命令和 conventional commit message。生命周期、配置、SQL、shell、Helm 和 docs bead 不受此要求约束。
  • 绝不创建独立的“write tests”“add unit tests”或“integration checkpoint” bead。测试通过每个编码任务的 RED 阶段内嵌。不得设置仅测试的 bead,也不得设置延后的测试套件 bead。
Skill 委派(强制):
工作Skill
更新
README.md
、
CLAUDE.md
或
.llmdocs/
中的任何文件
docs (/docs, $docs)
这些类别的 bead 必须在描述中调用相应 skill,而不是直接编写编辑内容。例如:
运行 docs skill,为新的 auth middleware 编写文档
,而不是
编辑 .llmdocs/architecture.md,添加 Authentication 小节
。Skill 自带约束条件和并行机制;内联复现其工作会同时损失这两项优势。

Step 4: Write
.llmtmp/ralph-plan.md

第 4 步:编写
.llmtmp/ralph-plan.md

Each iteration reads this file cold with no memory of prior runs. Every command, pattern, and convention belongs here. Dense, repo-specific detail is correct.
The "Run Identity" section records the literal
${slug}
and
${epic}
values produced in Step 2 so the agent can read them directly without re-deriving each iteration.
The "Inputs" section's
plan documents:
line records the source documents the planner was passed via the user's arguments. The reviewer parses that line and reads each path as authoritative intent. This is a passthrough: list exactly the files from the user's arguments, no more, no fewer, no inferred additions. If a referenced path does not exist, fail the build with a clear error rather than dropping it.
Required sections:
markdown
undefined
每次迭代都会冷启动读取此文件,不保留之前运行的任何记忆。每条命令、模式和约定都应放在这里。内容可以密集且针对代码库特化。
“Run Identity”部分记录第 2 步生成的实际
${slug}
和
${epic}
值,因此 Agent 可以直接读取,无需在每次迭代时重新推导。
“Inputs”部分的
plan documents:
行记录规划器通过用户参数收到的源文档。审查者会解析该行,并将每个路径作为权威意图依据进行读取。这是一次直接透传:只列出用户参数中的文件,不多不少,也不得推断添加其他文件。如果引用的路径不存在,应以清晰的错误使构建失败,而不是将其忽略。
必需章节:
markdown
undefined

Ralph Plan

Ralph Plan

Goal

Goal

<one paragraph>
<one paragraph>

Approach

Approach

<strategy specific to this goal; include all relevant repo-specific detail directly>
<strategy specific to this goal; include all relevant repo-specific detail directly>

Inputs

Inputs

plan documents: <comma-separated paths from the user's arguments, or empty if none>
plan documents: <comma-separated paths from the user's arguments, or empty if none>

Run Identity

Run Identity

  • Branch slug:
    <slug from Step 2>
  • Epic ID:
    <epic ID from Step 2>
  • Epic label:
    ralph:<slug>
  • Driver:
    scripts/ralph.sh .llmtmp/ralph-prompt-external.md
  • Branch slug:
    <slug from Step 2>
  • Epic ID:
    <epic ID from Step 2>
  • Epic label:
    ralph:<slug>
  • Driver:
    scripts/ralph.sh .llmtmp/ralph-prompt-external.md

Conventions

Conventions

<repo-specific patterns, tools, test commands, build commands, commit style>
<repo-specific patterns, tools, test commands, build commands, commit style>

Git Workflow

Git Workflow

All git operations execute as bd tasks per the per-task workflow. Branch creation, BEGIN tag, code commits, docs commits, and END tag are first-class beads in the graph, parented to the run epic. Never commit on
main
.
All git operations execute as bd tasks per the per-task workflow. Branch creation, BEGIN tag, code commits, docs commits, and END tag are first-class beads in the graph, parented to the run epic. Never commit on
main
.

Per-Task Workflow

Per-Task Workflow

Exactly ONE task per iteration. After step 5, follow the driver instruction. The driver controls whether the agent loops in-session or stops for a fresh context.
Each iteration:
  1. Read the epic ID and slug from the "Run Identity" section above.
  2. Run
    bd ready --parent <epic-id> --json
    . If the result is
    []
    , run
    bd close <epic-id> -m "ralph run complete"
    , output
    <promise>ALLDONE</promise>
    , and stop.
  3. Pick the first task. Run
    bd show <id>
    to read the title and description.
  4. Execute the description exactly. The description names the files, commands, verification step, and commit message for this task.
  5. Run
    bd close <id>
    . Follow the driver instruction below.
The sentinel
<promise>ALLDONE</promise>
is emitted only on the iteration where step 2 finds the ready queue empty (all children closed and the epic just closed).
Exactly ONE task per iteration. After step 5, follow the driver instruction. The driver controls whether the agent loops in-session or stops for a fresh context.
Each iteration:
  1. Read the epic ID and slug from the "Run Identity" section above.
  2. Run
    bd ready --parent <epic-id> --json
    . If the result is
    []
    , run
    bd close <epic-id> -m "ralph run complete"
    , output
    <promise>ALLDONE</promise>
    , and stop.
  3. Pick the first task. Run
    bd show <id>
    to read the title and description.
  4. Execute the description exactly. The description names the files, commands, verification step, and commit message for this task.
  5. Run
    bd close <id>
    . Follow the driver instruction below.
The sentinel
<promise>ALLDONE</promise>
is emitted only on the iteration where step 2 finds the ready queue empty (all children closed and the epic just closed).

Driver Instruction

Driver Instruction

<!-- Replaced at plan-write time by the prompt wrapper. --> <!-- In-session: "Return to step 1 to pick the next task." --> <!-- External: "STOP. The driver spawns a fresh context for the next task." -->

Plan rules:

- Ground instructions in actual repo structure and tooling
- Include build, test, and lint commands when known
- Do not duplicate the project's CLAUDE.md
- Define what "done" means for a task (tests pass, linter clean)
- State current facts only
- `plan documents:` lists exactly the files referenced in the user's arguments. Do not add `README.md`, `CLAUDE.md`, or `.llmdocs/*` (the reviewer reads those independently as baseline). Do not infer related files from `.llmtmp/` or elsewhere. If a referenced path does not exist, fail the build with a clear error rather than dropping it.
<!-- Replaced at plan-write time by the prompt wrapper. --> <!-- In-session: "Return to step 1 to pick the next task." --> <!-- External: "STOP. The driver spawns a fresh context for the next task." -->

计划规则:

- 以实际代码库结构和工具为依据编写指令
- 在已知时包含 build、test 和 lint 命令
- 不重复项目的 `CLAUDE.md`
- 定义任务的“完成”标准(测试通过、linter 无告警)
- 仅陈述当前事实
- `plan documents:` 恰好列出用户参数中引用的文件。不要添加 `README.md`、`CLAUDE.md` 或 `.llmdocs/*`(审查者会将它们作为基线单独读取)。不要从 `.llmtmp/` 或其他位置推断相关文件。如果引用的路径不存在,应以清晰的错误使构建失败,而不是将其忽略。

Step 5: Write Prompt Wrappers

第 5 步:编写提示词包装器

Each mode gets its own body because the driver instruction differs.
In-session body (loops without stopping):
text
Read .llmtmp/ralph-plan.md and follow it. After closing each task, return to step 1 of the Per-Task Workflow to pick the next ready task. Do not stop between tasks.
External body (one task per invocation):
text
Read .llmtmp/ralph-plan.md and follow it. After closing each task, STOP. The driver spawns a fresh context for the next task.
.llmtmp/ralph-prompt-insession.md
is one line using the in-session body:
text
/ralph-loop:ralph-loop "<in-session body>" --max-iterations 100 --completion-promise ALLDONE
.llmtmp/ralph-prompt-external.md
is the external body alone, no wrapper.
每种模式都有各自的正文,因为 driver 指令有所不同。
会话内正文(循环且不停止):
text
Read .llmtmp/ralph-plan.md and follow it. After closing each task, return to step 1 of the Per-Task Workflow to pick the next ready task. Do not stop between tasks.
外部正文(每次调用执行一个任务):
text
Read .llmtmp/ralph-plan.md and follow it. After closing each task, STOP. The driver spawns a fresh context for the next task.
.llmtmp/ralph-prompt-insession.md
是使用会话内正文的一行内容:
text
/ralph-loop:ralph-loop "<in-session body>" --max-iterations 100 --completion-promise ALLDONE
.llmtmp/ralph-prompt-external.md
仅包含外部正文,不带包装器。

Validation

验证

Before finishing, assert:
  • bd list >/dev/null 2>&1
    exits zero
  • bd dep cycles
    exits zero
  • A single open epic exists for this run:
    bd list -t epic -l "ralph:${slug}" --json | jq -e 'length == 1'
  • bd ready --parent "${epic}" --json | jq 'length'
    is greater than zero
  • Every child of the epic has a non-empty description:
    bd list --parent "${epic}" --json | jq -e 'all(.[]; (.description // "") | length > 0)'
  • Parent set equals label set (excluding the epic itself):
    bash
    diff <(bd list --parent "${epic}" --json | jq -r '.[].id' | sort) \
         <(bd list --label "ralph:${slug}" --json | jq -r '.[] | select(.issue_type != "epic") | .id' | sort)
  • .llmtmp/ralph-plan.md
    ,
    .llmtmp/ralph-prompt-insession.md
    ,
    .llmtmp/ralph-prompt-external.md
    all exist
  • The plan's "Run Identity" section records the literal slug and epic ID
  • The in-session prompt contains "return to step 1" and "Do not stop between tasks"
  • The external prompt contains "STOP" and "fresh context"
If any assertion fails, fix and re-validate.
结束前,断言:
  • bd list >/dev/null 2>&1
    的退出码为零
  • bd dep cycles
    的退出码为零
  • 本次运行仅存在一个 open epic:
    bd list -t epic -l "ralph:${slug}" --json | jq -e 'length == 1'
  • bd ready --parent "${epic}" --json | jq 'length'
    大于零
  • epic 的每个子 bead 都有非空描述:
    bd list --parent "${epic}" --json | jq -e 'all(.[]; (.description // "") | length > 0)'
  • 父节点集合等于标签集合(不含 epic 本身):
    bash
    diff <(bd list --parent "${epic}" --json | jq -r '.[].id' | sort) \
         <(bd list --label "ralph:${slug}" --json | jq -r '.[] | select(.issue_type != "epic") | .id' | sort)
  • .llmtmp/ralph-plan.md
    、
    .llmtmp/ralph-prompt-insession.md
    、
    .llmtmp/ralph-prompt-external.md
    均存在
  • 计划的“Run Identity”部分记录了字面量 slug 和 epic ID
  • 会话内提示词包含
    return to step 1
    和
    Do not stop between tasks
  • 外部提示词包含
    STOP
    和
    fresh context
如果任何断言失败,请修复并重新验证。