/model-right-sizer:model-right-sizer-holdout-tuningfrom model-right-sizer
Tunes model-right-sizer wording knobs against a real build's actual token spend using held-out tasks with known outcomes. Runs 3 blind dry-runs per candidate, averages budgets, scores adherence, and iterates one wording change at a time.
Ships in model-right-sizer. 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.
None: SKILL.md is the whole skill.
This is the sibling of
model-right-sizer-prompt-tuning,
not a replacement for it. That skill searches knobs.py's wording against
the fixed synthetic t1–t6 benchmark, and every candidate costs a full
real build per tuning task. This skill searches the exact same knobs.py
registry, but against a held-out task whose real cost is already
known — a genuine past build, not a benchmark fixture — which means each
iteration costs one blind dry-run, not a full re-build. That efficiency is
the whole point: the ground truth doesn't move, only the estimate does, so
only the estimate needs to be re-run.
It exists because this exact loop is how dispatch_floor_awareness (a
knob in the current registry) went from level 0 to level 4 across several
real sessions — first a novel-use-case validation exposed the gap, then a
full feature build produced a second, richer held-out task with six real
data points, then two more rounds of blind dry-run → diagnose → add a knob
level → re-run closed most of the gap. This skill is that same loop,
written down so it doesn't have to be re-invented per session.
../../eval/tuning/overfitting_guard.py
— HOLDOUT_TASKS is the registry of tasks with real outcomes recorded;
each entry's note field tracks how many times it's already been read,
which is exactly the contamination/overfitting state you need before
deciding whether to reuse it again or ask for a fresh one.../../eval/tuning/DESIGN.md — read
whichever "Pass N" sections cover prior holdout-tuning rounds (search for
"held-out" / "blind") so you don't re-diagnose a miss this repo's own
history already explains, and so your new pass's write-up slots into the
same numbering.Do NOT invoke this skill's dry-run agent with access to overfitting_guard.py
itself, eval/tuning/results/, or eval/ablation/results/ — those are
exactly the files a blind run must not read; reading any of them is the
calibration-masking contamination overfitting_guard.assess_generalization()
exists to catch (see model-right-sizer-prompt-tuning's sibling concern,
and this repo's own pass 6 finding where a "clean win" turned out to be the
dry-run finding and reading the exact answer).
Pick the held-out task. From HOLDOUT_TASKS, choose one whose
real_outcome_doc has real {actual_tokens, budgeted_tokens} per-unit
data (richer than a single ratio, if available — more points to score
against). Read that note field first: if it says the task has already
been used for calibrated (non-blind) reads, that's fine for THIS skill
(which only ever runs blind); if it says the task's own n has been used
to select a knob level multiple times already, weigh that against the
target — pushing a third or fourth blind iteration on the same n=6 task
is a real overfitting cost, not a free lunch, and is worth naming to
whoever asked before continuing regardless.
Render the current best-known settings. Via
generate_variant.py
--settings "..." — the same settings string named in DESIGN.md's
most recent "current best-known settings" line. Write the rendered
variant to a scratch file; this is the dry-run agent's system prompt.
Dispatch 3 independent blind dry-runs per candidate, not one.
A single draw is not reliable evidence: this repo's own history found
per-unit standard deviations of 10–30% of the mean between draws of the
IDENTICAL settings, large enough to flip within_budget/over_budget
classifications outright and to make a single-draw "improvement" or
"regression" indistinguishable from noise (see
results/2026-08-22-pass7-blind-vs-chief-of-staff-actuals.md's
iteration 4 — a reported accuracy_rate of 0.333 from one draw turned
out to be 0.167 once averaged over 3). Dispatch 3 independent agents per
candidate setting (same persona, same intent, same decomposition
instructions) and average each unit's token_ceiling across the 3
before scoring. A single draw is acceptable only for a cheap first look
at whether a candidate is worth evaluating properly — never as the basis
for an accept/reject decision on its own. Give each dispatched agent:
uncertainty_ledger.calibration.ledger_found: false, and do not read
eval/tuning/results/, eval/ablation/results/, or
overfitting_guard.py. It MAY read the shipped schema, example,
agents/model-right-sizer.md, and any deterministic library module
the real build actually shipped (eval/budget_threshold.py,
eval/reasoning_budget.py) — those are legitimate artifacts a real
dry-run would see, not calibration data.real_outcome_doc — not paraphrased, so
repeated iterations stay comparable to each other.mode: "dry_run", Pass A only, return the JSON blueprint alone.Validate, then map units to real actuals. Run the returned JSON
through ../../../../scripts/validate_blueprint.py.
Then match each work_routing_map[] unit to its corresponding real
{actual_tokens, budgeted_tokens} pair by role/shape (schema unit →
schema unit, skill-authoring unit → skill-authoring unit). If a unit's
scope doesn't cleanly correspond to one real unit, say so explicitly
rather than forcing a match — an honest "ambiguous, not scored" beats a
confident wrong pairing.
Score it. Per matched unit, average token_ceiling across the 3
draws (statistics.mean), then compute
reasoning_budget.budget_adherence_ratio(actual_tokens, mean_ceiling)
and classify_budget_adherence(...). Also report each unit's stdev
across the 3 draws next to its mean — a high stdev relative to the mean
is itself a finding worth naming, not just a number to average away.
Check which side of the
floor-inclusive/floor-exclusive line the current wording puts
token_ceiling on before picking actual_tokens — dispatch_floor_awareness
at level ≥1 makes the ceiling floor-inclusive (compare against raw
dispatch cost), whereas the unmodified baseline is implicitly
floor-exclusive (compare against cost net of the tier's zero-tool floor)
— mixing the two is the exact methodological error pass 6 corrected;
get it right for whatever knob levels are actually in play this run.
Then optimizer.score_candidate(records) for the aggregate
accuracy_rate/mean_loss. Render a table: unit, budgeted, actual,
ratio, class — plus the aggregate — and keep every prior iteration's
table in the same write-up so the trajectory is visible, not just the
latest point.
Diagnose the miss pattern, don't just note the numbers. For each
over_budget or under_budget_oversized unit, ask what specifically
drove it: a loop_class classification that hides real tool-call volume
(e.g. low-tool-turn on a unit gated behind a mandatory validate-then-
fix loop), an effort pick that under- or over-rates genuine difficulty,
or plain sampling variance on a single dry-run draw (most visible on
opus-tier picks whose budget swings between iterations with no wording
cause — this repo's own pass 5 and pass 7 both found this pattern; name
it as noise rather than inventing a causal story for a single data
point). Group misses by shared shape across units, not one at a time —
a fix that targets a shape shared by three misses is worth more than
three separate fixes.
Propose ONE targeted change. Prefer adding a new LEVEL to an
existing knob in knobs.py (matching its exact anchor-discipline: level
0 unmodified, every non-zero level a full replacement text, disjoint
non-overlapping anchors) over inventing a new knob, unless the diagnosed
mechanism genuinely doesn't fit any existing knob's anchor location. If
you ground a concrete numeric range in this session's own real-dispatch
evidence, say so explicitly in the knob's own description/text — that's
a disclosed, general-purpose calibration baked into the wording, not a
hidden runtime ledger lookup, and the difference matters for
overfitting_guard's own contamination concern. Run
tests/model_right_sizer/test_tuning_knobs.py after editing — it
exercises every level generically, including new ones, with no changes
needed on your part.
Two specific wording pitfalls this repo's own history hit, worth avoiding on purpose:
Re-render, re-dispatch (3 draws), re-score, compare. Same task, same
intent wording, same decomposition shape, new settings. Compare
accuracy_rate/mean_loss against the immediately prior iteration —
and against the ORIGINAL live-dispatch budgets recorded in the held-out
task's own real_outcome_doc, since that's the number a genuinely good
blind estimate should approach. Report every per-unit regression
honestly even when the aggregate improves — a unit that flips from
within_budget to over_budget is real information (about noise or
about a real tension your change introduced), not noise to omit.
Decide: iterate, adopt-and-stop, or ask for a fresh task. Iterate
only while each round shows real, attributable improvement. Stop and
report honestly, without another round, when: the requested target is
reached; two iterations in a row show no material accuracy_rate
improvement; or continuing would mean a third-or-later blind pass
against the same fixed n — at that point, say plainly that further
squeezing this one task's data starts to look like overfitting rather
than tuning, and that the right next move is a fresh held-out task (a
different real build), not another wording tweak aimed at the same six
numbers. If told explicitly to keep going anyway, that's a legitimate
call for whoever asked to make — flag it once, then proceed.
Write it up, update the registry, validate, commit. A results file
under eval/tuning/results/ with every iteration's table, the
diagnosis for each, and the final decision; a cross-reference from
DESIGN.md's "current best-known settings" line; an update to the used
HOLDOUT_TASKS entry's note reflecting the new read count (so the
NEXT run of this skill sees accurate contamination state, not a state
that only lived in this session's chat transcript). Run this repo's
full validator list from CLAUDE.md and the pytest suite before
committing — this skill edits knobs.py (a real file), unlike its
read-mostly sibling model-right-sizer-prompt-tuning.
model-right-sizer-prompt-tuning's synthetic-
benchmark coordinate ascent — different ground truth (a real, already-
measured build vs. t1–t6), and this skill never dispatches a fresh
real build of its own; it only ever re-runs the (cheap) blueprint step
against actuals someone already paid for once.overfitting_guard.REQUIRED_GATE_NOTE's
merge gate — that gate is about calibrated-vs-blind generalization
specifically; this skill's every run is already blind, which is necessary
for a clean comparison but not the same check. State both results
side by side if this skill's output is being used to argue for a merge.real_outcome_doc. If no such task fits the shape being tuned,
the right move is building one for real first (see
model-right-sizer-budget-guard-style
real dispatch, or any real build), not inventing numbers here.agents/model-right-sizer.md directly, and does not
merge its own winning knob settings into the shipped file — same
propose-a-diff-for-a-human discipline as its sibling skill.model-right-sizer-prompt-tuning
— the sibling skill this one shares knobs.py/optimizer.py with; tunes
against the synthetic benchmark instead of a real held-out build.../../eval/tuning/overfitting_guard.py
— HOLDOUT_TASKS, assess_generalization(), and REQUIRED_GATE_NOTE;
the contamination-tracking this skill's step 1 and step 10 depend on.../../eval/tuning/knobs.py /
optimizer.py /
generate_variant.py — the
knob registry, scoring functions, and variant renderer this skill drives.../../eval/reasoning_budget.py —
budget_adherence_ratio / classify_budget_adherence, the per-unit
scoring functions.../../eval/tuning/DESIGN.md — the running
log of every tuning pass, including prior holdout-tuning rounds this
skill's own future runs should read before re-diagnosing a known miss.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cloudzero/cloudzero-claude-marketplace --plugin model-right-sizer11 skills in this plugin
/model-right-sizer-auditOne-shot, PER-CALL-SITE audit of a repo's EXISTING LLM calls — every place code invokes a model (an SDK/API call, a sub-agent dispatch, an agent frontmatter definition), decomposed by INTENT into the distinct jobs it does, never a grep hit on a model name and never one candidate per file. A skill pinned by one static `model:` key still gets its steps split by intent when severable under Claude Code's per-turn model binding. DELEGATES each call to `model-right-sizer-dryrun` (never re-implements its scoring) and merges results into ONE schema-conformant JSON blueprint committed at the TARGET REPO'S ROOT via a PR — never a markdown table. Distinct from `model-right-sizer-dryrun` (invoke directly for one hypothetical task) and `model-right-sizer-install` (the standing before/after mandate). Use when someone says "audit this repo's model calls", "right-size the models in <repo> per call site", "find every LLM call and right-size it", or "commit a model right-sizing blueprint for <repo>"./model-right-sizer-budget-guardThe while-work-is-in-flight companion to `model-right-sizer-dryrun`: once `work_routing_map[]` is real and being dispatched as sub-agents, the runbook for keeping two things honest — the status ledger (`status`/`status_updated_at`/`status_note` per row, flipped at every real transition) and the token-budget guard (checking real spend against `budget.token_ceiling`; once `budget_threshold.py`'s `threshold_crossed()` trips at `warning_threshold_pct`, sending `format_budget_warning()`'s string into that unit's next turn). Checks at turn boundaries with whatever usage the dispatch mechanism reports — never a fabricated live ticker. Only applies to rows actually dispatched, never design-time-only `blueprint_rows[]`, and never replaces Pass B's usage report. Use when someone says "dispatch the work-routing map", "run the budget guard while units are in flight", "update the status ledger for unit X", or "did unit X cross its warning threshold"./model-right-sizer-dryrunPreview the model-routing MAP for an intent without building anything. You give it a free-text INTENT — "build a CLI that…", "add a feature that…", "refactor X into Y" — and it invokes the `model-right-sizer` agent in BLUEPRINT-ONLY mode: decompose the work, score each piece, and emit a single schema-conformant JSON blueprint (task→model→effort→budget→ schema→confidence, per `schemas/blueprint.schema.json`), then STOP. No build, no file edits, no after-the-fact usage report — it is the what-would-this-cost / how-would-this-route preview lever, safe to run against any idea, and the JSON it returns is what an orchestrator parses to route dispatch. Read-only. Use when someone says "dry-run the right-sizer on …", "what's the map for …", "how would you route …", or "show me the blueprint for … before I build it"./model-right-sizer-installStamp a model-right-sizer mandate onto the CURRENT repo's agent-instructions file — `CLAUDE.md`, `AGENTS.md`, or both, whichever the repo has. Idempotent and append-only: an existing file is never overwritten, only the marker-delimited mandate block is inserted or refreshed. The mandate's "before" hook runs `model-right-sizer-dryrun` to produce a schema-conformant JSON blueprint for the orchestrator to route by. Also checks whether the `model-right-sizer` agent and `model-right-sizer-dryrun` skill are discoverable and, if either is missing, installs the `model-right-sizer` Claude Code plugin to fix that (falling back to manual instructions otherwise). Deliberately narrow and organization-agnostic — installs only the right-sizing mandate (plus its own dependencies, if absent), not any broader development process. Use when someone says "install model-right-sizer in this repo", "init this repo for model-right-sizer", "add the right-sizer mandate here", or "make this repo consult model-right-sizer every turn"./model-right-sizer-layer-ablationEmpirically measure what each of model-right-sizer's four research-grounded citation layers (Token Economics, IBPO, BudgetThinker, Speculative Decoding) actually does to its blueprints — instead of trusting the citations alone. Renders layer-ablated variants (any of the 16 layer subsets), runs a fixed six-task benchmark through each variant's Pass A blueprint, and for a scoped subset actually executes the recommended build and scores whether real effort stayed within the predicted budget (wrapping `classify_budget_adherence`). Reports each layer's effect in ISOLATION vs. a zero-layer baseline, and every COMBINATION across the full 16-subset grid, so synergy or redundancy is visible, not assumed away. Read-mostly: writes only a scratch directory and a final report, never `agents/model-right-sizer.md`. Use when someone says "does the Token Economics layer actually change anything", "ablate the research layers", "run the layer-ablation study", or "audit model-right-sizer's citations empirically"./model-right-sizer-prompt-tuningTune the exact WORDING of model-right-sizer's four already-shipped research-grounded layers to maximize real-execution accuracy (effort stayed within budget, per `classify_budget_adherence`) — not whether to include a layer (see `model-right-sizer-layer-ablation`), but how an included layer should be phrased. Runs a discrete coordinate-ascent search (the finite-difference analog of gradient descent for prose) over four wording knobs in `eval/tuning/knobs.py`, each anchored at one spot in the shipped agent text plausibly moving the accuracy ratio: `token_ceiling` margin, how hard the effort dial leans down under difficulty-uncertainty, and the calibration/adherence knobs. Read-mostly: never edits the agent file directly, only proposes the winning wording as a diff to review. Use when someone says "tune model-right-sizer's wording for accuracy", "optimize the budget-ceiling wording", "run a gradient descent / hill-climbing search on the agent prompt", or "which wording maximizes budget-adherence accuracy".Other plugins' skills for the same job