Portal by Spotify AiKA Modes cut Claude Code tokens 90%
Engineering post from Spotify published on September 3, 2026 on engineering.atspotify.com (~1,600 words, nine sections, two YAML manifests, four command-line examples), authored by Dimitri Mazmanov, Principal Product Manager.
Dimitri Mazmanov, Principal Product Manager at Spotify, published on September 3, 2026 on the company's engineering blog an account of a setup that reportedly cuts his token consumption in Claude Code by 90%. His starting observation: most of what a coding agent does for him is not reasoning but I/O — reading five files to answer a question about a method, generating a test file identical to the twenty neighboring ones. This work is sent to an overqualified frontier model, when a cheap model would handle it just as well.
The solution relies on Portal by Spotify's AiKA Modes: declarative agents run on an ephemeral runtime, defined by instructions, a model, parameters, and MCP tools, with no infrastructure or API keys to manage. The author creates two public modes running on Gemini 2.5 Flash. The first, bulk-reader, reads a batch of files and responds in structured bullet points. The second, code-writer, generates code from a specification and a reference file whose conventions it must reproduce.
Most of what an AI coding agent does for me isn't thinking. It's I/O
— Dimitri Mazmanov , engineering.atspotify.com
Routing is handled by a Claude Code plugin called shunt, after the failure of a first version based on rules written in CLAUDE.md, which the model could ignore and which had to be copied into each project. The plugin stacks three layers. PreToolUse hooks block file reads beyond a configurable line threshold, as well as cat, head, or tail commands on large files; targeted reads pass through. Bash scripts wrap calls to the Portal CLI, build the request, and report back token usage. Skill files tell Claude when and how to call these scripts. The corpus moves to the secondary model without ever entering Claude's context, which also never sees the generated code, written directly to disk.
The measurements are presented as an average saving of about 90% across four scenarios tested against a Java monorepo, with the author acknowledging that the generation scenario is hard to measure. One section details what doesn't work: editing is not delegable for lack of reliable line numbers, nor is reasoning — the secondary model missed a thread-safety bug that Claude spotted immediately — and each delegation costs ten to thirty seconds of latency, which makes it counterproductive on small files.
The author concludes that token savings are only a starting point: the real value of the modes is turning model routing into a configuration problem rather than a systems engineering one.
Key takeaways
The starting intuition is load-sharing, not prompt optimization. Reading files and generating repetitive code consumes tokens without requiring reasoning; these tasks go to a cheap model, while the primary model keeps the problems that require judgment.
What is saved is not just the price, it is context occupancy. The corpus that is read is sent to the secondary model and never enters Claude's window; a follow-up query on the same files therefore reloads nothing on the primary side. Same mechanism as the delegation to subagents in [[willison-fable-judgement-delegation-subagents-2026-07-03]].
A mode = a declarative agent. name, description, instructions, model, visibility, resourceLimits, tags. Ephemeral runtime, nothing stored server-side, no API key to manage. Resolution by name, case-insensitive, with precedence personal → team → public: forking a public mode is enough to override it with no configuration.
The rules in CLAUDE.md did not hold up. First version of the routing: a block of instructions that Claude read and sometimes followed. Two named flaws — advisory, not enforced, and having to be copied into each project. This is the argument that drives the move to hooks, hard gates independent of the model's decision.
The threshold is the central tuning parameter.check-file-size blocks Read calls beyond 350 lines by default; check-bash-read intercepts cat, head, tail, less, more. Targeted reads (offset/limit) and piped commands pass through. Below the threshold, delegation latency costs more than it saves.
Graceful degradation is the architectural point. Three layers: the hook blocks, the script executes, the skill explains. If Claude ignores the skill, the hook still blocks — the contract is not entrusted to the model.
Two mode instructions do most of the work.Output only the code avoids markdown fences and prose that the primary model would have to re-parse; a mandatory reference file for code-writer avoids out-of-context code. Same framing logic as the skills described in [[shihipar-claude-code-lessons-building-skills-2026-06-03]].
⚠️ The headline figure is self-reported and not reproducible as stated: an average across four scenarios on a Java monorepo, with no protocol, no absolute volumes, no comparison to a primary model used with targeted reads. The author admits that the code-write scenario is harder to measure, and the cost of the secondary model is not subtracted.
The three claimed limitations frame the scope. no delegated editing (summary line numbers unreliable), no delegated reasoning (debugging, architecture decisions, and critical code explicitly excluded from routing), 10 to 30 s of latency per round trip, with a 30 s Portal cap that forces large generations to be split.
The operational conclusion is about the modes, not the plugin. reusable across projects, shareable (both modes are public), composable (doc-writer, reviewer, translator cited as possible extensions), and decoupled from routing — changing the working model does not change the plugin. This packaging/execution separation is the one formalized by [[google-agent-plugins-packaging-skills-mcp-2026-08-06]].
Installation.claude plugin marketplace add spotify/portal-ai-plugins, then the portal (the CLI) and shunt (routing) plugins, then /portal:setup for authentication against a Portal instance. The setup therefore assumes a Portal instance with the AiKA plugin enabled — it is not transferable as-is outside an organization that runs it.
The framing figures come from outside the post and are unsourced. AI coding costs exceeding the average developer salary by 2028, a quarter of engineering leaders at $200-500 per developer per month, some above $2,000. To be treated as an order of magnitude, worth comparing against the per-team measurements in [[patel-block-buzz-teams-tokens-benchmarks-2026-08-06]].
Key figures
10 to 30 seconds of latency per delegation, 30-second Portal cap