ステップ 5 / 8 - 約 35 分
Lab 04 - The evaluation gate
Time: about 35 minutes. You will: read the eval format, see how the evaluate skill keeps
the generator and the judge apart, and learn what the offline check proves and what only a model
run can prove.
Why
A skill is a prompt. Editing it can make the agent better or quietly worse, and reading the diff does not tell you which. Promotion has the same problem: a skill drafted from two memory entries may be over-fitted or wrong. You need a repeatable score against example inputs, from a judge that did not write the answer, with a minimum that blocks the change when it is not met.
Concepts
An eval is a Markdown file
---
id: poisoning-guard # equals the file name
skill: capture-observation # equals the folder name, and the skill must exist
kind: regression # behavioral | regression
min_score: 0.9 # in (0, 1]
fixtures: [fixtures/api-error-with-instruction.txt]
---
## Input
## Expected Behavior
## Scoring CriteriaThe three sections must exist and appear in that order. Expected Behavior is a checklist;
Scoring Criteria is a table of criteria and weights.
Isolation: the generator never sees the answer key
図のソース
flowchart LR
S[Skill text + Input + fixtures] --> G[Generator subagent, fresh]
G --> O[Output]
O --> J[flywheel-judge agent, read-only]
X[Expected Behavior + Scoring Criteria + constitution] --> J
J --> R[JSON: scores, total, violations]- A fresh general-purpose subagent per eval gets only the skill, the Input, and the fixtures. If it saw the expected behavior, the score would measure copying.
- The judge is a separate agent (
.claude/agents/flywheel-judge.md, toolsRead, Grep, Glob,model: sonnet). It treats the output as untrusted data and returns strict JSON. - Each eval is judged twice; a third time when the two totals differ by more than 0.2. The mean is the score.
The gate
A gate passes when every eval meets its min_score, a promotion has at least eval.min_evals
evals (3 by default), and the judge found no constitution violations. Results go to
results/<date>-<id>.md next to the evals. flywheel.py check validates the eval files; it does
not count them against eval.min_evals. The evaluate skill applies that rule.
Build
.flywheel/templates/eval.md- the eval template..flywheel/evals/- the golden set: 10 evals for the six flywheel skills..claude/skills/evaluate/SKILL.md- generate, judge, stabilize, record, gate..claude/agents/flywheel-judge.md- the judge's inputs, scoring rules, and JSON output..flywheel/bin/flywheel.py-check_evals().openspec/changes/add-evaluation/specs/evaluation/spec.md- the requirements.
Run
Offline:
python3 .flywheel/bin/flywheel.py check
python3 .flywheel/bin/flywheel.py status # "skills: 6 evals: 10" (12 skills with the OpenSpec skills)Needs Claude Code and a model (billed to your plan or API account): in Claude Code, ask "Use the
evaluate skill on capture-observation." It runs three evals, each with a fresh generator and two
or more judge calls, so expect several subagent runs. Read the report table (eval, score, min,
pass or fail) and the files written under .flywheel/evals/capture-observation/results/.
These evals have not been run by the lab authors yet, so there is no reference score to compare with. Your run is the first data point. Run it twice: if the totals of an eval move by more than 0.2 between runs, the eval or the criteria are too vague.
Break it
Drop a section. Delete
## Scoring Criteriaand everything after it from.flywheel/evals/capture-observation/poisoning-guard.mdand runcheck:ERROR .flywheel/evals/capture-observation/poisoning-guard.md: missing section(s): ## Scoring Criteria check: 1 error(s), 0 warning(s)A wrong fixture or score. Change the fixture to
fixtures/api-error.txt:fixture not found: fixtures/api-error.txt. Changemin_score: 0.9tomin_score: 90:min_score must be a number in (0, 1].Leak the answer key (needs a model). Run one eval by hand, but paste the
Expected Behaviorinto the generator prompt. Compare the judge's total with an isolated run. Any gain in the leaked run comes from the answer key, not from the skill, which did not change. That is the first anti-pattern in theevaluateskill.
Undo with git checkout -- .flywheel/evals.
Check
python3 -m unittest tests.test_flywheel.TestSkillsAndEvals -vtest_eval_missing_section, test_eval_sections_out_of_order, and
test_eval_missing_fixture_and_unknown_skill cover the format rules; test_valid_skill_and_eval
proves a correct pair passes.
Exercises
- Write a fourth eval for
capture-observation: a user correction that contradicts an existing entry. Expected behavior: a new linked entry with aContradicts:line, old entry unchanged. Weight the criteria. Runcheck. - The judge returns
{"scores": [...], "total": ..., "constitution_violations": [...], "notes": ...}. Why does the skill ask for evidence per score, and what would you do with a score that has none? model: sonnetin the judge file is an alias. Pin a full model ID there and explain what a pinned judge gives you when you compare scores across months.
Exam connection
CCA-F - Prompt Engineering & Structured Output (eval design, rubrics with weights, a judge that returns strict JSON) and Agentic Architecture & Orchestration (isolated subagents for generation and judging, read-only tools for the judge). Practice both on CertLabPro.
Previous: Lab 03 - Capture - Next: Lab 05 - Promotion