Opens in a new tab

Independent WordPress hosting guides · Recommended host: Convesio

Start a free trial →

Cutting Agent Token Use with Hooks

Spotify open-sourced a hook that sends bulky file reads to a cheaper model, cutting one engineer's Claude Code usage by 90%. How hooks work and safe ways to use them on WordPress projects.
By Shahzad Hasan · November 18, 2026

In September 2026 Spotify open-sourced “shunt”, a Claude Code hook that intercepts heavy calls such as file reads over 350 lines and routes them to a cheaper model, while the main model keeps the reasoning and code writing. It cut one engineer’s own Claude Code token use by about 90%, which the newsletter stressed was one person’s result, not a general figure (Vibe Coding Weekly #48). Issue #48 repeated the stories of #47 the week before.

Figures and claims about other companies are as reported at the time and summarised by Vibe Coding Weekly; check the original announcement before relying on them.

What a hook is

A hook is a small script the agent runs automatically at a set moment, for example before a tool is used or after a file is edited. It can block an action, change it or add information.

Token-saving hooks for WordPress projects

  • Summarise big files: long theme files, logs or builder JSON get summarised before the main model sees them.
  • Trim output: cut long command output to the lines that matter.
  • Skip vendor folders: block reads of node_modules and third-party plugins.

Safety hooks worth adding too

  • Block commands that delete files or databases.
  • Block edits to wp-config or files containing secrets.
  • Run a quick check (PHP lint, a page load test) after every edit.

Cautions

  1. A summary can drop the one line that mattered. Allow the main model to ask for the full file.
  2. Read any third-party hook before installing it; it runs with your permissions.
  3. Measure before and after on your own work.

More in Extending your AI tools and What vibe coding really costs.

Source: Vibe Coding Weekly #48. This article is our own take for WordPress and Bricks builders; it does not reproduce the newsletter.

In this article

Need hosting that scales?

Convesio runs each site in Docker containers with auto scaling and load balancing built in.
Try Convesio free →
Affiliate link: we may earn a commission at no extra cost to you.