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

Image: Spotify Engineering
Why it mattersMost agent spend goes on reading and generating rather than reasoning, so the cheapest change is deciding which model does which, enforced by a hook instead of a written instruction.
Spotify Engineering published a piece on 3 September describing a Claude Code plugin, called shunt, that stops the agent from reading large files itself and hands that work to a cheaper model. Written by Dimitri Mazmanov, a principal product manager at the company, it reports mean savings of around 90 percent on bulk reads measured against a Java monorepo.
The argument behind it is that most of what a coding agent does is input and output rather than thinking. Reading five files to answer a question about one method, or writing a test file that copies the pattern of the twenty next to it, spends a lot of tokens on almost no reasoning, and all of it goes to a frontier model.
How the interception works
The plugin registers two hooks that fire before a tool call. One watches every Read call: if the file is longer than a configurable line threshold, 350 by default, the hook blocks the read and points the agent at a delegation skill instead. The second catches the same thing arriving through shell commands. Targeted reads with an offset and limit pass through, because the agent already knows which part it needs.
Spotify says the first version of this was a set of routing rules written into a project instruction file, and that it half worked. The rules were advisory, so the model could ignore them, and every project needed its own copy. The hook is what makes the routing hold.
What Spotify measured, and what it says does not work
The company tested four scenarios against a Java monorepo, comparing the tokens the agent would spend reading files directly against the tokens spent consuming a summary from the cheap worker. That is where the roughly 90 percent mean figure comes from. These are Spotify's own numbers on its own codebase, and the article says the code-generation half is harder to measure because the generated file goes straight to disk and never enters the agent's context.
The limits are stated plainly, which is the more useful part. Editing cannot be delegated, because the worker's summaries carry no reliable line numbers. Reasoning cannot be delegated either: in testing the cheap model found surface patterns but missed a thread-safety bug that the frontier model caught once given the right context. Debugging, architectural decisions and safety-critical code are excluded from routing on purpose.
Latency is the cost. Every delegation is a network round trip, responses usually take 10 to 30 seconds, and a single call is capped at 30 seconds, so large generations have to be split. Below the line threshold the delay is worth more than the tokens saved, which is why the threshold exists at all.
The saving only appears if a team is spending enough for it to matter. Spotify cites an expectation that AI coding costs pass the average developer salary by 2028, and says a quarter of engineering leaders already spend 200 to 500 dollars per developer per month on tokens, with some past 2,000. Those are figures the company quotes rather than measures.
The wider point survives the specific plugin, which is tied to Spotify's own Portal product and its worker modes. Deciding which model handles which class of work is a routing question, and a hook that blocks the expensive path is stronger than an instruction asking the agent not to take it.
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.
Get AI News in your inbox
New developer tools, model and agent releases, and how teams are actually shipping with them. Short, and only when there is something worth reading.
