Productivity

Spotify measured 90% fewer tokens by sending bulk file reads to a cheaper model

September 5, 2026 at 4:35 AM PT

Spotify Engineering blog header artwork for the Portal token usage article

Image: Spotify Engineering

Why it mattersMost agent spend goes on reading code rather than writing it, so the cheapest saving is deciding which model is allowed to open a large file.

Spotify published a measurement on 3 September saying that routing bulk file reads away from Claude Code and towards a cheaper worker model cut token use by roughly 90%. The post is by Dimitri Mazmanov, a principal product manager at the company, and the plugins behind it are on GitHub under Apache-2.0.

The mechanism is a plugin called shunt. It installs a hook that runs before Claude Code reads a file. If the file is longer than a set number of lines, the hook stops the read and tells the agent to ask a separate summarising step instead. The default threshold is 350 lines and it is configurable.

What was measured, and what was not

Spotify says the test ran against a Java monorepo across four scenarios, comparing the tokens Claude would spend reading files directly against the tokens spent consuming a summary. Their words: "Mean bulk-read savings were around a whopping 90%." That is the company's own figure on its own platform, and the post gives no sample size or per-scenario breakdown, so treat it as a direction rather than a number you can plan a budget on.

The post is honest about the part it could not measure. A second mode writes boilerplate code straight to disk without the expensive model ever seeing the output, and Spotify says that case is harder to quantify because the comparison mixes input and output tokens.

The cost is latency

Each delegation adds 10 to 30 seconds, and Spotify's platform caps a single invocation at 30 seconds. So the saving is real but it is paid for in waiting. A long file that the agent needs in full is now a round trip through a second model, and a summary is lossy by definition.

For context on why anyone bothers, the post cites industry figures of 200 to 500 US dollars per developer per month in token costs, with some engineering leaders reporting over 2,000 dollars. Those are quoted benchmarks in the article rather than Spotify's own accounting.

One limit matters before anyone plans around this. The plugins call Spotify's Portal command line tool and need a Portal instance to work, so the code as published is not something an outside team can install and run. The idea underneath it does transfer: put a rule in front of the expensive model that decides which reads it is allowed to perform, and hand the rest to something cheaper.

That reframes where agent cost actually comes from. Teams tend to watch generated output, because that is the visible work. On a large codebase the agent spends most of its budget reading, and reading is the part that a smaller model can often do well enough. The decision worth making is not which frontier model to buy, but which files it is allowed to open at full price.

Source

Source: Spotify Engineering

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

More from AI News

Spotify open-sourced the Claude Code plugin that sends its big file reads to a cheaper model

Spotify published a Claude Code plugin that intercepts large file reads and routes them to a cheaper worker model, and says the mean saving on bulk reads was around 90 percent.

Productivity

HERO names the four ways coding agents pad work, and admits the fix only helps a little

HERO is an MIT-licensed set of nine rules that names four specific patterns of unnecessary work coding agents produce, and it has reached 404 stars while telling readers plainly that it helps rather than fixes.

Productivity

tokentab reads the session logs your coding agents already leave on disk and tells you what they cost

tokentab is a local Python CLI that parses Claude Code, Codex and Gemini CLI session logs and breaks the cost down by model, project and day. 588 stars in four days, MIT licensed.

Productivity