/agent-eval-harness:eval-optimizefrom agent-eval-harness
Automated skill improvement loop: runs eval, identifies judge failures, reads traces, edits SKILL.md, re-runs, and checks for regressions. Supports statistically validated optimization via --engine cap-evolve.
Ships in agent-eval-harness. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are an automated skill improver. You run evaluations, identify what's failing and why, edit the skill's SKILL.md to fix the issues, re-run to verify, and check for regressions. You iterate until judges pass or you hit the max iteration limit.
The key difference from /eval-review: you act autonomously. You read judge rationale and transcripts, form hypotheses about what's wrong, make targeted edits, and verify — without asking the user for feedback on each case. The user sets the goal ("make this pass") and you work toward it.
Target artifact. The steps below assume a skill under test (execution.skill) whose SKILL.md you edit. For prompt-mode evals (execution.prompt, from /eval-analyze --prompt) there is no skill — the artifact under test is the documentation or analysis prompt the eval exercises (e.g. CLAUDE.md, ai-docs/, or the prompt template itself). Apply the same read → hypothesize → edit → re-run loop to that artifact instead of a SKILL.md; everywhere below that says "SKILL.md", read "the artifact under test".
--engine cap-evolve dispatch. If --engine cap-evolve (alias:
--engine capevolve) is among the arguments, this is the automated,
statistically-gated cap-evolve path, not the interactive loop below — skip
every other step in this file. Unlike that loop, it splits cases into
train/val/test, accepts a candidate only on a significance gate over val (a
small change comes back "indecisive", never banked as progress), and scores
test exactly once. Prefer it whenever that stronger guarantee is worth the
setup. Any other --engine <value> is an error — never fall through to the
interactive loop silently.
Parse only --config, --max-usd, --max-iterations, --num-trials,
--workers, --dashboard, --dashboard-port, --dry-run, --pilot-case-ids,
--runner-budget-usd, --runner, --env, --image, --reintake, --optimizer,
--optimizer-model, --skills-dir, --seed, --split-ratios, --run,
--setup, --status, --stop, and --apply from the arguments (ignore
--model/--run-id/--target-judge).
Scope is local or Harbor substrate only (EvalHub is refused). Do not proceed
to Step 1 for a --engine cap-evolve invocation. Every mode runs
python3 ${CLAUDE_SKILL_DIR}/scripts/capevolve.py <flags> from the
benchmark's root.
Setup is self-healing — never ask the user for a cap-evolve path; the command
fetches cap-evolve's skills tree at the pinned commit on first use. If any
mode returns {"error": "setup_required", ...} (exit 2), tell the user in
one line, invoke /eval-setup --optimize, then re-run. Pass --skills-dir
only if the user names their own checkout.
--dry-run: run it. It performs cap-evolve's intake phase itself and
never edits the benchmark: missing optimize:/reward: blocks are
proposed into .capevolve/eval.optimize.yaml (an extends: overlay). If
the result is {"blocked": [...]} (exit 1), quote each entry's input,
why, how and resolve it with the user — never invent a dataset, skill,
or scorer — then re-run. With no optimize:/reward: configured
(scaffold.defaulted non-empty), state intake's defaults
(scaffold.candidate_components, judges weighted equally with no gate)
rather than asking to change them; edit the overlay only on request
(an edited overlay is reused as-is; --reintake regenerates it from
scratch), then re-run. Narrate the result instead of printing raw JSON:
what will be optimized — scaffold.candidate_sources are the skills the
optimizer may edit (trimming optimize.candidate in the overlay narrows
it) — and the models every rollout uses (scaffold.models). Quote every
scaffold.warnings entry and resolve it first — an unservable model
errors every rollout and spends the budget on nothing. State the
train/val/test split sizes, the gate mode and k_se,
that small real gains come back "indecisive" at small val sizes, and the
cost estimate as a range (blended with observed_cost_per_rollout when
present). State scaffold.workers: at 1 the campaign is strictly serial
(wall-clock ≈ |val| × num_trials × (iterations + 1) rollout times —
--max-usd caps spend, not time); --workers N runs N-wide instead. State
scaffold.dashboard_url (the live view the campaign will open at launch,
on by default) and, if scaffold.dashboard_available is false, that it
will run with no live view until capevolve-dashboard is installed.--dry-run/--status/--stop/--apply, --max-usd
given): confirm the spend with AskUserQuestion first. It launches
detached and returns immediately — give the user the printed
run_dir/pid/log_file; --stop ends it (signals the whole process
group — never tell the user to kill <pid> themselves). A live dashboard
starts automatically with the campaign (--dashboard auto, the default) —
give the user scaffold.dashboard_url from the prior --dry-run (or this
launch's own output) to open it. If scaffold.dashboard_available was
false, say plainly that the campaign runs fine but with no live view
until capevolve-dashboard is installed (/eval-setup --optimize); pass
--dashboard off only if the user explicitly doesn't want it. Point them
at --status/--apply once it finishes.--stop: run it, report status plainly (stopped / already stopped /
could not be stopped).--status: interpret it in prose, not raw JSON: report
status plainly (not launched / running / finished / stopped — if
stopped, say to check log_file). If warnings is non-empty, quote it
first and split by kind: a measurement warning (n_scored: 0, missing
measurements) is a failure — find the error in log_file or an opt-*
run dir (<runs>/.optimize/<eval>/), not --apply; the
val-size warning (fewer than 2 validation cases) is not a failure — carry
it as a caveat, and --apply is still the right next step. Otherwise report accepted/rejected/
indecisive counts, spend vs. budget, and an honest caveat on the error
bars. If final is present, git diff --no-index the seed capability
(.capevolve/project/seed_capability/) against
<run_dir>/candidates/<best_id>/ and describe the change, grounded in
the diff.--apply: run it, report the branch and changed files, then surface
the response's caveat and suggested_next_step verbatim — the
optimistic-bias warning and its suggested confirmation run.| Argument | Required | Default | Description |
|---|---|---|---|
--engine <cap-evolve> | no | the interactive loop below | Pass --engine cap-evolve (alias: capevolve) for statistically validated optimization instead (see Step 0). Any other value is an error, never a silent fall-through |
--config <path> | no | auto-discover | Path to eval config |
--model <model> | no | models.skill from eval.yaml | Model to use for eval runs (overrides config default) |
--max-iterations <N> | no | 3 | Stop after N improvement cycles |
--run-id <id> | no | auto-generated | Base run ID (iterations append -iter-N) |
--target-judge <name> | no | all judges | Focus on a specific failing judge |
If --config was explicitly provided, use that path directly. Otherwise, auto-discover:
python3 ${CLAUDE_SKILL_DIR}/../../scripts/discover.py
<config>/eval-analyze firstGet run directories (the <eval-name>/<id> paths below) from discover.py --config <config> --run-id <id>.
mkdir -p tmp
python3 ${CLAUDE_SKILL_DIR}/scripts/agent_eval/state.py init tmp/optimize-config.yaml \
model=<model> max_iterations=<N> run_id=<id> target_judge=<judge>
If no recent eval results exist, run the eval suite first:
Use the Skill tool to invoke /eval-run --run-id <id>-iter-0 --config <config> [--model <model>]
Pass --model only if the user provided one — otherwise let /eval-run fall back to models.skill from eval.yaml. Pass the same model on every iteration for comparable results.
If results already exist (the user just ran /eval-run), skip this and use the existing run.
Read the results:
python3 ${CLAUDE_SKILL_DIR}/scripts/agent_eval/state.py read $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>-iter-0/summary.yaml
If all judges pass, report success and exit — nothing to improve.
From summary.yaml, identify:
Also check for human feedback — these catch things judges miss:
test -f $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>/review.yaml && echo "REVIEW_EXISTS" || echo "NO_REVIEW"
If review.yaml exists, read its feedback section (human feedback from /eval-review) and mlflow_feedback section (annotations pulled from MLflow UI). Human feedback is higher-signal than judge rationale — prioritize issues the user flagged.
If --target-judge was specified, focus only on that judge's failures.
Build a failure map, noting each judge's type (judge_type in results: builtin, check, llm, code) — the type determines what you can do about it:
agent_eval/judges/. Don't edit their code — suggest adjusting arguments: in eval.yaml (e.g., raising max_cost_usd for cost_budget)judge_name (type) → [case_id, case_id, ...] → rationale for each
human_review → [case_id, ...] → user comment for each
For each failure pattern, investigate why the skill produces bad output:
Read the skill's SKILL.md — locate it via eval.yaml's skill field:
python3 ${CLAUDE_SKILL_DIR}/../eval-analyze/scripts/find_skills.py --name <skill>
Read transcripts (if available) — transcripts can be very large, so delegate to an Agent. Check run_result.json for execution_mode: in case mode, each case has its own transcript at $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>/cases/<case>/stdout.log; in batch mode, there's one at $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>/stdout.log. Focus on the failing cases.
Include the specific judge failure in the prompt so the agent traces the causal chain rather than producing a generic summary:
Agent tool, subagent_type="Explore": "Read the transcript at <path>.
The judge '<judge_name>' (<judge_type>) failed this case with rationale:
'<rationale from summary.yaml>'
Find evidence explaining WHY this failure happened:
- Where in the transcript did the skill handle (or skip) the relevant task?
- What instructions from SKILL.md led to this behavior?
- Did the skill attempt the right thing but produce wrong output, or skip it entirely?
- If it tried multiple approaches, which one stuck and why?"
In batch mode, failures across cases may interact — ask the agent to check whether earlier cases' processing affected later ones.
Read failing case outputs — use an Explore agent to examine the actual output files. Include what the judge expected so the comparison is targeted:
Agent tool, subagent_type="Explore": "Read the outputs in $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>/cases/<failing_case>/.
The judge '<judge_name>' failed with: '<rationale>'.
Compare the actual output against this expectation — what specifically is missing or wrong?"
Form hypotheses — connect the judge rationale + transcript evidence + output examination to specific parts of the SKILL.md. Be specific: "The judge says the output is missing acceptance criteria. The transcript shows the skill skipped Step 4 of the pipeline. Step 4 in SKILL.md says 'optionally add acceptance criteria' — the word 'optionally' is the problem."
Apply targeted fixes to the SKILL.md. For each edit:
Show each edit before applying. If the change is risky (could affect passing cases), note it.
Execution mode context: check execution.mode in eval.yaml. In case mode, each case runs in its own isolated workspace with all case files copied in — the skill receives case-specific arguments resolved from input.yaml. In batch mode, all cases are in one workspace via batch.yaml. Your edits must work for the configured mode.
Re-run eval with the baseline flag. If only a subset of cases failed, target them with --cases for faster verification. Once targeted cases pass, do a final full run (all cases) to check for regressions.
Consider --no-llm-judges when you only need to verify structural fixes — it skips LLM API calls and runs only deterministic judges (check, Python builtins), which is faster and cheaper.
# Targeted re-run (failing cases only)
Use the Skill tool to invoke /eval-run --run-id <id>-iter-<N> --cases <failing-case-id> [<failing-case-id> ...] --baseline <id>-iter-<N-1> --config <config> [--model <model>]
# Full re-run (all cases) — use for final verification
Use the Skill tool to invoke /eval-run --run-id <id>-iter-<N> --baseline <id>-iter-<N-1> --config <config> [--model <model>]
Read the new results:
python3 ${CLAUDE_SKILL_DIR}/scripts/agent_eval/state.py read $AGENT_EVAL_RUNS_DIR/<eval-name>/<id>-iter-<N>/summary.yaml
Check:
If the fix caused regressions (previously passing cases now fail):
/eval-review --run-id <id> for human input on the tricky cases.If failures remain and iterations < max:
If all judges pass:
If max iterations reached with failures remaining:
/eval-review --run-id <final-id> for human assessment of the remaining issues/eval-dataset to add cases if failures suggest missing test coverage (augments the existing dataset)In all cases (include --config <config> if a non-default config was used):
/eval-mlflow --run-id <final-id> to log the optimization results to MLflow for tracking.agent_eval/judges/) are versioned and shared — never edit their code. If a builtin judge's behavior needs adjustment, suggest changing its arguments: in eval.yaml instead. For inline check or LLM prompt judges, suggest improvements to the user but don't edit eval.yaml yourself.$ARGUMENTS
scripts/capevolve.py (opens in a new tab)scripts/agent_eval/__init__.py (opens in a new tab)scripts/agent_eval/_bootstrap.py (opens in a new tab)scripts/agent_eval/actions_mask.py (opens in a new tab)scripts/agent_eval/agent/__init__.py (opens in a new tab)scripts/agent_eval/agent/base.py (opens in a new tab)scripts/agent_eval/agent/claude_code.py (opens in a new tab)scripts/agent_eval/agent/cli_runner.py (opens in a new tab)scripts/agent_eval/agent/codex.py (opens in a new tab)scripts/agent_eval/agent/cursor_agent.py (opens in a new tab)scripts/agent_eval/agent/fullsend.py (opens in a new tab)scripts/agent_eval/agent/responses_api.py (opens in a new tab)scripts/agent_eval/agent/stream_capture.py (opens in a new tab)scripts/agent_eval/anova/__init__.py (opens in a new tab)scripts/agent_eval/anova/archive.py (opens in a new tab)scripts/agent_eval/anova/composite.py (opens in a new tab)scripts/agent_eval/anova/corrections.py (opens in a new tab)scripts/agent_eval/anova/matrix.py (opens in a new tab)scripts/agent_eval/anova/stats/__init__.py (opens in a new tab)scripts/agent_eval/anova/stats/anova.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fullsend-ai/agent-eval-harness --plugin agent-eval-harness10 skills in this plugin
/eval-analyzeGenerate eval.yaml for the agent eval harness. Two modes - (1) Skill-based - examines SKILL.md, sub-skills, scripts, test cases to verify implementation quality, OR (2) Prompt-based - tests agent capabilities using custom analysis prompts (documentation effectiveness, pattern understanding, API usage, constraint compliance). Produces complete config with execution mode, dataset schema, outputs, judges, models, thresholds. Use when setting up evaluation, testing skills/documentation, adding quality checks, or benchmarking. Auto-triggered by /eval-run when eval.yaml missing. Triggered by "how do I know if my skill/docs work?"/eval-anovaRun Design-of-Experiments (DoE) evaluations with ANOVA over a matrix of agent configurations — comparing models, thinking-effort levels, prompts, or other factors across shared test cases, with repeated-measures / mixed-effects statistics that account for case difficulty plus a cost/quality Pareto view. Use whenever the user wants to compare models or configurations on an eval, decide which model or config is best, sweep or grid factors, run replications, or check whether a difference in eval scores is statistically significant (F, p, effect size) — even if they don't say "ANOVA" or "DoE". Also use when an eval.yaml has a matrix block or the user asks to fan an eval out across configurations./eval-checkEvaluate the full harness configuration as a system. Scans all skills, commands, CLAUDE.md, and hooks for redundancy, overlap, type misclassification, and structural issues. Produces an informational report with restructuring suggestions. Use when the user wants to check their overall setup health, find redundant skills, detect overlapping triggers, or get restructuring recommendations before diving into individual skill evaluation. Triggers on "check my setup", "harness health", "are my skills redundant", "what should I merge", "setup overview", "configuration check"./eval-compareCompare evaluation results across multiple models or runs. Takes a directory of eval run artifacts (summary.yaml, run_result.json, HTML reports) and produces a tabbed HTML comparison report with model cards, quality/cost tables, per-case breakdowns, and embedded original reports. Use when the user wants to compare models, compare runs, produce a model comparison report, or analyze eval results side-by-side./eval-datasetGenerate evaluation test cases for an eval.yaml. Sources cases per generation.strategy - skill analysis (default), synthetic LLM generation from generation prompts (documentation and agent-capability evals), or MLflow production traces. Bootstraps a starter dataset or augments an existing one to improve coverage. Use when setting up evaluation, when the user needs test cases, when coverage is too thin, or after /eval-analyze when no dataset exists yet. Triggers on "create test cases", "generate test data", "need test inputs", "make a dataset", "add more cases", "improve coverage", "generate documentation eval cases". Also useful when /eval-run reports "no test cases found."/eval-mlflowMLflow integration for evaluation — sync datasets, log run results, push/pull feedback between the harness and MLflow traces. Use when the user wants to log eval results to MLflow, sync test cases to MLflow datasets, connect judge scores to traces, pull MLflow annotations for eval-optimize, or view results in the MLflow UI. Triggers on "log to mlflow", "sync dataset", "push results", "mlflow integration", "view in mlflow".Other plugins' skills for the same job