validator-run

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/validator-run

/validator-run

Execute the autonomous verification suite.
执行自主验证套件。

Procedure

流程

Step 1 - Run Agent Validator

步骤1 - 运行Agent Validator

If the caller requests a specific review to be enabled, append
--enable-review <name>
to the run command for each requested review.
Run
agent-validate run
using
Bash
with
timeout: 300000
. ALWAYS wait for and read the full command output before proceeding — the command typically takes 1-2 minutes. Verify you can see a
Status:
line in the output before continuing.
如果调用者要求启用特定评审,请为每个请求的评审在运行命令后追加
--enable-review <name>
使用
Bash
运行
agent-validate run
,设置
timeout: 300000
在继续操作前务必等待并读取完整的命令输出——该命令通常需要1-2分钟。继续前请确认输出中包含
Status:
行。

Step 2 - Check Status

步骤2 - 检查状态

NEVER assume success — you must see an explicit
Status:
line before continuing. Check it and route accordingly:
  • Status: Passed
    → Go to Step 8.
  • Status: Passed with warnings
    → Go to Step 8.
  • Status: Failed
    → Continue to Step 3. You MUST continue — do not stop here.
  • Status: Retry limit exceeded
    → Go to Step 8.
  • No status line visible → Known issue: Bun can drop all stdout/stderr when LLM review subprocesses run. Read the console log file to get the status: find the latest
    console.*.log
    in the validator log directory (e.g.,
    validator_logs/console.1.log
    ) and look for the
    Status:
    line there. If no console log is found there, also check
    validator_logs/previous/
    for logs from the most recent archived run. If no console log exists in either location, the command may have timed out or failed to run — re-run with a longer timeout or investigate the error. Do NOT proceed as if it passed.
绝不要假设验证成功——必须看到明确的
Status:
行才能继续。检查状态并按如下路径处理:
  • Status: Passed
    → 进入步骤8。
  • Status: Passed with warnings
    → 进入步骤8。
  • Status: Failed
    → 继续步骤3。必须继续操作,请勿在此停止。
  • Status: Retry limit exceeded
    → 进入步骤8。
  • 未显示状态行 → 已知问题: 当LLM评审子进程运行时,Bun可能会丢失所有stdout/stderr输出。请读取控制台日志文件获取状态:在验证器日志目录中找到最新的
    console.*.log
    文件(例如
    validator_logs/console.1.log
    ),并在其中查找
    Status:
    行。如果该目录下没有控制台日志,也请检查
    validator_logs/previous/
    中最近存档运行的日志。如果两个位置都没有控制台日志,说明命令可能超时或运行失败——请延长超时时间重新运行或排查错误。请勿当作验证通过继续操作。

Step 3 - Extract Failures

步骤3 - 提取失败信息

Required when status is Failed:
  • Infer the log directory from the file paths in the console output (e.g., if output references
    validator_logs/check_._lint.1.log
    , the log directory is
    validator_logs/
    )
  • Extract log failures using the first available strategy: a. Task tool (Claude Code):
    Task
    with
    subagent_type="general-purpose"
    ,
    model="haiku"
    ,
    prompt=
    the Extract Prompt (from the Appendix below) +
    "\n\nLog directory: <inferred path>"
    . Task calls MUST be synchronous — NEVER use
    run_in_background: true
    . b. Subagent delegation: If your environment supports delegating work to a subagent but not the Task tool, delegate the Extract Prompt instructions with the log directory to a subagent for processing. c. Inline fallback: If no subagent capability is available, follow the Extract Prompt instructions yourself to read the log files and produce the compact failure summary.
当状态为Failed时需执行此步骤:
  • 从控制台输出中的文件路径推断日志目录(例如,如果输出引用
    validator_logs/check_._lint.1.log
    ,则日志目录为
    validator_logs/
  • 使用以下优先策略提取日志失败信息: a. 任务工具(Claude Code):调用
    Task
    ,设置
    subagent_type="general-purpose"
    model="haiku"
    prompt
    为下方附录中的提取提示语 +
    "\n\nLog directory: <推断路径>"
    任务调用必须同步——请勿设置
    run_in_background: true
    。 b. 子代理委托:如果您的环境支持将工作委托给子代理但不支持任务工具,请将提取提示语说明和日志目录委托给子代理处理。 c. 内联回退:如果没有子代理功能,请自行按照提取提示语说明读取日志文件并生成简洁的失败摘要。

Step 4 - Report Failures

步骤4 - 报告失败信息

Print the compact failure summary returned from Step 3.
打印步骤3返回的简洁失败摘要。

Step 5 - Fix

步骤5 - 修复问题

Fix issues reasonably supported by the feedback or likely intended by the human. When skipping an issue, briefly state what was skipped and why.
Valid reasons to skip:
  • Purely stylistic or subjective preference
  • The human would not want it changed
You MUST NOT skip for these reasons:
  • "Issue is pre-existing" — you MUST fix it unless you have another valid reason
  • "Issue is out of scope" — you MUST address valid feedback even if it requires refactoring or non-trivial changes
Apply this guidance to each failure and fix accordingly:
  • CHECK failures with Fix Skill: invoke the named skill
  • CHECK failures with Fix Instructions: follow the instructions
  • REVIEW violations: fix or skip per the guidance above
根据反馈合理修复问题,或按照人类的预期进行修复。跳过问题时,请简要说明跳过的内容及原因。
可跳过的合理原因:
  • 纯风格或主观偏好问题
  • 人类不希望修改该内容
以下原因禁止跳过问题:
  • "问题已存在"——除非有其他合理原因,否则必须修复
  • "问题超出范围"——即使需要重构或重大修改,也必须处理有效的反馈
针对每个失败问题,按以下指导修复:
  • 带有修复技能的CHECK失败:调用指定的skill
  • 带有修复说明的CHECK失败:遵循说明操作
  • REVIEW违规:根据上述指导修复或跳过

Step 6 - Update Review Decisions

步骤6 - 更新评审决策

For REVIEW violations you addressed:
  • Update review decisions using the first available strategy (same as Step 3): a. Task tool (Claude Code):
    Task
    with
    subagent_type="general-purpose"
    ,
    model="haiku"
    ,
    prompt=
    the Update Prompt (from the Appendix below) + log directory + decisions list. Task calls MUST be synchronous — NEVER use
    run_in_background: true
    . b. Subagent delegation: Delegate the Update Prompt instructions with the log directory and decisions to a subagent. c. Inline fallback: Follow the Update Prompt instructions yourself to update the review JSON files.
对于已处理的REVIEW违规:
  • 使用以下优先策略更新评审决策(与步骤3相同): a. 任务工具(Claude Code):调用
    Task
    ,设置
    subagent_type="general-purpose"
    model="haiku"
    prompt
    为下方附录中的更新提示语 + 日志目录 + 决策列表。任务调用必须同步——请勿设置
    run_in_background: true
    。 b. 子代理委托:将更新提示语说明、日志目录和决策委托给子代理。 c. 内联回退:自行按照更新提示语说明更新评审JSON文件。

Step 7 - Re-run Verification

步骤7 - 重新运行验证

NEVER skip this step — if the run failed, you MUST fix and re-run. Run the same command from Step 1 (including any
--enable-review
flags) again with
Bash
and
timeout: 300000
. The tool detects existing logs and automatically switches to verification mode. Go back to Step 2 to check the status line and repeat.
绝不要跳过此步骤——如果运行失败,必须修复后重新运行。再次使用
Bash
运行步骤1中的相同命令(包括所有
--enable-review
参数),设置
timeout: 300000
。工具会检测现有日志并自动切换到验证模式。返回步骤2检查状态行并重复流程。

Step 8 - Summarize Session

步骤8 - 总结会话

Provide a summary of the session:
  • Final Status: (Passed / Passed with warnings / Retry limit exceeded)
  • Issues Fixed: (list key fixes)
  • Issues Skipped: (list skipped items and reasons)
  • Outstanding Failures: (if retry limit exceeded, list unverified fixes and remaining issues)

提供会话总结:
  • 最终状态:(Passed / Passed with warnings / Retry limit exceeded)
  • 已修复问题:(列出关键修复内容)
  • 已跳过问题:(列出跳过项及原因)
  • 未解决失败:(如果超出重试次数,列出未验证的修复内容和剩余问题)

Appendix: Subagent Prompts

附录:子代理提示语

Extract Prompt

提取提示语

You are an EXTRACT subagent. Your job is to read validator log files and return a compact error summary.
您是一名EXTRACT子代理。您的工作是读取验证器日志文件并返回简洁的错误摘要。

Input

输入

You receive a log directory path as your only input.
您仅会收到一个日志目录路径作为输入。

Process

流程

  1. List files directly under the log directory
  2. Find the highest-numbered
    console.N.log
    file (e.g.,
    console.3.log
    >
    console.2.log
    )
  3. Read it and find all lines containing
    [FAIL]
  4. For each
    [FAIL]
    line, extract the referenced file path
  5. Read each referenced file:
    • .log
      files
      (check gates): Extract error output. Look for
      --- Fix Instructions ---
      sections and
      --- Fix Skill: <name> ---
      sections. Include their full content.
    • .json
      files
      (review gates): Parse the JSON. Find violations where
      status
      is
      "new"
      . For each, extract:
      file
      ,
      line
      ,
      issue
      ,
      priority
      ,
      fix
      .
  1. 列出日志目录下的直接文件
  2. 找到编号最高的
    console.N.log
    文件(例如
    console.3.log
    >
    console.2.log
  3. 读取该文件并找到所有包含
    [FAIL]
    的行
  4. 对于每个
    [FAIL]
    行,提取引用的文件路径
  5. 读取每个引用的文件:
    • .log
      文件
      (检查关卡):提取错误输出。查找
      --- Fix Instructions ---
      部分和
      --- Fix Skill: <name> ---
      部分。包含其完整内容。
    • .json
      文件
      (评审关卡):解析JSON。找到
      status
      "new"
      的违规项。对于每个违规项,提取:
      file
      line
      issue
      priority
      fix

Output Format

输出格式

Return a plain-text summary using EXACTLY this format:
For check failures:
text
CHECKS:
[fail] <gate_label>
<concise error description>
Fix Instructions: <extracted text if present, otherwise omit this line>
Fix Skill: <skill name if present, otherwise omit this line>
For review failures:
text
REVIEWS:
[<priority>] <gate_label>
<file>:<line> - <issue summary>
Fix: <fix suggestion>
If there are no failures of a type, omit that section entirely.
使用以下精确格式返回纯文本摘要:
检查失败:
text
CHECKS:
[fail] <gate_label>
<简洁错误描述>
Fix Instructions: <提取的文本(如果存在,否则省略此行)>
Fix Skill: <技能名称(如果存在,否则省略此行)>
评审失败:
text
REVIEWS:
[<priority>] <gate_label>
<file>:<line> - <问题摘要>
Fix: <修复建议>
如果某类没有失败项,请完全省略该部分。

Example

示例

Example Input
示例输入
Log directory:
validator_logs/
The directory contains:
  • console.2.log
  • check_src_lint.2.log
  • review_src_code-quality_claude@1.2.json
console.2.log contains:
text
[START] check:src:lint
[FAIL]  check:src:lint (1.23s) - Exited with code 1
      Log: validator_logs/check_src_lint.2.log
[START] review:src:code-quality (claude@1)
[FAIL]  review:src:code-quality (claude@1) (5.42s) - Found 2 violations
      Review: validator_logs/review_src_code-quality_claude@1.2.json
check_src_lint.2.log contains:
text
[2026-02-15T10:23:45.123Z] Starting check: lint
Executing command: bun run lint
Working directory: /Users/user/project/src

src/helpers.ts:3:5 - error: Unexpected var, use let or const instead

Command failed: bun run lint
Result: fail - Exited with code 1

--- Fix Instructions ---
Replace all `var` declarations with `const` or `let`.
review_src_code-quality_claude@1.2.json contains:
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "new"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "fixed"
    }
  ]
}
日志目录:
validator_logs/
该目录包含:
  • console.2.log
  • check_src_lint.2.log
  • review_src_code-quality_claude@1.2.json
console.2.log 包含:
text
[START] check:src:lint
[FAIL]  check:src:lint (1.23s) - Exited with code 1
      Log: validator_logs/check_src_lint.2.log
[START] review:src:code-quality (claude@1)
[FAIL]  review:src:code-quality (claude@1) (5.42s) - Found 2 violations
      Review: validator_logs/review_src_code-quality_claude@1.2.json
check_src_lint.2.log 包含:
text
[2026-02-15T10:23:45.123Z] Starting check: lint
Executing command: bun run lint
Working directory: /Users/user/project/src

src/helpers.ts:3:5 - error: Unexpected var, use let or const instead

Command failed: bun run lint
Result: fail - Exited with code 1

--- Fix Instructions ---
Replace all `var` declarations with `const` or `let`.
review_src_code-quality_claude@1.2.json 包含:
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "new"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "fixed"
    }
  ]
}
Example Output
示例输出
text
CHECKS:
[fail] check:src:lint
src/helpers.ts:3:5 - error: Unexpected var, use let or const instead
Fix Instructions: Replace all `var` declarations with `const` or `let`.

REVIEWS:
[high] review:src:code-quality (claude@1)
src/main.ts:45 - Missing error handling for async database call
Fix: Wrap in try-catch block
Note: The
src/utils.ts:10
violation was omitted because its status is
"fixed"
, not
"new"
.
text
CHECKS:
[fail] check:src:lint
src/helpers.ts:3:5 - error: Unexpected var, use let or const instead
Fix Instructions: Replace all `var` declarations with `const` or `let`.

REVIEWS:
[high] review:src:code-quality (claude@1)
src/main.ts:45 - Missing error handling for async database call
Fix: Wrap in try-catch block
注意:
src/utils.ts:10
的违规项被省略,因为其状态为
"fixed"
,而非
"new"

Rules

规则

  • Do NOT summarize or editorialize — copy error details verbatim where possible
  • Do NOT skip any
    [FAIL]
    entries
  • Keep the output compact — one entry per check failure, one entry per review violation (3 lines each)
  • For review violations, only include those with
    status: "new"
    — skip
    "fixed"
    and
    "skipped"
  • 请勿总结或编辑——尽可能直接复制错误细节
  • 请勿跳过任何
    [FAIL]
    条目
  • 保持输出简洁——每个检查失败项占一条目,每个评审违规项占一条目(各占3行)
  • 对于评审违规项,仅包含
    status: "new"
    的项——跳过
    "fixed"
    "skipped"
    的项

Update Prompt

更新提示语

You are an UPDATE subagent. Your job is to update review JSON files with fix/skip decisions.
您是一名UPDATE子代理。您的工作是用修复/跳过决策更新评审JSON文件。

Input

输入

You receive:
  1. A log directory path
  2. A list of decisions, each with:
    file
    ,
    line
    ,
    issue_prefix
    ,
    status
    ("fixed" or "skipped"), and
    result
    (brief description)
您会收到:
  1. 日志目录路径
  2. 决策列表,每个决策包含:
    file
    line
    issue_prefix
    status
    ("fixed" 或 "skipped")和
    result
    (简要描述)

Process

流程

For each decision:
  1. Find the matching
    .json
    file in the log directory by scanning for a violation that matches on
    file
    (exact) AND
    line
    (exact) AND where
    issue
    starts with the provided
    issue_prefix
    . If multiple violations match, use the first unprocessed one (status still
    "new"
    )
  2. Read the JSON file
  3. Find the matching violation in the
    violations
    array
  4. Set
    "status"
    to the provided status value
  5. Set
    "result"
    to the provided result string
  6. Write the updated JSON back to the same file path
对于每个决策:
  1. 在日志目录中查找匹配的
    .json
    文件,方法是扫描与
    file
    (完全匹配)、
    line
    (完全匹配)且
    issue
    以提供的
    issue_prefix
    开头的违规项。如果有多个匹配项,使用第一个未处理的项(状态仍为
    "new"
  2. 读取JSON文件
  3. violations
    数组中找到匹配的违规项
  4. "status"
    设置为提供的状态值
  5. "result"
    设置为提供的结果字符串
  6. 将更新后的JSON写回原文件路径

Rules

规则

  • Do NOT modify any fields other than
    status
    and
    result
  • Do NOT modify violations that don't match the provided decisions
  • Preserve all other JSON structure and key ordering
  • If a violation cannot be found, report it in your response but continue with other decisions
  • Write the JSON with 2-space indentation
  • 请勿修改
    status
    result
    以外的任何字段
  • 请勿修改与提供的决策不匹配的违规项
  • 保留所有其他JSON结构和键的顺序
  • 如果找不到违规项,请在响应中报告,但继续处理其他决策
  • 写入JSON时使用2空格缩进

Example

示例

Example Input
示例输入
Log directory:
validator_logs/
Decisions:
  • file:
    src/main.ts
    , line: 45, issue_prefix:
    Missing error handling
    , status:
    fixed
    , result:
    Added try-catch around database call
  • file:
    src/utils.ts
    , line: 10, issue_prefix:
    Function exceeds
    , status:
    skipped
    , result:
    Stylistic preference, function is readable as-is
The log directory contains
review_src_code-quality_claude@1.2.json
:
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "new"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "new"
    }
  ]
}
日志目录:
validator_logs/
决策:
  • file:
    src/main.ts
    , line: 45, issue_prefix:
    Missing error handling
    , status:
    fixed
    , result:
    Added try-catch around database call
  • file:
    src/utils.ts
    , line: 10, issue_prefix:
    Function exceeds
    , status:
    skipped
    , result:
    Stylistic preference, function is readable as-is
日志目录包含
review_src_code-quality_claude@1.2.json
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "new"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "new"
    }
  ]
}
Example Output (what you write to the JSON file)
示例输出(写入JSON文件的内容)
After updating,
review_src_code-quality_claude@1.2.json
becomes:
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "fixed",
      "result": "Added try-catch around database call"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "skipped",
      "result": "Stylistic preference, function is readable as-is"
    }
  ]
}
更新后,
review_src_code-quality_claude@1.2.json
变为:
json
{
  "adapter": "claude",
  "status": "fail",
  "violations": [
    {
      "file": "src/main.ts",
      "line": 45,
      "issue": "Missing error handling for async database call",
      "fix": "Wrap in try-catch block",
      "priority": "high",
      "status": "fixed",
      "result": "Added try-catch around database call"
    },
    {
      "file": "src/utils.ts",
      "line": 10,
      "issue": "Function exceeds 50 lines",
      "fix": "Extract helper methods",
      "priority": "medium",
      "status": "skipped",
      "result": "Stylistic preference, function is readable as-is"
    }
  ]
}
Example Response
示例响应
text
Updated 2 violations:
- src/main.ts:45 — set to fixed
- src/utils.ts:10 — set to skipped
text
Updated 2 violations:
- src/main.ts:45 — set to fixed
- src/utils.ts:10 — set to skipped

Output

输出

Return a brief confirmation listing each decision applied:
text
Updated <N> violations:
- <file>:<line> — set to <status>
If any decisions could not be matched, add:
text
Unmatched decisions:
- <file>:<line> — <issue_prefix> (not found in any JSON file)
返回简要确认信息,列出每个已应用的决策:
text
Updated <N> violations:
- <file>:<line> — set to <status>
如果有任何决策无法匹配,请添加:
text
Unmatched decisions:
- <file>:<line> — <issue_prefix> (not found in any JSON file)