Spotify engineer's Claude Code hook cuts token spend 90% by rerouting big file reads to Gemini
RexDouglass · x · 2026-09-07
A Spotify engineer built a Claude Code plugin that blocks large file reads at the hook layer and reroutes them to a cheap Gemini worker instead of Claude, measuring a 90% drop in token spend on one Java monorepo.
Key lesson: his first version put routing advice in CLAUDE.md, which Claude simply ignored. The hook works because it doesn't ask — it blocks. The pattern of enforcing behavior via hooks rather than instructions applies broadly to coding-agent cost optimization.
Related event: Spotify's Shunt Cuts Claude Code Token Costs by ~90% via Model Routing(6 posts)→
More from coding & agent
- SurfSense: an open-source local NotebookLM with MCP agents and a prompt-caching lesson — FurtiveMirth · 2026-10-23
- procedural-memory: let agents replay saved tool-call sequences instead of re-solving tasks — Sad-Response1560 · 2026-10-23
- Med student seeking whole-library book search: Cognee's graph memory beats plain RAG so far — shrike293103 · 2026-10-23
- Dev demos AI models handling 3D objects and animations surprisingly well — chongdashu · 2026-10-23
- Jason Kneen burns 104.56B tokens and $24.7K in 304 days of AI coding on Codex and Claude Code — jasonkneen · 2026-10-23
- Typosquatted Blender MCP Repo Hit 958 Stars in Days and Silently Ran Malware — Promptmethus · 2026-10-23