Productivity

Spotify moved file reading off Claude Code to a cheap model and measured about 90 percent fewer tokens

September 4, 2026 at 8:05 PM PT

Spotify Engineering illustration for the Portal delegation article

Image: Spotify Engineering

Why it mattersMost agent spend goes on reading and generating predictable text rather than reasoning, so routing that work to a small model cuts the bill without touching answer quality.

Spotify published an engineering post on 3 September describing a Claude Code plugin called shunt, which stops the agent from reading large files itself and hands that work to a cheaper model. Dimitri Mazmanov, a principal product manager at the company, writes that the mean saving across the bulk-read tests was around 90 percent of tokens.

The argument behind it is that most of what a coding agent does is not thinking. It reads five files to answer a question about one method, or writes a test file that copies the pattern of the twenty test files beside it. Spotify says that work goes to a frontier model that is heavily overqualified for it.

How the blocking works

The plugin registers hooks that fire before the agent runs a tool. One watches every file read and blocks it when the file is longer than a configurable line count, defaulting to 350 lines, telling the agent to delegate instead. A second catches the same thing arriving through shell commands. Targeted reads with an offset and a limit pass through untouched, because the agent already knows which section it wants.

The delegated work goes to what Spotify calls modes, which are declarative agents defined by instructions, a model choice and a few parameters, running on an ephemeral runtime the company compares to AWS Lambda. Two are published: one summarises files against a question, one generates code from a spec and a reference file. Both use Gemini 2.5 Flash as the worker in the examples, and the company says any configured model works.

Generated code goes straight to disk, so the expensive model never sees it and never pays output tokens for it.

The limits Spotify states itself

The post is unusually direct about what fails. Editing cannot be delegated, because the worker's summaries do not carry reliable line numbers, so the agent still has to read a section directly before changing it. Reasoning cannot be delegated either: Spotify writes that the worker found surface patterns but missed a thread-safety bug that Claude caught in seconds once given the context, and the routing therefore excludes debugging, architecture decisions and safety-critical code.

Latency is the other cost. Each delegation is a network round trip, responses typically take 10 to 30 seconds, and a single invocation is capped at 30 seconds, so large generations have to be split. Below the line threshold the delay costs more than the tokens saved, which is why the threshold exists at all.

The context number Spotify gives for why any of this matters: it says a quarter of engineering leaders already spend 200 to 500 dollars per developer per month on tokens, and some are well past 2,000. That figure is Spotify's own framing and the post does not name a study behind it.

The interesting part is the shape of the fix rather than the saving. Spotify did not make the agent smarter about what to read, it made reading a thing the agent is not allowed to do cheaply and left the decision to a hook. That is enforcement rather than instruction, and the post says the earlier version, a set of routing rules written into the project's agent instructions file, was ignored often enough to be useless. Any team writing guidance into a markdown file and hoping the model follows it is running the version Spotify already abandoned.

Source

Portal by Spotify cut my Claude Code token usage by 90%, Spotify Engineering, 3 September 2026.

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 routed bulk file reads away from Claude Code and reports about 90% fewer tokens

Spotify published a Claude Code plugin called shunt that intercepts large file reads and hands them to a cheaper model, and reports mean savings of about 90% on those reads.

Dev tools

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

Spotify's Claude Code plugin blocks big file reads and sends them to a cheap model instead

Spotify published a Claude Code plugin that intercepts reads of files over 350 lines and routes them to a cheaper worker model, reporting mean savings of around 90 percent on bulk reads in its own tests.

Productivity