Productivity

Spotify blocks Claude Code from reading big files, and says the bulk reads got 90% cheaper

September 4, 2026 at 7:05 PM PT

The header illustration on Spotify's engineering post about Portal and Claude Code token usage

Image: Spotify Engineering

Why it mattersMost agent spend is reading, not thinking. Capping what the expensive model is allowed to read is a configuration change, and it needs no new model and no new agent.

Spotify published a post on 3 September describing a Claude Code plugin that stops the agent reading large files at all. Dimitri Mazmanov, a principal product manager at Spotify, wrote that mean bulk-read savings were around 90% when the approach was tested on a Java monorepo across four scenarios.

The mechanism is small enough to describe in a sentence. Claude Code fires hooks before every tool call. The plugin, called Shunt, registers two of them, and when a file is longer than a configurable line threshold, 350 lines by default, the hook blocks the read and tells Claude to use a different skill instead.

Where the work goes

That skill runs on Portal, Spotify's platform for what it calls AiKA Modes. Mazmanov describes a mode as "a declarative agent that runs on an ephemeral runtime," comparing it to AWS Lambda for agents: you write the instructions, choose a model, set parameters, and attach MCP tools.

Two public modes do the actual work. Bulk-reader covers the case where Claude would otherwise read several large files to answer one question, and returns a summary instead of the file contents. Code-writer handles output that follows from patterns already in the repository, which the post lists as tests, config scaffolding and type stubs. Both use Gemini 2.5 Flash as the worker model in the published examples.

So the expensive model never sees the file. It sees a summary produced by a cheaper one, and the 90% figure Spotify reports is the difference between those two amounts of text.

The limits are stated, which is the useful part

Mazmanov lists what the approach cannot do. Code editing does not delegate reliably, because the summaries drop line numbers. Reasoning and architectural decisions do not delegate at all. And the delegation is slow: responses typically take 10 to 30 seconds, and Portal caps a single invocation at 30 seconds, so handing off a small file costs more time than it saves in tokens.

That last constraint decides where the threshold should sit. Set it too low and every read becomes a half-minute round trip for no saving.

The plugin is open source in Spotify's portal-ai-plugins repository, which carries an Apache 2.0 licence and had 51 stars when checked. The two modes are described as usable without custom configuration.

Spotify's stated reason for building it is a forecast rather than a measurement: "By 2028, AI coding costs are expected to blow past the average developer's salary." Treat that as the company's framing. The 90% is Spotify's own number too, from Spotify's own repository, and the post gives no per-scenario breakdown behind the mean.

The idea underneath does not depend on either. An agent's bill is mostly the text it reads, and nothing forces the model doing the reasoning to also be the model doing the reading. A hook that refuses a read is a cheaper way to enforce that than asking the agent politely in a prompt, because a prompt is advice and a hook is a rule.

Source

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

Spotify's Claude Code plugin blocks big file reads and sends them to a cheap model instead

Spotify published a Claude Code plugin that intercepts reads of files over 350 lines and routes them to a cheaper worker model, reporting mean savings of around 90 percent on bulk reads in its own tests.

Productivity

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

Spotify open-sourced the Claude Code plugin that sends its big file reads to a cheaper model

Spotify published a Claude Code plugin that intercepts large file reads and routes them to a cheaper worker model, and says the mean saving on bulk reads was around 90 percent.

Productivity