Loading...
Loading...
Compare original and translation side by side
/c-review:c-reviewTask*c-review:c-review-workerc-review:c-review-dedup-judgec-review:c-review-fp-judgeplugins/c-review/agents/*.md/c-review:c-reviewTask*c-review:c-review-workerc-review:c-review-dedup-judgec-review:c-review-fp-judgeplugins/c-review/agents/*.md| Subagent type | Purpose | Tool set |
|---|---|---|
| Run assigned cluster, write findings | Read, Write, Edit, Grep, Glob, Bash |
| Merge duplicates (runs first) | Read, Write, Edit, Glob |
| FP + severity + final reports (runs second) | Read, Write, Edit, Grep, Glob, Bash |
Task*AgentBashallowed-tools| 子代理类型 | 用途 | 工具集 |
|---|---|---|
| 运行指定的审查集群,撰写检测结果 | Read、Write、Edit、Grep、Glob、Bash |
| 合并重复结果(优先运行) | Read、Write、Edit、Glob |
| 误报处理 + 严重性评估 + 最终报告(其次运行) | Read、Write、Edit、Grep、Glob、Bash |
Task*AgentBashallowed-toolscoordinator: write context.md → build_run_plan.py → TaskCreate × M
→ spawn primer (foreground) → spawn M workers (parallel)
→ classify Phase-7 outcomes + write findings-index.txt
→ dedup-judge → fp-judge → SARIF safety net → return REPORT.mdcontext.mdplan.jsonworker-prompts/findings/findings-index.d/findings-index.txtrun-summary.mddedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarif${C_REVIEW_PLUGIN_ROOT}=${CLAUDE_PLUGIN_ROOT}Bash: ls "${CLAUDE_PLUGIN_ROOT}/prompts/clusters/buffer-write-sinks.md"Bash: find ~/.claude -path '*/plugins/c-review/prompts/clusters/buffer-write-sinks.md' -print -quitfinding_scope_rootcontext_roots.finding_scope_rootcoordinator: write context.md → build_run_plan.py → TaskCreate × M
→ spawn primer (foreground) → spawn M workers (parallel)
→ classify Phase-7 outcomes + write findings-index.txt
→ dedup-judge → fp-judge → SARIF safety net → return REPORT.mdcontext.mdplan.jsonworker-prompts/findings/findings-index.d/findings-index.txtrun-summary.mddedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarif${CLAUDE_PLUGIN_ROOT}${C_REVIEW_PLUGIN_ROOT}=${CLAUDE_PLUGIN_ROOT}ls "${CLAUDE_PLUGIN_ROOT}/prompts/clusters/buffer-write-sinks.md"find ~/.claude -path '*/plugins/c-review/prompts/clusters/buffer-write-sinks.md' -print -quitfinding_scope_rootcontext_roots.finding_scope_rootAgentrun_in_background=truecache_read_input_tokens=0bg=truerun_in_backgroundbuild_run_plan.pyworker-N abort: spawn prompt malformedRead plan.jsonREPORT.mdcompletedrun-summary.mddedup-summary.mdREPORT.mdREPORT.sarifresults: []Bash: ls README*2>/dev/nullGlobfindAgentrun_in_background=truecache_read_input_tokens=0bg=truerun_in_backgroundbuild_run_plan.pyworker-N abort: spawn prompt malformedplan.jsonREPORT.mdcompletedrun-summary.mddedup-summary.mdREPORT.mdREPORT.sarifresults: []Bash: ls README*2>/dev/nullGlobfindthreat_modelworker_modelseverity_filterscope_subpath"."finding_scope_root=scope_subpathcontext_roots/c-review:c-reviewflamenco onlyhigh severity onlyuse haikuAskUserQuestion| Parameter | Values | How to infer from args |
|---|---|---|
| | Words like "remote", "network", "attacker" → |
| | Explicit model name in args. Otherwise ask (no silent default). |
| | "all", "every", "noisy" → |
| repo-relative directory (optional) | Phrases like "X only", "just audit X/", "review subdirectory X" → |
AskUserQuestionthreat_modelworker_modelseverity_filterscope_subpathscope_subpathfinding_scope_root="${scope_subpath:-.}"context_roots="."context_roots="${finding_scope_root}"threat_modelworker_modelseverity_filterscope_subpath"."finding_scope_root=scope_subpathcontext_roots/c-review:c-reviewflamenco onlyhigh severity onlyuse haikuAskUserQuestion| 参数 | 可选值 | 如何从参数推断 |
|---|---|---|
| | 出现“remote”、“network”、“attacker”等词 → |
| | 参数中明确指定模型名称。否则询问用户(无静默默认值)。 |
| | 出现“all”、“every”、“noisy” → |
| 仓库相对目录(可选) | 出现“X only”、“just audit X/”、“review subdirectory X”等表述 → |
threat_modelworker_modelseverity_filterscope_subpathAskUserQuestionscope_subpathfinding_scope_root="${scope_subpath:-.}"context_roots="."context_roots="${finding_scope_root}"is_cppis_posixis_windows${finding_scope_root:-.}GlobGrepBashundefinedis_cppis_posixis_windows${finding_scope_root:-.}GlobGrepBashundefined
`compile_commands.json` is informational (no agent currently uses LSP), but the probe is mandatory so the run summary records whether richer local tooling is available. Probe via `Glob: **/compile_commands.json` under `${context_roots}`. If `Glob` is unavailable, use:
```bash
printf '%s\n' "${context_roots:-.}" | tr ',' '\n' | while IFS= read -r root; do
[ -n "$root" ] && find "$root" -name compile_commands.json -print -quit
done | head -1
`compile_commands.json`仅作参考(当前没有代理使用LSP),但必须进行探测,以便运行摘要记录是否有更丰富的本地工具可用。通过`Glob: **/compile_commands.json`在`${context_roots}`下探测。如果`Glob`不可用,使用:
```bash
printf '%s\
' "${context_roots:-.}" | tr ',' '\
' | while IFS= read -r root; do
[ -n "$root" ] && find "$root" -name compile_commands.json -print -quit
done | head -1find "$root"find "$root"
If absent, suggest CMake `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`/Bear/compiledb to the user but continue.
如果不存在,建议用户使用CMake的`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`参数、Bear或compiledb工具,但继续运行流程。output_dir${output_dir}/findings/output_dir$(pwd)/.c-review-results/$(date -u +%Y%m%dT%H%M%SZ)/mkdir -p "${output_dir}/findings"output_dir${output_dir}/findings/output_dir$(pwd)/.c-review-results/$(date -u +%Y%m%dT%H%M%SZ)/mkdir -p "${output_dir}/findings"${output_dir}${output_dir}/context.mdREADME.{md,rst,txt}MakefileCMakeLists.txtmeson.buildconfigure.acGlobReadReadBash: ls README*2>/dev/nullls src/X/README*no matches foundBashfind . -maxdepth 2 -name 'README*' -o -name 'Makefile' -o -name 'CMakeLists.txt' -o -name 'meson.build'${output_dir}/context.mdthreat_modelseverity_filterscope_subpathfinding_scope_rootcontext_rootsis_cppis_posixis_windowsoutput_dircompile_commandspresentabsentfinding_scope_root${output_dir}${output_dir}/context.mdREADME.{md,rst,txt}MakefileCMakeLists.txtmeson.buildconfigure.acReadGlobBash: ls README*2>/dev/nullls src/X/README*no matches foundBashfind . -maxdepth 2 -name 'README*' -o -name 'Makefile' -o -name 'CMakeLists.txt' -o -name 'meson.build'${output_dir}/context.mdthreat_modelseverity_filterscope_subpathfinding_scope_rootcontext_rootsis_cppis_posixis_windowsoutput_dircompile_commandspresentabsentfinding_scope_rootthreat_model${output_dir}/findings/${output_dir}/plan.json${output_dir}/worker-prompts/*.txtM = worker_countpython3 "${C_REVIEW_PLUGIN_ROOT}/scripts/build_run_plan.py" \
--plugin-root "${C_REVIEW_PLUGIN_ROOT}" --output-dir "${output_dir}" \
--threat-model "${threat_model}" --severity-filter "${severity_filter}" \
--scope-subpath "${finding_scope_root:-.}" --context-roots "${context_roots:-.}" \
--is-cpp "${is_cpp}" --is-posix "${is_posix}" --is-windows "${is_windows}"plan.jsonworker-prompts/worker-N.txt--cache-primer=trueworker-prompts/cache-primer.txtRead plan.jsonthreat_model${output_dir}/findings/${output_dir}/plan.json${output_dir}/worker-prompts/*.txtM = worker_countpython3 "${C_REVIEW_PLUGIN_ROOT}/scripts/build_run_plan.py" \\
--plugin-root "${C_REVIEW_PLUGIN_ROOT}" --output-dir "${output_dir}" \\
--threat-model "${threat_model}" --severity-filter "${severity_filter}" \\
--scope-subpath "${finding_scope_root:-.}" --context-roots "${context_roots:-.}" \\
--is-cpp "${is_cpp}" --is-posix "${is_posix}" --is-windows "${is_windows}"plan.jsonworker-prompts/worker-N.txt--cache-primer=trueworker-prompts/cache-primer.txtplan.json${output_dir}/plan.jsonM = plan.workers.lengthcluster_task_ids[]plan.workerspendingTaskCreatemetadatakind="cluster"worker_ncluster_idspawn_prompt_pathpass_prefixesattempt=1plan.workers[i]cluster_task_ids[]plan.workers${output_dir}/plan.jsonM = plan.workers.lengthcluster_task_ids[]plan.workerspendingTaskCreatemetadatakind="cluster"worker_ncluster_idspawn_prompt_pathpass_prefixesattempt=1plan.workers[i]plan.workerscluster_task_ids[]cluster_task_ids[]${output_dir}/worker-prompts/worker-N.txtAgentcluster_task_ids[]${output_dir}/worker-prompts/worker-N.txtAgentplan.run.cache_primerplan.run.cache_primerplan.run.cache_primer == truebuild_run_plan.py${output_dir}/worker-prompts/cache-primer.txtReadAgentpromptsubagent_type=c-review:c-review-workermodel=${worker_model}description="C review cache primer"run_in_backgroundworker-1.txt<context>Cache primer: trueworker-PRIMER abort: cache primer (no analysis performed)worker-Nsleepplan.run.cache_primer == falseplan.run.cache_primer == truebuild_run_plan.py${output_dir}/worker-prompts/cache-primer.txtAgentpromptsubagent_type=c-review:c-review-workermodel=${worker_model}description="C review cache primer"run_in_backgroundworker-1.txt<context>Cache primer: trueworker-PRIMER abort: cache primer (no analysis performed)worker-Nsleepplan.run.cache_primer == falseSTOP — read this before composing the spawn message.Workers MUST be spawned foreground (nofield, orrun_in_background). "Parallel" here means one assistant message containing Mrun_in_background=falsecalls — that already runs them concurrently. Background spawns are NOT how you parallelize this skill.AgentBackground spawns defeat Phase 6a's primer cache: every worker pays full cache-creation on its first turn (), and the primer's ~15 K tokens are wasted M times over. Two real runs (audit logs available) had exactly this symptom — every worker started withcache_read_input_tokens=0.first_cr=0Before sending the spawn message, audit your draft: everycall must have noAgentkey. If you wroterun_in_background, delete it.run_in_background=true
AgentN ∈ [1..M]Read: ${output_dir}/worker-prompts/worker-N.txtAgentprompt| Parameter | Value |
|---|---|
| |
| |
| |
| the full text of |
| field MUST be omitted, OR set to |
worker-N abort: spawn prompt malformedrun_in_background=trueworker-N.txt注意 — 撰写启动消息前请阅读此内容。工作子代理必须前台启动(不设置字段,或设为run_in_background)。 此处的“并行”指一条助手消息包含M个run_in_background=false调用 — 这已经会并发运行它们。后台启动不是此技能实现并行的方式。Agent后台启动会破坏Phase 6a的预热缓存:每个工作子代理在第一轮都要重新创建缓存(),预热的约15K token会被浪费M次。两次实际运行(审计日志可用)都出现了此症状 — 每个工作子代理都以cache_read_input_tokens=0启动。first_cr=0发送启动消息前,检查草稿:每个调用必须没有Agent键。如果写了run_in_background,请删除它。run_in_background=true
AgentN ∈ [1..M]Read: ${output_dir}/worker-prompts/worker-N.txtAgentprompt| 参数 | 值 |
|---|---|
| |
| |
| |
| |
| 必须省略此字段,或设为 |
worker-N abort: spawn prompt malformedrun_in_background=trueworker-N.txtAgent${output_dir}/findings-index.txtAgent| # | Match (in return text) | Outcome | Action |
|---|---|---|---|
| 1 | | success | |
| 2 | | non-retryable orchestrator bug | Stop the run, surface the abort + spawn-prompt path. Re-running the same prompt repeats the failure — pre-work-budget exhaustion always means the worker couldn't pass its self-check, which a retry won't fix. |
| 3 | other | retryable | Mark |
| 4 | | retryable | Same as #3 (transient worker crash). |
pendingattempt < 2Agent${output_dir}/findings-index.txtAgent| # | 匹配内容(返回文本中) | 结果 | 操作 |
|---|---|---|---|
| 1 | | 成功 | |
| 2 | | 不可重试的编排器错误 | 停止运行,显示终止信息和启动提示路径。重新运行相同的提示会重复失败 — 预工作预算耗尽通常意味着工作子代理无法通过自检,重试无法解决问题。 |
| 3 | 其他 | 可重试 | 标记为 |
| 4 | | 可重试 | 与#3处理方式相同(工作子代理临时崩溃)。 |
pendingattempt < 2complete:${output_dir}/findings/${prefix}-*.mdpass_prefixplan.json${output_dir}/findings-index.d/undefinedcomplete:plan.jsonpass_prefix${output_dir}/findings/${prefix}-*.md${output_dir}/findings-index.d/undefinedfindworker-*.txtfindworker-*.txt2>/dev/null2>/dev/nullawk 1catawk 1catls -1 | sortls -1 | sort
`sort -u` collapses duplicates from Phase-7 retries. Empty file is the unambiguous "zero findings" signal. Cross-check the line count against the sum of `wrote N` worker claims; log mismatches but don't abort.
After task updates and index creation, run `TaskList` and write `${output_dir}/run-summary.md` with:
- resolved parameters (`threat_model`, `severity_filter`, `finding_scope_root`, `context_roots`, language/platform flags, compile-commands status)
- worker outcome table (`worker_n`, `cluster_id`, claimed finding count, shard line count, task status, retry/abort state)
- `findings-index.txt` line count and any mismatch against worker claims
- judge status once Phase 8 finishes, or the reason a judge was skipped/failed
If any Phase-5 cluster task is not `completed`, include it prominently in `run-summary.md` and the final response. Do not hide a partial run behind a successful report.
**Always run Phase 8 even on zero findings** — both judges short-circuit on an empty index: dedup-judge writes a minimal no-op `dedup-summary.md`, and fp-judge writes empty `REPORT.md`/`REPORT.sarif` so SARIF consumers get a stable artifact set.
`sort -u`会合并Phase-7重试产生的重复项。空文件明确表示“未发现任何漏洞”。将行数与工作子代理声称的总数交叉核对;记录不匹配情况但不终止运行。
完成任务更新和索引创建后,运行`TaskList`并写入`${output_dir}/run-summary.md`,包含:
- 已解析的参数(`threat_model`、`severity_filter`、`finding_scope_root`、`context_roots`、语言/平台标志、compile-commands状态)
- 工作子代理结果表(`worker_n`、`cluster_id`、声称的检测结果数量、分片行数、任务状态、重试/终止状态)
- `findings-index.txt`的行数以及与工作子代理声称数量的任何不匹配情况
- Phase 8完成后的评审子代理状态,或评审子代理被跳过/失败的原因
如果任何Phase-5集群任务未标记为`completed`,需在`run-summary.md`和最终响应中突出显示。切勿在成功报告背后隐藏部分运行结果。
**即使未发现任何漏洞,也必须运行Phase 8** — 两个评审子代理在索引为空时会短路:去重评审子代理会生成最小化的无操作`dedup-summary.md`,误报评审子代理会生成空的`REPORT.md`/`REPORT.sarif`,以便SARIF消费者获得稳定的工件集。findings-index.txtdedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarifagents/c-review-{dedup,fp}-judge.mdprompts/internal/judges/Agent(subagent_type="c-review:c-review-dedup-judge", description="Dedup judge", prompt=f"output_dir: {output_dir}")Agent(subagent_type="c-review:c-review-fp-judge", description="FP + severity judge", prompt=f"output_dir: {output_dir}\nsarif_generator_path: {sarif_generator_path}")sarif_generator_path${C_REVIEW_PLUGIN_ROOT}/scripts/generate_sarif.py… complete:… abort:ls -l ${output_dir}/findings-index.txtcomplete:SendMessage(to=<agentId>, …)findings-index.txtfindings-index.txtdedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarifagents/c-review-{dedup,fp}-judge.mdprompts/internal/judges/Agent(subagent_type="c-review:c-review-dedup-judge", description="Dedup judge", prompt=f"output_dir: {output_dir}")Agent(subagent_type="c-review:c-review-fp-judge", description="FP + severity judge", prompt=f"output_dir: {output_dir}\ sarif_generator_path: {sarif_generator_path}")sarif_generator_path${C_REVIEW_PLUGIN_ROOT}/scripts/generate_sarif.py… complete:… abort:ls -l ${output_dir}/findings-index.txtcomplete:SendMessage(to=<agentId>, …)findings-index.txt${output_dir}/REPORT.sariftest -d "${output_dir}/findings" && python3 "${C_REVIEW_PLUGIN_ROOT}/scripts/generate_sarif.py" "${output_dir}"findings/results: []fp_verdictLIKELY_TPREPORT.sarif${output_dir}/findings/${output_dir}/run-summary.md${output_dir}/REPORT.sariftest -d "${output_dir}/findings" && python3 "${C_REVIEW_PLUGIN_ROOT}/scripts/generate_sarif.py" "${output_dir}"findings/results: []fp_verdictLIKELY_TPREPORT.sarif${output_dir}/findings/${output_dir}/run-summary.mdREPORT.mdTaskListlsReadRead ${output_dir}/REPORT.mdfindings/findings-index.txtrun-summary.mddedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarifREPORT.mdTaskListlsRead${output_dir}/REPORT.mdfindings/findings-index.txtrun-summary.mddedup-summary.mdfp-summary.mdREPORT.mdREPORT.sarifagents/c-review-worker.mdidbug_classtitlelocationfunctionconfidenceworkermerged_intoalso_known_aslocationsfp_verdictfp_rationaleTRUE_POSITIVELIKELY_TPseverityattack_vectorexploitabilityseverity_rationaleagents/c-review-worker.mdidbug_classtitlelocationfunctionconfidenceworkermerged_intoalso_known_aslocationsfp_verdictfp_rationaleTRUE_POSITIVELIKELY_TPseverityattack_vectorexploitabilityseverity_rationaleprompts/clusters/manifest.jsonbuffer-write-sinksprompts/clusters/manifest.jsonbuffer-write-sinkscompletedTaskList${output_dir}/run-summary.mdmerged_intofp_verdictfp_rationaleTRUE_POSITIVELIKELY_TPseverityattack_vectorexploitabilityseverity_rationaleREPORT.mdseverity_filterREPORT.sarifcompletedTaskList${output_dir}/run-summary.mdmerged_intofp_verdictfp_rationaleTRUE_POSITIVELIKELY_TPseverityattack_vectorexploitabilityseverity_rationaleREPORT.mdseverity_filterREPORT.sarif