---
title: "Spotify's Trick That Cut Token Usage 90%"
url: https://nativefirst.ai/blog/spotify-cut-claude-code-tokens-90/
description: "Spotify's Shunt plugin hooks every file read and sends big ones to a cheaper model. One engineer ran it on his own repos and it cost him more."
author: John Tan
category: "AI Economics"
published: 2026-11-11
updated: 2026-11-11
publisher: nativefirst.ai
format: Markdown copy of the web page at the url above, same text.
---

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

It blocks Claude from reading any file over 350 lines.

John Tan · November 11, 2026 · 5 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](https://github.com/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.**

*Chart: Two paths. Without the plugin a three thousand line file goes straight into Claude's context, filling it. With the plugin the file goes to a cheap worker model which returns a short summary, so Claude's context stays almost empty.*

*Chart: The same two paths, stacked.*

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.

**The install · Nov 11** Three lines. The third one is the whole subject of this post, and it is marked optional.

From the public repo, [spotify/portal-ai-plugins](https://github.com/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.**

*Chart: Token savings from the same plugin on four codebases. Spotify's big files save 82 to 94 percent. Spotify's monorepo averages 90 percent. Apache Commons Lang saves 76 and 87 percent. One engineer's own 78,000 line repositories fall below zero: the plugin cost more than not using it, and no figure was published.*

*Chart: The same four results, stacked.*

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](https://nativefirst.ai/blog/gpt-6-astra-costs-1-or-100/), and the same discipline behind [a team whose usage rose while its bill fell](https://nativefirst.ai/blog/notion-top-1-percent-bill-going-down/).

**Route reads, not reasoning.**

[John Tan ↗](https://www.linkedin.com/in/johntans/)

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

Sources

1 Portal by Spotify cut my Claude Code token usage by 90%, Spotify Engineering, 3 September 2026. [engineering.atspotify.com](https://engineering.atspotify.com/2026/9/portal-by-spotify-cut-my-claude-code-token-usage-by-90)

2 Spotify's 90% Trick, AI by Aakash, 10 November 2026. [aibyaakash.com](https://www.aibyaakash.com/p/spotifys-90-trick)

3 spotify/portal-ai-plugins on GitHub. [github.com](https://github.com/spotify/portal-ai-plugins)
