ワンクリックで
diff-eval-claude
使用 Claude Code agent team 批量评测指定目录中的实验。并行评测,报告名称包含 "claude"。Trigger on "/diff-eval-claude", "claude eval", "用 claude 评测".
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
使用 Claude Code agent team 批量评测指定目录中的实验。并行评测,报告名称包含 "claude"。Trigger on "/diff-eval-claude", "claude eval", "用 claude 评测".
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Audit an experiment run (agent+prompt+task) for suspicious output that may have come from the actual GT patch or upstream PR rather than independent implementation. Run whenever a new agent run is declared PASS, or whenever an eval report looks suspiciously high-coverage.
对指定 task×type 组合,并行运行 4 个 agent(Claude/Cursor/Codex/OpenCode)的标准跑法。包含 base_repo 清洁验证、eval 保护、CONSTRAINT_DIRECTIVE 注入、实验目录创建、各 agent 启动命令。
使用 Codex CLI (默认 OpenAI 订阅,无需额外配置) 批量评测实验目录。顺序或并行运行,报告名称包含 "codex"。Trigger on "/diff-eval-codex", "codex eval", "用 codex 评测".
Evaluate agent-generated code against ground truth diff and handwritten file list. Prefer reading GT inputs directly from base_repo via experiment metadata. Trigger on "/diff-eval-local", "evaluate diff", "eval experiment".
使用 OpenCode CLI 以指定模型批量评测实验目录。报告名称包含 "opencode-<model>"。Trigger on "/diff-eval-opencode", "opencode eval", "用 opencode 评测".
Launch a multi-agent team to execute benchmark tasks in parallel. Team lead handles all setup (repo copy, hooks, metadata); agents directly code in their sessions without spawning subprocess claude invocations.
| name | diff-eval-claude |
| description | 使用 Claude Code agent team 批量评测指定目录中的实验。并行评测,报告名称包含 "claude"。Trigger on "/diff-eval-claude", "claude eval", "用 claude 评测". |
| argument-hint | <eval-dir-or-list> |
使用 Claude Code agent team 对多个实验目录并行运行 diff-eval-local 评测。
| Parameter | Required | Description |
|---|---|---|
eval-dir-or-list | Yes | 包含实验目录的父目录,或逗号分隔的实验目录列表 |
# 评测某目录下所有实验
/diff-eval-claude experiment/eval-batch-T11-T15
# 评测指定的几个目录
/diff-eval-claude T11-claude-opus-max-short-20260415,T11-claude-opus-max-long-20260415
# 相对于 experiment/ 的路径
/diff-eval-claude experiment/T11-claude-opus-max-short-20260415
每个实验目录内生成:eval_report-claude.md(不覆盖默认的 eval_report.md)
# 如果参数是目录,扫描其中含 run_metadata.json 的子目录
# 如果参数是逗号分隔列表,直接使用各路径
experiment_dirs = []
arg = "<eval-dir-or-list>"
if "," in arg:
experiment_dirs = [p.strip() for p in arg.split(",")]
else:
import os, json
for entry in sorted(os.listdir(arg)):
path = os.path.join(arg, entry)
if os.path.isdir(path) and os.path.exists(os.path.join(path, "run_metadata.json")):
experiment_dirs.append(path)
用 bash 确认:
EVAL_INPUT="<eval-dir-or-list>"
if [[ -d "$EVAL_INPUT" && "$EVAL_INPUT" != *","* ]]; then
DIRS=$(find "$EVAL_INPUT" -maxdepth 1 -name "run_metadata.json" | xargs -I{} dirname {} | sort)
else
IFS=',' read -ra DIRS <<< "$EVAL_INPUT"
fi
echo "Found $(echo "$DIRS" | wc -l) experiment dirs"
echo "$DIRS"
Team 名称从输入路径派生,格式 eval-claude-<slug>-<DATE>:
import re, datetime
slug = re.sub(r'[^a-zA-Z0-9]', '-', os.path.basename(arg.rstrip('/')))[:30]
date = datetime.datetime.now().strftime("%Y%m%d")
team_name = f"eval-claude-{slug}-{date}"
# TeamCreate(team_name=team_name, description="Claude Code 批量评测")
若输入为列表(无公共父目录),slug 取第一个目录名前缀。
每个实验目录创建一个 TaskCreate:
for exp_dir in experiment_dirs:
meta = json.load(open(f"{exp_dir}/run_metadata.json"))
task_id = meta.get("task_id", "")
prompt_type = meta.get("prompt_type", "")
# 解析 GT 路径
repo_root = "<project-root>" # /Users/zihanwu/Public/codes/huawei-eval
gt_diff = f"{repo_root}/base_repo/{task_id}/eval/gt_diff.patch"
hw_files = f"{repo_root}/base_repo/{task_id}/eval/handwritten_files.txt"
prompt_file = f"{repo_root}/base_repo/{task_id}/prompts/{task_id}-{prompt_type}.md"
TaskCreate(
subject=f"评测 {os.path.basename(exp_dir)}",
description=f"""experiment_dir: {exp_dir}
gt_diff: {gt_diff}
hw_files: {hw_files}
prompt_file: {prompt_file}
report_name: eval_report-claude.md"""
)
所有 Task 创建完毕后,一次发出所有 Agent 调用(单条消息多 tool use):
for exp_dir in experiment_dirs:
name = f"eval-{os.path.basename(exp_dir)[:20]}"
Agent(
subagent_type="general-purpose",
name=name,
team_name=team_name,
model="opus",
mode="bypassPermissions",
run_in_background=True,
prompt=EVAL_AGENT_PROMPT # 见下方模板
)
你是评测 agent,负责对一个实验目录运行 diff-eval-local 评测。
## 认领任务
TaskList → 找 status=pending 任务 → TaskUpdate(owner=自己名字, status=in_progress)
## 从 task description 读取路径
- experiment_dir: 实验目录路径
- gt_diff: GT diff 文件路径
- hw_files: handwritten_files.txt 路径
- prompt_file: prompt 文件路径(可选)
- report_name: eval_report-claude.md
## 评测流程(严格按照 diff-eval-local 规范)
### Step 1: 读取 HW 文件列表
```bash
cat "$HW_FILES"
HW_COUNT=$(wc -l < "$HW_FILES" | tr -d ' ')
# Tracked changes
git -C "$REPO" diff HEAD --stat
git -C "$REPO" diff HEAD --name-only
# Untracked files
git -C "$REPO" ls-files --others --exclude-standard | grep -v '^\.'
# Full diff (tracked + untracked)
git -C "$REPO" diff HEAD
# 再对 untracked files 生成 unified diff
grep -c '^diff --git' "$GT_DIFF"
grep '^diff --git' "$GT_DIFF" | sed 's|^diff --git a/.* b/||'
cat "$GT_DIFF"
EVAL_DIR=$(mktemp -d)
LC_ALL=C sort "$HW_FILES" > "$EVAL_DIR/hw.txt"
{ git -C "$REPO" diff HEAD --name-only; git -C "$REPO" ls-files --others --exclude-standard | grep -v '^\.' ; } | LC_ALL=C sort -u > "$EVAL_DIR/gen.txt"
LC_ALL=C comm -12 "$EVAL_DIR/hw.txt" "$EVAL_DIR/gen.txt" > "$EVAL_DIR/covered.txt"
LC_ALL=C comm -23 "$EVAL_DIR/hw.txt" "$EVAL_DIR/gen.txt" > "$EVAL_DIR/missing.txt"
COVERED=$(wc -l < "$EVAL_DIR/covered.txt" | tr -d ' ')
TOTAL=$(wc -l < "$EVAL_DIR/hw.txt" | tr -d ' ')
参照 diff-eval-local 的 Step 3。
参照 diff-eval-local 的 scoring_rubric:
Verdict: PASS = A≥4 AND B≥4 AND C≥3; FAIL = A≤1 OR destructive; PARTIAL = otherwise
保存到 <experiment_dir>/eval_report-claude.md,格式:
## Evaluation Report
**Evaluator**: Claude Code (claude-opus-max)
### Summary
[1-3 sentences]
### Verdict: [PASS / PARTIAL / FAIL]
### Scores
- **A. Functional Correctness**: [X]/5 — [justification]
- **B. Completeness**: [X]/5 — [justification, HW scope]
- **C. Behavioral Equivalence**: [X]/5 — [justification]
### Deterministic Coverage
#### HW File Coverage: [X]/[Y] = [Z]%
#### Function Coverage: [X]/[Y] = [Z]%
### Requirements Checklist
### Analysis
### Confidence: [0.0-1.0]
## Phase 5: 监控
等待 agent 完成通知,汇总:
```bash
for dir in $DIRS; do
report="$dir/eval_report-claude.md"
if [[ -f "$report" ]]; then
verdict=$(grep "^### Verdict:" "$report" | head -1)
echo "$dir: $verdict"
else
echo "$dir: (pending)"
fi
done
eval-claude-<slug>-<DATE><exp_dir>/eval_report-claude.mdrun_metadata.json 读取 task_id,自动定位 base_repo/<task_id>/eval/