Spotify routes bulk file reads away from Claude Code and reports 90% fewer tokens

Image: Spotify Engineering
Why it mattersMost agent token spend is file reading, not reasoning, so the cheapest saving available is routing reads to a smaller model before touching your prompts.
Spotify Engineering published a post on 3 September describing how it cut token use in Claude Code by moving file reading and boilerplate writing to a cheaper model. Dimitri Mazmanov, a principal product manager at Spotify, wrote it. The post reached 184 points on Hacker News.
The starting observation is about where the money goes. Mazmanov writes that most of what a coding agent does "isn't thinking. It's I/O", and gives examples: reading five files to answer a question about one method, generating a test file that matches the twenty test files beside it. Those calls go to a frontier model that he describes as "wildly overqualified" for them.
Two workers and a blocking hook
The setup uses what Spotify calls AiKA Modes inside Portal, its internal platform. A mode is a declarative agent with instructions, a chosen model and attached tools, running on an ephemeral runtime. Two of them do the work. A bulk-reader mode takes several files and a question and returns structured bullets. A code-writer mode takes a spec plus a reference file and produces code that matches the existing patterns, writing it straight to disk so the agent never holds the output in its context.
The interesting part is how the routing is enforced. An earlier version put the rules in CLAUDE.md, which Mazmanov says "sort of worked" because the rules were advisory and the agent could ignore them. The current version is a Claude Code plugin called shunt that registers hooks firing before every tool call. When a read exceeds a line threshold, default 350, the hook blocks it and points the agent at the delegation skill instead. Targeted reads with an offset pass through untouched.
The numbers, and who measured them
Spotify says the mean saving on bulk reads was around 90%, measured across four scenarios against a Java monorepo. That figure is Spotify's own, from Spotify's own harness, so treat it as their result rather than an independent benchmark. The post also cites an expectation that AI coding costs will pass the average developer salary by 2028, and says a quarter of engineering leaders already spend between $200 and $500 per developer per month on tokens, with some past $2,000.
The limits are stated as plainly as the wins, which is the part worth copying. Editing cannot be delegated, because the worker's summaries lack reliable line numbers. Reasoning cannot either: the worker found surface patterns but missed a thread-safety bug that the frontier model caught once given the right context. Each delegation is a network round trip taking 10 to 30 seconds, and Portal caps a single invocation at 30 seconds, so the line threshold exists because delegation costs more than it saves on small files.
Portal itself is internal to Spotify, so nobody outside can run this as described. The shunt plugin is published at spotify/portal-ai-plugins, which is Apache-2.0 and was created on 23 July, but it calls the Portal CLI and needs a Portal instance behind it. The transferable part is the shape: a pre-tool-use hook that refuses an expensive call and names a cheaper path, rather than instructions in a prompt file that the agent may or may not follow. Any team measuring its own agent spend can check the same split first, how much of it is reading versus reasoning, before rewriting anything.
Source
Portal by Spotify cut my Claude Code token usage by 90%, Spotify Engineering
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.
