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.
More from coding & agent
- Turn Gemini's video analysis into an agent skill for Codex, Claude and more — iamrobotbear · 2026-09-07
- Cartwheel MCP lets Astra animate static Blender scenes, demo shows — andrew_n_carr · 2026-09-07
- Image-to-3D first, then GPT splits and rigs: a better Blender 3D workflow — dotey · 2026-09-07
- Benzi: a coding AI assistant that understands repos without reading source code — DonkeyTheKing · 2026-09-07
- A ready-to-use Kicad AI skills prompt that auto-reviews your BOM, part numbers and pin orientation — debreuil · 2026-09-07
- HF engineer trains Qwen3.5-9B with GRPO and GEPA to code Blender 3D rooms, GLM-5.3-Flash as judge — mervenoyann · 2026-09-07