---
name: al-635-stop-burning-frontier-tokens-on-large-file-reads-hook-you
description: "Spotify Engineering (Sep 3, 2026) published how Dimitri Mazmanov cut Claude Code token use on large reads by about 90% with Portal AiKA modes and a Claude Code plugin called shunt. PreToolUse hooks block full reads (and bash cat/head/tail) of files over a configurable line threshold (default 350) and redirect to a bulk-reader mode on a cheaper worker model (example: Gemini 2.5 Flash) that returns concise structured bullets. A code-writer mode can scaffold tests/config from a reference file so Claude never ingests the generated output. Targeted offset/limit reads still pass for edits. They warn: don’t delegate debugging or safety-critical reasoning; latency is 10–30s per call. Install steps use the spotify/portal-ai-plugins marketplace; confirm Portal access before relying on it. Use when the user wants help with cheap-model shunt for large file reads (coding) for a small business."
---

# Stop burning frontier tokens on large file reads: hook your coding agent so files over a line limit go to a cheaper bulk-reader worker that returns structured bullets—keep the expensive model for edits and real reasoning

Spotify Engineering (Sep 3, 2026) published how Dimitri Mazmanov cut Claude Code token use on large reads by about 90% with Portal AiKA modes and a Claude Code plugin called shunt. PreToolUse hooks block full reads (and bash cat/head/tail) of files over a configurable line threshold (default 350) and redirect to a bulk-reader mode on a cheaper worker model (example: Gemini 2.5 Flash) that returns concise structured bullets. A code-writer mode can scaffold tests/config from a reference file so Claude never ingests the generated output. Targeted offset/limit reads still pass for edits. They warn: don’t delegate debugging or safety-critical reasoning; latency is 10–30s per call. Install steps use the spotify/portal-ai-plugins marketplace; confirm Portal access before relying on it.

## Inputs to collect first
Ask the user for anything below that they haven't already given you. Don't guess missing facts.

- The material the task is about (pasted text, notes or data)

## Instructions

Do the task below with the user's inputs in place of each [bracket].

1. Measure last week’s coding-agent spend and note how often it fully reads files over ~350 lines.
2. Add a pre-read hook (or standing rule) that blocks full reads of large files and instead calls a cheaper worker with: the file(s), your question, and “structured bullets only, lead with exact names/line numbers.”
3. Keep offset/limit and grep-style reads on the main agent so it can still edit precise sections.
4. Optionally add a boilerplate writer that takes a spec + one reference file and writes tests/config to disk without pasting the whole output into the main chat.
5. Compare tokens and answer quality on the same multi-file question before and after for a few days; raise the line threshold if small-file latency isn’t worth it.

## Safety checks (share these with the user)

- Check names, dates, numbers and any claim against your own source material before you use the answer. AI can misread or invent details.
- Say clearly which parts need a person to review or approve before anything is sent, paid, posted or filed.

## About this skill

- Works with: Claude Code (hooks/plugins), Spotify Portal AiKA modes / shunt plugin (or any cheaper worker model + CLI), optional Gemini Flash
- Based on this real-world example: https://engineering.atspotify.com/2026/09/portal-by-spotify-cut-my-claude-code-token-usage-by-90
- Free prompt from AgentPlaybook Real Estate: https://agentic-library.netlify.app/prompt/al-635-stop-burning-frontier-tokens-on-large-file-reads-hook-your-c/
- To install in an agent that supports Agent Skills, save this file as SKILL.md in a folder with the same name as `name` above (for example in your skills directory). Install steps for Claude.ai, Claude Code, Cursor and Codex: https://agentic-library.netlify.app/skills/
