The PlaybookAI Economics

Spotify's Trick That Cut Claude Code Token Usage by 90%

It blocks Claude from reading any file over 350 lines.

John TanNovember 11, 20265 min read

Spotify published a plugin that stops Claude Code from reading your files. Not throttles. Blocks. Two hooks sit in front of every read, and if a file is longer than 350 lines the read does not happen.

Dimitri Mazmanov, a principal product manager at Spotify, reported the result on the company's engineering blog on 3 September: mean savings of around 90% on bulk reads across a Java monorepo. The plugin is called Shunt and it is open, inside spotify/portal-ai-plugins, which now has about 3,200 stars.

The number is real and the mechanism is simple. Whether it does anything for you is a different question, and it has an answer further down that is worth more than the 90%.

What it actually does

The argument underneath is that most of what an agent spends is not thinking. It is carrying. Reading forty files to answer one narrow question, or generating boilerplate that already exists three directories over. That traffic is input and output, not reasoning, and it is billed the same as reasoning.

So Shunt moves the carrying somewhere cheaper. A worker model reads the files and hands back a structured summary, and the raw file contents never enter Claude's context at all. For generated code the output goes straight to disk, and Claude never sees that either.

Figure 1. Where the tokens go
The file is read. Claude just never sees it.
WITHOUT SHUNT auth.go 3,000 lines Claude's context full file, billed WITH SHUNT auth.go 3,000 lines worker model reads it instead Claude's context summary only Hooks enforce the detour, so it does not depend on the model choosing to delegate. WITHOUT SHUNT auth.go, 3,000 lines Claude's context Full file, billed WITH SHUNT auth.go, 3,000 lines Worker model reads it Claude's context summary only
Shunt's two PreToolUse hooks also block cat, head, tail, less and more on large files. Targeted reads with an offset and a limit still pass. Figure by nativefirst.
GitHub README for spotify slash portal-ai-plugins, showing three Claude Code install commands: adding the spotify/portal-ai-plugins marketplace, installing portal@portal, and installing shunt@portal, annotated as optional token-saving AiKA delegation
The install · Nov 11Three lines. The third one is the whole subject of this post, and it is marked optional.

From the public repo, spotify/portal-ai-plugins, captured 11 November 2026.

The enforcement is the design decision worth stealing. The routing is not a suggestion in a prompt that the model may follow when it feels like it. It is a hook that refuses the tool call. Spotify did not ask Claude to be frugal. They made the expensive path unavailable.

Then someone else ran it

Aakash Gupta tried the same plugin on his own repositories and published the numbers on 10 November. On Apache Commons Lang he measured cost cuts of 76% and 87%, in the same territory as Spotify. On his own repositories of about 78,000 lines, the hook cost him more than not using it.

That is the useful result, and it is the one the headline number buries. His own conclusion is the honest version: Spotify's 90% is real for teams whose Claude reads whole files.

Figure 2. The same plugin, four codebases
It is not a model result. It is a routing result.
Spotify, big files 82-94% Spotify, monorepo mean 90% Apache Commons Lang 76% and 87% His own 78K-line repos cost more, no figure published 0% 50% 100% Tokens saved. Left of the line is money lost. Spotify, big files 82-94% Spotify, monorepo mean 90% Apache Commons Lang 76%, 87% His own 78K-line repos cost more 0% 100% Left of the line is money lost.
Spotify's engineering blog, 3 September 2026, and Aakash Gupta, 10 November 2026. The hatched bar has a direction but no published figure.

What Spotify says it cannot do

The post is unusually clear about its own limits, which is why it is worth reading rather than repeating.

Editing cannot be delegated. Summaries do not carry reliable line numbers, so Claude still has to read the relevant section itself before changing it. That is why targeted reads with an offset and a limit are deliberately allowed through.

Reasoning cannot be delegated. The worker model missed a subtle thread-safety bug that Claude caught quickly. Debugging, architectural decisions and safety-critical code are kept off the routing path on purpose.

It is slower. Each delegation takes roughly 10 to 30 seconds, and an invocation is capped at 30 seconds, so a large generation has to be split. Small reads are slower delegated than done directly, which is the entire reason the 350-line threshold exists.

What to do with this

Do not install it and expect 90%. Measure your own read profile first, because that is the variable the result actually turns on. If your agent routinely swallows whole files to answer narrow questions, the ceiling is high. If it already reads in targeted slices, there is close to nothing to win and the extra hop will cost you.

The transferable idea is not the plugin. It is that the cheapest token is the one that never enters the context, and that you enforce it in a hook rather than request it in a prompt. It is the same lesson as a model that bills $1 or $100 per million tokens depending on one setting, and the same discipline behind a team whose usage rose while its bill fell.

Route reads, not reasoning.

Portrait of John Tan
John Tan ↗

Founder of nativefirst.ai. Runs everything on agents and writes down what works.

Sources
1Portal by Spotify cut my Claude Code token usage by 90%, Spotify Engineering, 3 September 2026. engineering.atspotify.com
2Spotify's 90% Trick, AI by Aakash, 10 November 2026. aibyaakash.com
3spotify/portal-ai-plugins on GitHub. github.com

Read next

AI is moving really fast. Keep up.

Read the Playbook