Agent token costs: what the 90% cut actually takes
Spotify's shunt plugin routes agent grunt work to a cheap model and cut Claude Code token usage 90%. What transfers to your stack, and what stays expensive.
The seat license is not what hurts; the tokens are. That line opens a Spotify engineering post from September 3, and it names a bill that agent operators know well. Spotify’s Dimitri Mazmanov measured his Claude Code usage before and after shunting grunt work to a cheap model. Mean bulk-read savings landed around 90 percent (Spotify Engineering). The post hit Hacker News the next day and pulled 277 points (HN), since every team carries the same bill.
NoteI have not run Portal, which is Spotify’s enterprise developer platform, so nothing here is framed as my test. Everything comes from the post, the repo, the Portal docs, and the HN thread; claims checked September 9, 2026.
What Spotify actually shipped
The artifact is a Claude Code plugin called shunt, and it is plumbing rather than intelligence. Shunt defines two worker modes on Spotify’s Portal platform. Both run on Gemini 2.5 Flash, which costs a fraction of frontier prices per token. When Claude Code reaches for a big file, a hook fires first. If the file runs past 350 lines, the hook blocks the read and redirects the job to a bulk-reader mode. That mode digests the files and hands back structured bullets. Claude never sees the raw bytes, so they never enter its context window, which is where the savings live. The code-writer mode does the same for boilerplate. A spec plus a reference file go in; generated code comes out straight to disk. Claude only reviews the result.
What makes this work is not the cheap model, because everybody has known to route work for a while. The first version of this system was a block of routing rules in CLAUDE.md. Mazmanov is honest that it “sort of worked”, since the rules were advisory and Claude could ignore them. Shunt replaces the suggestion with a hard gate. The hook fires before every tool call, and it cannot be talked out of blocking. Commenters on HN called the result “an LLM Bloom filter”, a cheap sieve for the code worth reading expensively. That framing is the whole idea in four words.
Why the routing works: the bill is mostly I/O
Mazmanov’s diagnosis opens the post, and it matches what agent operators see in their traces. Reading five files to answer one question burns thousands of tokens, while the model reasons about none of them. Generating a test that matches the twenty beside it, or updating docs after a meeting, has the same shape. Frontier models are overqualified for that work, and they bill like it. Since an agent’s context is mostly other people’s code, the I/O dominates the bill. Thinking is what you value, and it is the smaller line.
TipIf you run marketing agents, look at what your traces actually spend on, because the split is rarely what you expect. A reporting agent that pulls campaign data is an I/O workload. A brief builder that reads last quarter’s posts is another, and so is a monitor that digests an inbox. The cheap-model pattern applies directly to all three. The judgment layer stays on the expensive model, because deciding what an anomaly means for the budget is the part you pay for.
The pattern is not new, and HN said so within minutes. Cursor’s Composer began with exploration on a smaller model, one commenter noted, while the big model reviewed what came back. Claude Code already spins off cheap subagents for large codebases, which makes delegation standard practice there too. The difference practitioners kept naming is enforcement, because a subagent menu is a choice while shunt is a gate. A choice gets ignored once your bill hurts enough to read posts like this one; a gate does not. That is why the Spotify version earned the thread’s attention.
What the 90% does not measure
The benchmark counts tokens, and it does not count quality. HN’s sharpest critique asked for exactly that: “nothing about accuracy or actual performance” across the four test scenarios. The post’s own limits section quietly concedes the point. The worker model missed a subtle thread-safety bug during Mazmanov’s testing, while Claude spotted it in seconds once given context. Token savings are real. The worker’s error rate is unmeasured, though, and nobody outside Spotify has run it against a benchmark.
The scope boundary matters as much as the number. Delegation covers understanding, not editing, since worker summaries lack reliable line numbers; Claude still reads the section it must change. Debugging, architecture, and safety-critical code are excluded from routing, which is both right and honest. The cost context explains why teams accept the trade. Gartner predicts that by 2028, AI coding costs will overtake the average developer’s salary (Gartner, June 24, 2026). Token consumption is the driver, and Gartner’s advice is thresholds plus governance, which shunt essentially is. A pattern that cuts the biggest line item 90% gets a hearing even when it has limits.
| Work | Route to cheap model? | Why |
|---|---|---|
| Bulk file reads | Yes | Summary output is far cheaper than raw context |
| Boilerplate tests and stubs | Yes | Patterns exist in reference files |
| Doc updates after a meeting | Mostly | Formatting work, though tone needs review |
| Edits based on analysis | No | Worker summaries lack reliable line numbers |
| Debugging | No | The worker missed a real thread-safety bug in Spotify’s test |
| Architecture and safety-critical code | No | Explicitly excluded from routing by design |
What it takes on your stack
Portal is the productized path, and it is also an enterprise product behind a contact-sales funnel. Most teams reading this cannot buy it this week. The install path runs through the plugin marketplace: add spotify/portal-ai-plugins, then install the portal and shunt plugins (repo). You authenticate with /portal:setup against a Portal instance that has AiKA enabled. You need jq on the machine. The two modes ship publicly, so there is nothing to create unless you want a custom worker model. The threshold is tunable through a SHUNT_MIN_LINES environment variable when 350 lines does not fit your codebase.
The latency tax is the part the headline omits. Each delegation is a network round trip through the Portal backend. Responses typically take 10 to 30 seconds, and a single invocation caps at 30. Below the line threshold, the overhead of delegation exceeds the savings, which is why the threshold exists at all. Fine for large reads; counterproductive for small ones; your call on where to draw the line.
The pattern is portable even where the product is not, and this is the part worth stealing. Any framework with subagents can route reads to a smaller model, though the menu stays narrow. A router widens it if your stack has one. Repo maps and skeleton reads get the same effect a different way, as Aider pioneered long ago. The agent reads an index first, then pulls targeted chunks, and it never ingests the whole file. The tools differ; the discipline is identical, and it does not require buying anything from Spotify.
The same discipline shows up across the builds I have written about here. MCP servers determine what an agent can touch, and human review gates determine what it must not decide alone. Shunt adds a third control: what it is allowed to spend. A context kit that curates the model’s inputs (field notes) attacks the bill from the input side. Local-first stacks attack it from the price side, since a paid-off Mac mini bills no tokens at all. Pick the control that matches where your spend actually sits.
WarningThe 90% figure is Spotify’s measurement on a Java monorepo across four scenarios, as of September 2026. Your repo, your models, and your threshold will land somewhere else. Measure your own before and after.
- Your agent’s traces show reads and boilerplate dominating token spend.
- You can tolerate 10-30 seconds of latency on delegated work.
- A cheaper model is available in your stack, or a router can bring one in.
- Your delegated work is understanding, not editing or debugging.
- You will measure tokens before and after, because your number will differ from 90%.
The Bottom Line
- Shunt is enforcement rather than cleverness: hooks block the expensive read, while advisory CLAUDE.md rules got ignored when the model felt like ignoring them.
- The savings are real but scoped, since they are token-only on a Java monorepo, with quality unmeasured and one real bug missed by the worker.
- The bill is mostly I/O, so route reads and boilerplate to a cheap model and keep judgment on the frontier tier.
- Latency is the tax: 10-30 seconds per delegation, capped at 30, and pointless below the line threshold.
- The portable version is free: delegation discipline plus repo maps, with no Portal purchase required.
Filed under agents, which is where routing and cost discipline live on this site. The Spotify post is the primary source, while the HN thread is where the skepticism lives.