Dev tools

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

September 4, 2026 at 9:35 PM PT

Spotify Engineering header artwork for the article on Portal and Claude Code token usage

Image: Spotify Engineering

Why it mattersMost agent spend goes on reading files rather than reasoning, so routing bulk reads to a cheap model cuts cost without changing which model makes the decisions.

Spotify published a Claude Code plugin called shunt on 3 September that stops the agent reading large files itself and hands that work to a cheaper model instead. Dimitri Mazmanov, a principal product manager at Spotify, writes that mean bulk-read savings in his testing were "around a whopping 90%". The code is in the spotify/portal-ai-plugins repository under Apache-2.0.

The argument behind it is about where the money goes. Mazmanov writes that most of what a coding agent does for him is input and output rather than thinking: 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. He cites a quarter of engineering leaders already spending $200 to $500 per developer per month on tokens, with some well past $2,000.

How it intercepts the read

The plugin registers two PreToolUse hooks, which fire before Claude Code runs a tool. One checks every Read call and blocks it when the file is longer than a configurable line threshold, 350 lines by default, telling the agent to use a delegation skill instead. The other catches cat, head, tail, less and more on large files. Targeted reads with an offset and limit pass through, and so do piped commands, because those are already narrow.

Behind the hooks sit two agents that Spotify calls modes, running on its internal Portal platform. One summarises a set of files and answers a question about them. The other generates predictable code, such as tests or config stubs, from a spec and a reference file. Both use Gemini 2.5 Flash as the worker in the published examples, and the model is a configuration field rather than something baked in. Generated code goes straight to disk, so the expensive model never pays output tokens for it.

The limits are stated plainly

The post is unusually direct about what does not work, which is the most useful part of it. Editing cannot be delegated, because the worker's summaries do not carry reliable line numbers, so the agent still has to read the exact section before it changes anything. Reasoning cannot be delegated either: Mazmanov reports the worker model 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 on purpose.

Latency is the third cost. Each delegation is a network round trip, responses typically take 10 to 30 seconds, and Portal caps a single invocation at 30 seconds, so large generations have to be split. That is why the line threshold exists at all: below it, the round trip costs more than the tokens saved.

One thing to check before adopting it. The hooks and scripts are open, but the modes run on a Portal instance, and Portal is Spotify's own platform rather than something you can install alongside the plugin. The reusable idea is the interception point, not the hosting.

The measurement is the company's own, on a Java monorepo across four scenarios, and it compares tokens the agent would have consumed reading files directly against tokens spent on a summary. That is a fair thing to measure and a narrow one. The number that matters on your codebase depends on how much of your agent's context is currently filled by files it reads once and never uses again, which is a thing you can count today without installing anything.

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

Codenotch puts your Claude, Cursor and Codex usage limits on the edge of the screen

Codenotch is a macOS app that pins how much of each coding agent's session limit you have used to the edge of the screen, and it reached 196 stars within hours of being published.

Dev tools

Ponytail makes a coding agent check seven things before it writes any new code

Ponytail is an MIT-licensed rule set that makes a coding agent work through a seven-step ladder of cheaper options before it writes new code, and it has reached 127,785 stars on GitHub.

Dev tools

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

Spotify released a Claude Code plugin called shunt that intercepts reads of files over 350 lines and routes them to a cheaper worker model, and reports mean savings of around 90 percent on bulk reads across a Java monorepo.

Dev tools