news

Claude Code Was Burning Tokens Until I Put a Gate in Front of It | HackerNoon

Prateek Kapoor wrapped Claude Code in a PreToolUse hook that rejects unbounded greps and whole-file reads, hands the agent a corrected command, and reports 75% to 80% lower token use on heavy editing tasks.

Published 2026-07-26Source: HackerNoon
HackerNoon source artwork

Why it matters

Most token advice is prompt advice, and prompts decay as a session drifts. A hook sits underneath the model where it cannot be forgotten mid-session, which makes the tool call, not the system prompt, the cheapest place to enforce spend.

Tokenmaxxing read

The saving compounds: a blocked 2,000-line read is one you never re-send on any later turn. But his ROI script is an estimate rather than a meter, priced at $3.00 per million input tokens on Claude 3.5 Sonnet rates, so treat 75 to 80% as a claim, not a measurement.

Source takeaway

His rule for the gate: never just refuse. A bare denial sends the agent guessing and burns more than the original mistake, so the script returns a rewritten command along with the block.

Topic links

tokenmaxxingcoding-agentstopicagentstopicscoreboards
Related projects

Tools that match this angle

#4In spirit
Agents

LangGraph

langchain-ai/langgraph

A framework for building resilient stateful agents with explicit graphs, persistence, human-in-the-loop flows, and controllable execution.

39.6K6.6KMIT
agentsstateworkflows
#5Direct
Evaluation

promptfoo

promptfoo/promptfoo

A CLI and CI workflow for testing prompts, agents, and RAG systems across models, with evals and red-team style checks.

24.2K2.2KMIT
prompt-evalscirag
#6In spirit
Evaluation

DSPy

stanfordnlp/dspy

A framework for programming and optimizing language-model pipelines rather than hand-tuning one prompt at a time.

37.2K3.2KMIT
optimizationprogrammingevals
Related feed

More source-linked context

CNX Software - Embedded Systems News source artwork
newsCS
news

Token Monitor - An ESP32-S3 desktop display that tracks AI coding assistant usage (Crowdfunding) - CNX Software

Fractal Manifold is crowdfunding Token Monitor, a EUR 99 ESP32-S3 desk display with a 4-inch touchscreen that shows quota use, session limits, reset timers and estimated token costs for Claude Code, Codex CLI and Antigravity CLI.

tokenmaxxingcoding-agentsagents
Read note
theclimatebrink.com source artwork
newsT
news

The real energy use of agentic AI

Climate scientist Zeke Hausfather metered his own Claude Code habit: 1,138 typed prompts fanned out to more than 14,000 model calls and 3.2 billion tokens in eight weeks, drawing roughly 170 kWh of data-center electricity.

tokenmaxxingcoding-agentsagents
Read note
Anthropic source artwork
newsA
news

Introducing Claude Opus 5

Anthropic shipped Claude Opus 5 on July 24 priced level with Opus 4.8, pitching near-Fable 5 intelligence at half the price. Its own Frontier-Bench v0.1 figures show more than double the predecessor's score, and cheaper per task.

tokenmaxxingcoding-agentsagents
Read note