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 to the run command for each requested review.
--enable-review <name>Run using with . ALWAYS wait for and read the full command output before proceeding — the command typically takes 1-2 minutes. Verify you can see a line in the output before continuing.
agent-validate runBashtimeout: 300000Status:如果调用者要求启用特定评审,请为每个请求的评审在运行命令后追加 。
--enable-review <name>使用 运行 ,设置 。在继续操作前务必等待并读取完整的命令输出——该命令通常需要1-2分钟。继续前请确认输出中包含 行。
Bashagent-validate runtimeout: 300000Status:Step 2 - Check Status
步骤2 - 检查状态
NEVER assume success — you must see an explicit line before continuing. Check it and route accordingly:
Status:- → Go to Step 8.
Status: Passed - → Go to Step 8.
Status: Passed with warnings - → Continue to Step 3. You MUST continue — do not stop here.
Status: Failed - → Go to Step 8.
Status: Retry limit exceeded - 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 in the validator log directory (e.g.,
console.*.log) and look for thevalidator_logs/console.1.logline there. If no console log is found there, also checkStatus: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.validator_logs/previous/
绝不要假设验证成功——必须看到明确的 行才能继续。检查状态并按如下路径处理:
Status:- → 进入步骤8。
Status: Passed - → 进入步骤8。
Status: Passed with warnings - → 继续步骤3。必须继续操作,请勿在此停止。
Status: Failed - → 进入步骤8。
Status: Retry limit exceeded - 未显示状态行 → 已知问题: 当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 , the log directory is
validator_logs/check_._lint.1.log)validator_logs/ - Extract log failures using the first available strategy:
a. Task tool (Claude Code): with
Task,subagent_type="general-purpose",model="haiku"the Extract Prompt (from the Appendix below) +prompt=. Task calls MUST be synchronous — NEVER use"\n\nLog directory: <inferred path>". 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.run_in_background: true
当状态为Failed时需执行此步骤:
- 从控制台输出中的文件路径推断日志目录(例如,如果输出引用 ,则日志目录为
validator_logs/check_._lint.1.log)validator_logs/ - 使用以下优先策略提取日志失败信息:
a. 任务工具(Claude Code):调用 ,设置
Task、subagent_type="general-purpose",model="haiku"为下方附录中的提取提示语 +prompt。任务调用必须同步——请勿设置"\n\nLog directory: <推断路径>"。 b. 子代理委托:如果您的环境支持将工作委托给子代理但不支持任务工具,请将提取提示语说明和日志目录委托给子代理处理。 c. 内联回退:如果没有子代理功能,请自行按照提取提示语说明读取日志文件并生成简洁的失败摘要。run_in_background: true
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): with
Task,subagent_type="general-purpose",model="haiku"the Update Prompt (from the Appendix below) + log directory + decisions list. Task calls MUST be synchronous — NEVER useprompt=. 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.run_in_background: true
对于已处理的REVIEW违规:
- 使用以下优先策略更新评审决策(与步骤3相同):
a. 任务工具(Claude Code):调用 ,设置
Task、subagent_type="general-purpose",model="haiku"为下方附录中的更新提示语 + 日志目录 + 决策列表。任务调用必须同步——请勿设置prompt。 b. 子代理委托:将更新提示语说明、日志目录和决策委托给子代理。 c. 内联回退:自行按照更新提示语说明更新评审JSON文件。run_in_background: true
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 flags) again with and . The tool detects existing logs and automatically switches to verification mode. Go back to Step 2 to check the status line and repeat.
--enable-reviewBashtimeout: 300000绝不要跳过此步骤——如果运行失败,必须修复后重新运行。再次使用 运行步骤1中的相同命令(包括所有 参数),设置 。工具会检测现有日志并自动切换到验证模式。返回步骤2检查状态行并重复流程。
Bash--enable-reviewtimeout: 300000Step 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
流程
- List files directly under the log directory
- Find the highest-numbered file (e.g.,
console.N.log>console.3.log)console.2.log - Read it and find all lines containing
[FAIL] - For each line, extract the referenced file path
[FAIL] - Read each referenced file:
- files (check gates): Extract error output. Look for
.logsections and--- Fix Instructions ---sections. Include their full content.--- Fix Skill: <name> --- - files (review gates): Parse the JSON. Find violations where
.jsonisstatus. For each, extract:"new",file,line,issue,priority.fix
- 列出日志目录下的直接文件
- 找到编号最高的 文件(例如
console.N.log>console.3.log)console.2.log - 读取该文件并找到所有包含 的行
[FAIL] - 对于每个 行,提取引用的文件路径
[FAIL] - 读取每个引用的文件:
- 文件(检查关卡):提取错误输出。查找
.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.logcheck_src_lint.2.logreview_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.jsoncheck_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.logcheck_src_lint.2.logreview_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.jsoncheck_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 blockNote: The violation was omitted because its status is , not .
src/utils.ts:10"fixed""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 entries
[FAIL] - Keep the output compact — one entry per check failure, one entry per review violation (3 lines each)
- For review violations, only include those with — skip
status: "new"and"fixed""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:
- A log directory path
- A list of decisions, each with: ,
file,line,issue_prefix("fixed" or "skipped"), andstatus(brief description)result
您会收到:
- 日志目录路径
- 决策列表,每个决策包含:、
file、line、issue_prefix("fixed" 或 "skipped")和status(简要描述)result
Process
流程
For each decision:
- Find the matching file in the log directory by scanning for a violation that matches on
.json(exact) ANDfile(exact) AND wherelinestarts with the providedissue. If multiple violations match, use the first unprocessed one (status stillissue_prefix)"new" - Read the JSON file
- Find the matching violation in the array
violations - Set to the provided status value
"status" - Set to the provided result string
"result" - Write the updated JSON back to the same file path
对于每个决策:
- 在日志目录中查找匹配的 文件,方法是扫描与
.json(完全匹配)、file(完全匹配)且line以提供的issue开头的违规项。如果有多个匹配项,使用第一个未处理的项(状态仍为issue_prefix)"new" - 读取JSON文件
- 在 数组中找到匹配的违规项
violations - 将 设置为提供的状态值
"status" - 将 设置为提供的结果字符串
"result" - 将更新后的JSON写回原文件路径
Rules
规则
- Do NOT modify any fields other than and
statusresult - 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: , line: 45, issue_prefix:
src/main.ts, status:Missing error handling, result:fixedAdded try-catch around database call - file: , line: 10, issue_prefix:
src/utils.ts, status:Function exceeds, result:skippedStylistic preference, function is readable as-is
The log directory contains :
review_src_code-quality_claude@1.2.jsonjson
{
"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: , line: 45, issue_prefix:
src/main.ts, status:Missing error handling, result:fixedAdded try-catch around database call - file: , line: 10, issue_prefix:
src/utils.ts, status:Function exceeds, result:skippedStylistic preference, function is readable as-is
日志目录包含 :
review_src_code-quality_claude@1.2.jsonjson
{
"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, becomes:
review_src_code-quality_claude@1.2.jsonjson
{
"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.jsonjson
{
"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 skippedtext
Updated 2 violations:
- src/main.ts:45 — set to fixed
- src/utils.ts:10 — set to skippedOutput
输出
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)