Spotify published a Claude Code plugin that blocks large file reads and sends them to a cheaper model

Image: Spotify Engineering
Why it mattersMost agent spending goes on reading files rather than thinking, so the cheapest fix is a hook that refuses the expensive read instead of a prompt asking the model to behave.
Spotify Engineering published a post on 3 September describing a Claude Code plugin, called shunt, that stops the agent from reading large files itself and sends that work to a cheaper model instead. The author, principal product manager Dimitri Mazmanov, reports mean savings of around 90 percent on bulk reads when tested against a Java monorepo across four scenarios.
The argument behind it is that most of what a coding agent does is input and output rather than reasoning. Reading five files to answer a question about one method, or generating a test file that copies the pattern of the twenty test files beside it. Spotify's post says a quarter of engineering leaders already spend between $200 and $500 per developer per month on tokens, and that some are past $2,000. Those are Spotify's figures, quoted without a source in the post.
The rule moved from the prompt into a hook
The interesting design choice is where the rule lives. Spotify says the first version was a block of routing rules written into CLAUDE.md, and that it only sort of worked: the rules were advisory, the model could ignore them, and every project needed its own copy.
The current version registers two hooks that fire before the agent's tool calls. One blocks any read of a file longer than a configurable threshold, 350 lines by default, and tells the model to delegate instead. The other catches the same thing arriving through shell commands. Targeted reads with an offset pass through untouched, because the agent already knows which section it wants. The delegated work runs on Gemini 2.5 Flash in Spotify's examples, though the post says the model field accepts anything configured in a given Portal instance.
Spotify names three things it does not fix
The post is unusually direct about the limits, which is what makes the number worth reading. Editing cannot be delegated, because the worker model's summaries do not carry reliable line numbers. Reasoning cannot be delegated either: Spotify says the worker found surface-level patterns but missed a thread-safety bug that Claude caught in seconds once given the right context. Debugging, architectural decisions and safety-critical code are excluded from the routing on purpose.
Latency is the third limit, and it sets the floor on the whole idea. Each delegation is a network round trip, responses typically take 10 to 30 seconds, and Portal caps a single invocation at 30 seconds. Below the line threshold the overhead costs more than the delegation saves, which is why the threshold exists at all.
The lesson generalises past this one plugin. A team trying to control agent spending usually starts by writing rules into a context file and hoping the model follows them. Spotify tried that first and moved the rule down into a hook, where the model has no choice. That is the difference between a policy and a control, and it costs nothing to apply to whatever agent a team already runs. The savings figure here is Spotify's own, measured on Spotify's monorepo, so treat it as a direction rather than a number you will reproduce. The mechanism transfers even if the percentage does not.
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.
