Large Models Finally Get an Intern: Spotify Cuts Claude Code Token Usage by 90%
Large models finally have an intern. A Spotify engineer released a Claude Code setup that cuts token usage by 90%. The trick is to give the main model two cheap assistants—one to read files, one to write boilerplate code—and then forcibly ensure the main model never touches grunt work. But interns miss bugs too, and the final call still has to come from the large model.
Spotify Engineering blog published a solution that cuts Claude Code token usage by 90%. The author is Principal Product Manager Dimitri Mazmanov; original title: Portal by Spotify cut my Claude Code token usage by 90%.

Claude Code is Anthropic's command-line coding assistant, and tokens are its billing unit. The cost of AI coding is spiraling out of control. Gartner predicts that by 2028 AI coding costs will exceed the average developer salary. One in four engineering leaders burns $200–$500 per developer per month on tokens, and some exceed $2,000.
But Spotify engineers believe most token consumption goes to work that doesn't require thinking.
Reading five files just to answer a question about one method. Generating a test file patterned after the twenty test files next to it. Feeding this kind of work to a frontier model is pure waste. So they split these tasks out and handed them to two cheap assistants running on Portal's AiKA Modes.
bulk-reader: reads files and returns a structured summary. The instructions require bullet-only output: no greetings, no preamble, and each bullet includes the file name, type, or line number.
code-writer: writes repetitive code according to reference files and saves it directly to disk. The instructions require code-only output: no explanation, no markdown fence.
Both modes use Gemini 2.5 Flash as the worker, with temperature set to 0.2. No new subscription, no platform team needed.
The key is enforcement.
The first version of the routing rules was written in CLAUDE.md, and the model could ignore it. So they wrote a Claude Code plugin called shunt, with a three-layer structure:
Hooks: A PreToolUse hook fires before every tool call. For files over 350 lines, read operations are blocked outright and redirected to bulk-reader. cat, head, tail, less, and more are also blocked; piped commands are allowed through.
Scripts: Two bash scripts wrap Portal CLI calls. bulk-read wraps the file in XML tags and sends it with the question to the worker. code-write sends the spec and reference files to the worker, strips markdown fences, and writes directly to disk.
Skills: Two skill files tell Claude when to call the scripts. Even if Claude doesn't read the skill descriptions, the hook still blocks it. Skills just make the handoff smoother.
Benchmarks were run on a Java monorepo across four scenarios; bulk-read saves an average of 90% tokens. The code-write scenario is even more extreme: Claude neither reads the reference files nor outputs tokens, and the code lands directly on disk.
The boundaries are also clear: there are three things it can't do.
Editing can't be delegated. The worker's summary doesn't have reliable line numbers, so when Claude needs to modify code, it still has to read the relevant sections itself.
Reasoning can't be delegated. The worker can find surface-level patterns, but during testing it missed a thread-safety bug that Claude spotted within seconds once it had the context. The routing rules explicitly exclude debugging, architecture decisions, and security-critical code.
Latency is a hidden cost. Every delegation takes a network round trip, 10–30 seconds, and a single Portal call is capped at 30 seconds. Small files aren't worth this path; the 350-line threshold exists for exactly this purpose.
One commenter said large models finally have an intern. The metaphor is accurate. Interns do grunt work, but important decisions still have to be made yourself. The missed bug is the price.
The real value of this approach is that it turns model routing from a systems engineering problem into a configuration problem. The plugin decides when to split the work, and the mode decides how to do the work. Swapping models, changing instructions, or connecting external tools requires no changes to the plugin. The balance point between saving tokens and maintaining quality is something you have to figure out yourself.
发布时间: 2026-11-22 05:56