Portal by Spotify cut my Claude Code token usage by 90%

Dimitri Mazmanov ยท article ยท 2026-09-03 source โ†— Reader ๐Ÿ–ฅ๏ธ

Agent HarnessAI Unit EconomicsClaude CodeContext EngineeringDelegated Editing & Document CorruptionHooksModel RoutingToken Efficiency
Because most of what a coding agent does is I/O rather than reasoning, routing that I/O-bound work (bulk file reads, pattern-following boilerplate generation) to a cheap worker model โ€” and enforcing that routing deterministically via harness-level hooks rather than relying on advisory instructions the model can ignore โ€” cuts Claude Code's token spend by around 90% on the delegated work while reserving the frontier model for editing, debugging, and anything safety-critical.

practical ยท mixed โ€” A personal engineering report structured as a how-to: it opens with a narrative problem statement, argues a general thesis (I/O work should be routed off the frontier model), documents a concrete mechanism (Portal AiKA Modes + a three-layer Claude Code plugin called shunt), cites benchmark evidence, and closes with install instructions. The propositions are ultimately in service of 'you should route I/O work to a cheap worker model and enforce it with hooks,' not a claim about what is true in general.

Structure

PartRole
Opening problem framing: 'most of what an AI coding agent does isn't thinking, it's I/O,' plus industry cost trend data (Gartner 2028 projection, $200-2000/dev/month survey figures).motivation and stakes
Two modes defined: bulk-reader (read + answer concisely) and code-writer (generate code matching existing patterns, output-only), both declarative Portal AiKA Modes running on Gemini 2.5 Flash.solution definition
Routing architecture: Layer 1 (PreToolUse hooks that block large reads/cats), Layer 2 (bash scripts wrapping the Portal CLI), Layer 3 (skill files telling Claude when/how to call the scripts) โ€” replacing an earlier, advisory CLAUDE.md-based version.mechanism / evidence for how enforcement actually works
Benchmark section: four scenarios on a Java monorepo, ~90% mean token savings on bulk-read; code-write savings harder to quantify but qualitatively described.evidence
'What doesn't work': can't delegate editing (no reliable line numbers), can't delegate reasoning (missed a thread-safety bug), latency adds up (10-30s round trip, 30s cap).scope boundary / qualification
Generalization: modes are reusable, shareable, composable, and decouple the routing decision (plugin) from the response (mode) โ€” reframed as 'model routing turned from a systems engineering problem into a configuration problem.'conclusion / broader claim
Try-it-yourself install steps (marketplace plugin install, /portal:setup).call to action

Key terms

Propositions

Arguments

Coding-agent token spend can be cut by roughly 90% on I/O-heavy tasks without sacrificing output quality where it matters. strength: medium
Explicit premises:
Implicit premises:
Inferences:
Routing decisions must be enforced by the harness (deterministic hooks), not left to the model to self-apply from written instructions. strength: high
Explicit premises:
Implicit premises:
Inferences:

Narratives

Questions addressed

Gaps

Closes gaps elsewhere

Related documents