finalize
Skill69 starsChanged 5 months agoApache-2.0View on GitHub
Score the best candidate on the held-out TEST split exactly once and seal the run. Use as the last evaluation step, after optimization stops. The run dir enforces the seal — a second finalize raises an error — so the headline number is produced once on data the optimizer never saw, the way an honest benchmark result must be.
22 other projects use a version of this.
Adopted by
Most recently taken up by
- PL-Coding-GmbH/Skillstheir own version, first seen Nov 8, 2026
- DnsQueen/orcinus-skillstheir own version, first seen Nov 8, 2026
- MagicJosh/rastheir own version, first seen Nov 2, 2026
- SDSLeon/lightcodetheir own version, first seen Nov 1, 2026
- griffinhilly/claude-code-synthesistheir own version, first seen Nov 1, 2026
- Porabuild/Poracodetheir own version, first seen Nov 1, 2026
Used with
Projects with it also use simplify, debug and 3 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Hugging FaceSkillsimplify
Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.
Also in 3 projects that use this
AnthropicSkilldebug
Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.
Also in 3 projects that use this
Microsoft AzureSkillverify
End-to-end app testing pipeline for browser-based web apps on cloud browsers via Azure Playwright Workspaces: verify the live app, author tests for working flows, heal failing tests, then re-run with video and produce one consolidated report. Three phases (app verification, test authoring, test healing) plus a scoped final sanity run; each phase emits a sub-report. Use when asked to "verify my app", "make sure my app works and has good test coverage", "do a full QA pass", "add tests where I'm missing coverage", "fix failing tests and add new ones", "smoke test before deploy", "QA my deployment", or any combined verify-and-test ask. Requires Azure CLI (`az login`) and a Playwright Workspace resource ID — bootstraps configs on first invocation. Browser-based web apps with Playwright only — not for unit/API tests, native mobile/desktop, load/perf, or full accessibility audits.
Also in 3 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 3 projects that use this
Other versions22 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 22
- morethanwords/tweb★ 2.7ksame name
- educlopez/ui-craft★ 441same name
- zifeo/lade★ 135same name
- Porabuild/Poracode★ 121same name
- SDSLeon/lightcode★ 121same name
- redis/docs★ 86same name
- griffinhilly/claude-code-synthesis★ 67same name
- PL-Coding-GmbH/Skills★ 18same name
- alexiolan/craft-skills★ 17same name
- grimoire-rs/grimoire★ 15same name
12 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- agent-optimizeSkill
- evographSkill
- gepaSkill
- hill-climbSkill
- skilloptSkill
- mcp-toolSkill
- skill-packageSkill
- system-promptSkill
- toolsSkill
- wikiSkill
- run-optimizerSkill
- orchestrateSkill
- using-cap-evolveSkill
- baselineSkill
- diagnoseSkill
- evaluateSkill
- gateSkill
- implement-and-checkSkill
- intakeSkill
- reportSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 22 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 79
Never delete test rollouts or edit splits.json to get past the error — that manufactures a clean-looking number from a split that has …
“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
finalize — the one honest number
Optimization hill-climbs on val: every accept decision consumed val as a tuning
signal, so by the end of search val is optimistic — it has been selected
against. The number you report must come from data nothing was tuned against.
finalize scores the run's best candidate on the sealed test split, once, and
writes final.json. That file is the run's result.
One finalize is two evals, not one
A bare test number cannot be defended — a reader cannot tell whether it beat the
capability you started with. So one finalize scores test twice: the best
candidate as tag FINAL, and the untouched seed candidate as FINAL_seed
(harness.finalize). final.json therefore carries test, test_baseline,
baseline_id, and test_delta — the held-out improvement, which is the figure
report, the dashboard, and the event stream all headline. If the best candidate
IS the seed (nothing was accepted), the second eval is skipped and test_delta is
0 by construction.
So budget --n-trials 3 as 3 trials × 2 candidates × |test| rollouts — twice
what the flag looks like it buys on a paid benchmark.
Both evals sit inside one attempt and neither is a selection event: the delta is reported, never chosen on. That is why the seal counts attempts, not evals.
The seal (why "exactly once")
The instant test informs any choice — picking between finalists, "double-
checking" a low number, re-running until it looks better — it stops being held
out, because each peek is a selection event that pulls the number from an
unbiased estimate toward an optimistic fit metric (references/concepts.md).
cap_evolve enforces this in three parts (rundir.py:358-407), and the split
between them is the whole design:
- reserve — every
split="test"eval first checks the seal without burning it, so no phase other than finalize can reach test at all. - commit — the seal burns only after
final.jsonis written, so a finalize that dies before scoring leaves it unused and is honestly retryable. A transient crash must not destroy a run's headline number. - attempt guard — seal-on-success alone cannot tell "crashed before scoring"
from "crashed after". A real run hit the second case: a finalize killed by a
timeout had already scored test, the retry scored it again, and the reported
headline was that second look.
begin_test_attemptrefuses a retry once test rollouts exist on disk, before anything is spent.
The seal refuses that mistake by default; it is not unbypassable.
CAPEVOLVE_ALLOW_TEST_RESCORE=1 is a deliberate opt-in override
(rundir.py:166). Its own message promises the use "is recorded in the run" —
nothing records it (issue #341), so a run that took a second look currently looks
identical to an honest one. If you set it, disclose it in the write-up yourself.
Corollary: all selection happens before finalize. Choose the single best candidate on val, then finalize it. Finalists that genuinely need comparing get compared on val — never on test.
If finalize refuses
A TestSealError is three situations with three different right moves. Tell them
apart from <run>/rollouts/test/ and test_used in splits.json:
| State | What happened | Do this |
| no test rollouts, seal unused | crashed before scoring | Re-run finalize — the case seal-on-success exists for. |
| test rollouts exist, seal unused | crashed after scoring, before commit | Do not re-score. Read the rollouts under <run>/rollouts/test/ and report what that attempt already computed. |
test_used: true | the run is finalized | Read final.json and regenerate the human artifact with report alone; cap-evolve run --resume skips finalize for you. |
Never delete test rollouts or edit splits.json to get past the error — that
manufactures a clean-looking number from a split that has already been seen.
Dual-mode
This phase runs two ways from the same SKILL.md: standalone as the slash command /cap-evolve:finalize (the argument-hint shows its run.py args), and orchestrator-callable — cap-evolve run / the orchestrate skill invokes the same scripts/run.py headlessly and threads the run dir between phases.
How to run
python scripts/run.py --run-dir .capevolve/run_XXXX --project .capevolve/project --n-trials 3Multiple trials give the headline an honest stderr and a pass^k reliability
figure instead of one noisy point. Under cap-evolve run the count comes from
num_trials in capevolve.yaml and defaults to 1 — set it to ≥3, or the
orchestrated headline ships with stderr 0: the exact single point this warns
against. If the split was configured with no holdout (test == train/val) the
number is a fit metric, not a held-out result; the dashboard flags it, so say so
in the summary too.
Then read the result instead of just filing it: test ≈ val means the val gain generalized, test ≪ val means search overfit val — a real finding, not a reason to re-score.
References
references/concepts.md— why each peek biases the estimate, the train-fits / val-selects / test-estimates rationale, no-holdout runs, and how this maps to public benchmark protocol, with sources.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

