Undercut for Gemini CLI
Undercut is a free, MIT-licensed routing policy you append to GEMINI.md — the file Gemini CLI reads hierarchically on every session — cheap tier first, escalate only on evidence, never on a vibe. Gemini CLI has no built-in per-task cost dial to compare against; this exists because the same overpay-by-default pattern we measured elsewhere in the agent ecosystem (one self-reported ccusage breakdown from a different agent showed 93.8% of tokens going to the top-tier model by default, anthropics/claude-code#27665 — one account's data, not Gemini's own) shows up anywhere an agent defaults every task to its strongest model.
How this maps onto Gemini CLI
Gemini CLI's documented, reliable mechanism is GEMINI.md, read in three tiers: ~/.gemini/GEMINI.md (global) first, then GEMINI.md files in your configured workspace directories and their parent directories, then a just-in-time scan — when a tool accesses a file or directory, the CLI automatically scans for GEMINI.md files in that directory and its ancestors up to a trusted root (per Gemini CLI's own docs and the gemini-cli repo's docs). Gemini CLI also ships an Agent Skills feature: per Gemini CLI's own skills docs, it auto-discovers a plain SKILL.md from .gemini/skills/<name>/ (workspace) or ~/.gemini/skills/<name>/ (user), or the cross-agent .agents/skills/ alias — no extension package required. (Extension-bundled skills also work, and sit lower in the precedence order than workspace skills.) That makes a direct skill install a confirmed option alongside GEMINI.md — see Install below for both.
Undercut's tier names — cheap, standard, frontier, apex — are generic on purpose. models.md gives the rule of thumb rather than a fixed slug for Gemini CLI specifically: cheap maps to the smallest/fastest model in Google's current Gemini lineup, standard to the default work model, frontier to the highest-reasoning production model, and apex is reserved for the single batched tie-break call when the ladder is exhausted. The mapping is versioned separately from the rubric, so a new Gemini release updates the model name without touching the escalation logic itself.
Nothing about this sits between Gemini CLI and the Gemini API. It's plain markdown text Gemini CLI reads into context at session start, same as any other project instructions — no proxy, no network hop, nothing to route around if you remove the block.
Install for Gemini CLI
Run this from the repo root. Gemini CLI walks upward from your working directory looking for a GEMINI.md file at the project root (not inside a .gemini/ subdirectory — that's reserved for the global, home-directory copy), so appending the policy text to the root file here is the most reliable way to get it in front of Gemini CLI.
Same file, user scope. Gemini CLI reads ~/.gemini/GEMINI.md first, before any project-level file — useful if you want the policy everywhere without touching individual repos.
Gemini CLI's own docs now confirm plain SKILL.md discovery at .gemini/skills/<name>/ — no extension package needed. Undercut's skill is already named firstpass, so the directory copies straight across.
What's still unverified: skills.sh lists Gemini as a supported install target but doesn't publish which directory it writes to, so treat npx skills add undercutsh/firstpass for Gemini as unverified until confirmed against a real session — use Option 1 or Option 3 above instead, both directly confirmed against Gemini CLI's own docs.
testing/README.md and the raw JSON in testing/results/node src/main.js --mockZero lock-in. It's markdown text Gemini CLI reads — delete the block and you're back to status quo.
How it works
The Undercut Rubric · v1This is a named, versioned spec — not internal logic we could quietly change. When the rubric changes (a new flag, a different cap), the version number moves and the changelog says why.
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.
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.
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.
The next tier up gets only the failed or uncertain items, plus verification notes. It resolves the residue — it never redoes the batch.
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
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.
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.
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
Not a proxy, not a gateway, doesn't auto-flag in production (Gemini CLI scores the flags itself — measured robust to getting them wrong, see above), and doesn't promise a dollar figure for your workload. Full list, with the finance/procurement note and the paid-tier disclosure, is on the main page.
Nothing about this page expires. What does keep happening is the token bill, one session at a time, on whatever Gemini CLI is currently doing with mechanical work.