Undercut — tiered dispatch for coding agents

MIT · open-source · works with any agent that reads a SKILL.md

Undercut the top-tier model. Never the quality bar.

Undercut is a SKILL.md your coding agent follows at dispatch time. Six-flag rubric assigns a base tier. Objective evidence — not self-reported confidence — is the only thing allowed to escalate it.

Measured on public benchmarks, official test cases, deterministic graders: up to −95% cost on HumanEval, up to −71% on GSM8K — equal-or-better pass rate. Raw results →

Every session your agent runs on all-standard routing between now and whenever you install this, it's paying top-tier prices for work a cheap tier could have passed. That's not a countdown timer — it's just what the token bill already does.

Read the benchmarks
dispatch — live routing
{{ row.unit }} {{ row.flags }} {{ row.result }}
$
Works anywhere a SKILL.md is read
Claude Code Codex Cursor Copilot OpenCode

For your team

One skill. Three reasons to care.

For platform & DevEx engineers

Objective escalation triggers, not confidence thresholds. Vendor-agnostic rubric. Published, reproducible methodology — re-run our exact benchmarks on your own tasks.

For finance & ops

No new vendor contract. No network-layer access, no proxy sitting between your agent and its model calls. MIT license, free, and every cost claim on this page is backed by public, auditable results — not a vendor's internal number.

For product people and vibe coders

Your coding agent gets cheaper automatically. Nothing to configure, nothing to learn about routing rubrics — install it, and the easy work stops burning top-tier tokens.

The problem

Your agent picks one model per session — and defaults to the expensive one for everything.

Claude Code, Codex, Cursor, and Copilot let you set a model once per session. That session then handles trivial, mechanical work at the same tier as genuinely hard reasoning. One Claude Code Max subscriber's self-reported usage data showed 93.8% of their tokens going to the top-tier model — with nothing pulling cheap, mechanical work back down.

It's one user's numbers, not an industry audit — the GitHub issue has stayed open with real engagement, which suggests the pattern isn't unique to one account.

The obvious fix doesn't work.

Ask the model how confident it is, and route on that. Except LLM self-reported confidence is poorly calibrated — a model that's wrong is often just as "confident" as one that's right. A confidence threshold buys the feeling of a safety check without the substance.

Undercut replaces confidence with three objective triggers: a failed verification, a measured disagreement between two cheap-tier runs, or an explicit uncertainty flag. Nothing escalates on a vibe.

vs. cap-based routers

Caps throttle spend. Undercut routes work.

Most "cost control" tooling watches the meter: every unit still runs at the top tier until a budget cap stops the whole session. Undercut decides the tier per unit, before it runs — the cap never has to save you because the spend never happens.

Spend-cap routerreacts after the spend
rename variables ×214frontier · $$$
format JSON outputfrontier · $$$
design auth flowfrontier · $$$
budget92% — approaching hard stop
⛔ hard stop — session halted mid-task

Every unit runs at the same tier. The only lever is stopping — quality of routing never changes, spending just ends.

Undercutroutes before the spend
rename variables ×214cheap · $
format JSON outputcheap · $
design auth flowfrontier · $$$
1 unit failed check ×2↑ +1 tier · residue only
✓ batch complete — nothing halted, nothing overpaid

Each unit gets the cheapest tier that can pass verification. Escalation happens on evidence, one tier at a time — and only for the units that need it.

They compose: Undercut routes first, your gateway's caps and compression still apply to whatever runs.

The proof — measured, not modeled

Controlled A/B. Same tasks, same grader, only the routing policy changes.

Vendor-constantEvery arm compared within one vendor, never across.
Deterministic gradersCode executed against official test cases; math is exact-match. No LLM judge.
5 seeds per armTemperature > 0.

GSM8K — math reasoning · 250 units/cell

Vendorall-standardtieredCostPass
OpenAI241/250 · $0.60249/250 · $0.17−71%+8
Gemini250/250 · $1.28248/250 · $0.53−59%−2 (seed noise)
Anthropic249/250 · $0.36250/250 · $0.35−4%+1
Open-weights240/250 · $0.02245/250 · $0.07+228%*+5

*Open-weights price ladders invert — see caveats. Absolute overhead is ~$0.01–0.02.

HumanEval — Python code · 100 units/cell

Vendorall-standardtieredCostPass
Gemini100/100 · $1.13100/100 · $0.05−95%=
Anthropic100/100 · $0.30100/100 · $0.12−61%=
OpenAI100/100 · $0.46100/100 · $1.23NA*=
Open-weights100/100 · $0.01100/100 · $0.02+77%*=

*OpenAI's cheapest tier can't write Python, so every task escalates the full ladder. Quality holds at 100/100 — the escalator works — there's just no cost headroom to exploit on that family for this benchmark.

Secondary evidence — clearly labeled oursOn our own 30-task synthetic suite (code, reasoning, mechanical — 150 units/cell), tiered was never worse than all-standard on any cell, and beat it on 6 of 12. The escalator recovers failures a fixed single tier gives up on — it's not just cheaper, it's smarter on the cells where it wins.

Read the benchmarks

How it works

Six flags assign a tier. Three triggers are the only way up.

Every unit of work gets scored against six flags, then assigned the cheapest tier that can plausibly handle it. It only moves up a tier when something objective proves it needs to — a failed check, a measured disagreement, an explicit uncertainty flag. It never moves up on a guess, and it never moves back down mid-task.

unit of work
6-flag rubric
0 flags
cheap~90% of units land here ✓
1–2
standard
3+/own
frontier
↑ escalate +1 tier only on: fail ×2 · two runs disagree · tagged "uncertain" residue only — never redoes the batch
See the rubric

Step 1 — Base tier, six-flag rubric

Unverifiable — can output be checked mechanically? (tests, schema, diff, grep)
Ambiguous — one right answer, or several defensible ones?
Blast — reversible? touches money, auth, user data, production, deletes?
Cross-cutting — one file/source, or reasoning across many?
Novel — pattern-following, or genuinely new design?
Format-strict — must output match an exact schema?

0 flags → cheap · 1–2 → standard · 3+ or any ownership/judgment call → frontier. Apex only when you can write one sentence stating why the marginal intelligence pays for the cost.

The override — single biggest lever

Cheap-to-verify ⇒ cheap-to-generate. If output can be checked mechanically, it starts at the lowest tier regardless of how hard it looks — verification catches failure. Only unverifiable work needs to start high.

Step 2 — Escalate exactly one tier, on evidence only

  • Verification fails twice at the current tier
  • Two cheap-tier runs disagree on ambiguous-flagged work
  • The worker tags an item "uncertain"

Residue-only handoff

The next tier up gets only the failed or uncertain items, plus verification notes. It resolves the residue — it never redoes the batch.

Hysteresis — guardrails

Never de-escalate mid-task. Max one retry per tier. Anything still unresolved goes to a single batched apex tie-break call. One hard file in a 700-file job doesn't drag the other 699 up a tier.

 unit of work
      |
  6-flag rubric
      |
  +---+----+
  | 0 flags|--> cheap
  | 1-2    |--> standard
  | 3+/own |--> frontier
  +---+----+
      | fail x2 / disagree / uncertain
      v
  escalate +1 tier
  (residue only)
      |
  still unresolved?
      v
  single batched
  apex tie-break

Why it holds up

Flags steer. Verification and escalation decide.

Even when the rubric flags are scored imperfectly, the escalator still routes work to the right tier almost every time — because a wrong flag only ever costs one extra cheap attempt, never a wrong answer or a big bill.

See the data

A stock dispatcher model reproduces the rubric flags imperfectly — Haiku hits 90% agreement, Sonnet 93%. The weakest flag (format-strict) is only 60%. None of that matters: under the shipped policy, both dispatchers still route 100% of units to the correct tier. A wrong flag changes the ladder cap, never the base tier — worst case, one extra cheap attempt.

Haiku dispatcher
90% flag agreement
100% tier-match
Sonnet dispatcher
93% flag agreement
100% tier-match

The rules are about the work, not the model.

Every rule is a property of the unit of work — verifiable, ambiguous, blast-radius — never a specific model's known weakness. Vendor cards go stale as models change; work properties don't. It's also hard-won — a format-strict rule that worked on Anthropic backfired on Gemini, which is exactly why the rubric no longer encodes per-vendor behavior.

Honest limits — and what this means for governance

What this doesn't do.

  • Not a proxy. Doesn't enforce anything at the network layer.
  • Not a gateway or compression proxy. Composes with those — routes first, they compress second.
  • Doesn't auto-flag in production. The dispatching agent scores the flags itself (measured robust to getting them wrong — see above).
  • Doesn't help when the cheapest tier lacks the capability entirely (OpenAI + Python is the documented case — no headroom to save).
  • Doesn't replace the planning decision. Planning is separate from execution routing; this ladder is for execution units.
  • Doesn't promise a dollar figure for your workload. Savings are workload-dependent — real workloads escalate more than benchmarks and land below these numbers, not above.

For finance & procurement

No new vendor contract to negotiate. No network-layer access — it's a policy file your agent reads, not a service that sits between your agent and its model calls. MIT licensed, free to run. Every cost and quality claim on this page traces to public, re-runnable benchmark data — not an internal vendor number you have to take on faith.

For teams

The skill is a policy. Enforcement is a product.

Undercut is free and MIT — it routes the developer who installs it. But a team can't rely on every dev opting in. Undercut for Teams enforces the routing policy across every account in your org, meters the savings, and gives you a signed ledger of every escalation — proof no unit silently over-routed.

Org-wide enforcement

One policy, applied to every member's agent. No one can silently route to the top tier.

Signed savings ledger

Every routing decision is recorded and verifiable. You see per-account savings, not a vendor's internal number.

SSO & directory sync

Provision and de-provision seats automatically. Governance, not a shared config file.

In development — launching soon Watch the repo for launch

Try it

Free. MIT. Nothing installs, nothing proxies your traffic.

$ npx skills add undercutsh/firstpass

or copy skills/firstpass/ straight into your agent's skills directory.

Validate it yourself

  1. 1Read the published results — testing/README.md and the raw JSON in testing/results/
  2. 2Reproduce for free, no API key, no spend: node src/main.js --mock
  3. 3Run live on your own vendor/benchmark with an OpenRouter key — a full 4-vendor × 2-benchmark run is ~$4–5 total, a single-vendor smoke test is pennies
  4. 4Diff any two saved runs: node src/main.js --compare a.json b.json

Zero lock-in. It's a policy your agent follows — remove the skill and you're back to status quo.

Not the one setting this up? Forward this page. Everything above the install command reads without a technical background — the engineer on your team just needs the command block.

Prior art

Others have tried cheaper-model routing. Here's what's different.

peragwin's subagent-model-routing gist and soumabali/token-router both explored assigning cheaper models to subagent work. Undercut adds the objective escalation loop on top: measured disagreement instead of self-reported confidence, hysteresis so a run can't thrash between tiers, residue-only escalation with a structured handoff, a calibration feedback loop, and — the part that's actually rare in this category — published, reproducible A/B results. Anyone can re-verify any cell in the tables above.

Not competing with your gateway.

Compression proxies like Edgee shrink what goes over the wire for a given call. Undercut decides which model handles the call in the first place. Route first, compress second — they stack.

FAQ

{{ faq.q }}

{{ faq.a }}

Undercut the top tier. Not the quality bar.

Nothing about this page expires. What does keep happening is the token bill, one session at a time, on whatever your agent is currently doing with mechanical work.

View on GitHub