· via Hacker News – Front Page (native)
Claude Code wastes 15–20% of tokens on agent status lines; Bun preload disables them
A gist on Hacker News says Claude Code resends each background agent's full transcript every 30 seconds to generate a status line, costing 15–20% of token spend — an 80-line Bun preload turns it off.

A gist by Flamerix AI that reached the Hacker News front page on 29 October 2026 documents a costly piece of hidden behaviour in Claude Code: roughly every 30 seconds, the tool sends each background agent's entire transcript back to that agent's model — usually Opus — just to generate a three-to-five-word status line. The author estimates the feature consumes 15–20% of token usage, and ships an 80-line preload script that disables it.
A status line that rivals the conversation in cost
According to the gist, the periodic summarisation only refreshes the agent's status in the agents panel; the generated text never enters the model's context or the user's conversation. The author writes that no setting turns the feature off, and that it has been enabled by default since version 2.1.232, released in August 2026.
The anomaly was first detected, the gist says, by DRIM in Claude Code's OpenTelemetry export, where requests carry a query_source label. Grouping claude_code.api_request events by that label showed agent_summary accounting for 16.4% of estimated spend in the week before the fix — more than the main conversation's 15.7% — plus 19.7% of all API requests, about one in five. Some 96% of that spend fell on Opus, and the ratio ran to roughly 9,000 input tokens per output token, since the full transcript is resent on every cycle. The author is careful about what these figures mean: they are Claude Code's own per-request cost estimates rather than invoices, and subscribers feel the loss as reduced rate-limit headroom rather than dollars. The gist also points to four independent measurements of 18–26% collected in issue #86879.
How the preload works
The fix, no-agent-summary.js, is loaded through Bun's --preload mechanism, set via the BUN_OPTIONS environment variable, so the Claude Code binary itself is never modified. The gist explains why a timer hook is the viable approach: the relevant module ships as precompiled Bun bytecode, so editing its JavaScript source inside the binary has no effect, and the API client bypasses a wrapped globalThis.fetch. But Function.prototype.toString still returns a callback's source text even when it runs from bytecode, so the script wraps setTimeout and setInterval, inspects each callback, and — when it finds a summarizer anchor such as the [AgentSummary] Timer fired log string — returns a dummy handle instead of arming the timer. Every other timer passes through untouched. The dummy delay is exactly 2³¹−1 milliseconds, because Node and Bun clamp larger values down to 1 ms and the timer would fire immediately.
Deploying and verifying it
Installation amounts to saving the script at a stable path, exporting BUN_OPTIONS with the preload flag, and restarting the daemon with claude daemon stop --any. The restart matters because the daemon, the pty host and pre-warmed background sessions inherit the environment of the client that first started the daemon, so one launched before the variable was set keeps spawning unhooked sessions. Headless invocations — claude -p, cron jobs, CI, editor integrations — need the variable too. A CC_AGENT_SUMMARY_MODE=pass option loads the hook but arms every timer anyway, acting as an A/B control: the summaries return, showing the effect is the hook's doing. The recommended verification is OpenTelemetry itself — query_source = agent_summary should stay at zero — since that is the only check that catches every failure mode.
The caveats
Testing covers Linux only, on versions 2.1.257 through 2.1.312; macOS and Windows are untested, and on Windows the hook most likely never installs. The design fails open: if an update renames the anchor string, wraps the callback in fn.bind, moves the strings to a shared constant, or switches to an unwrapped timer API, the script matches nothing and the summaries quietly return, so re-verification is needed after every update. The author reports daily use since 26 October on version 2.1.301 with zero agent_summary requests and no side query growing to take their place; subagents, background agents, forked skills and background sessions behave normally. The visible trade-offs: the per-agent status line stops updating, SDK task_progress loses its summary, and claude --version slows from roughly 10 ms to 17 ms in a single measurement.
Why it matters
Autonomous coding agents are pitched as economical automation, but this episode shows that invisible housekeeping calls can cost more than the work itself — here, telemetry indicated a status widget outspent the user's actual conversation. Until Anthropic ships an official switch, agent-heavy users face a choice between a panel nicety and a fifth of their budget. The technique also travels: preload hooks give users a way to observe and reshape behaviour inside closed, bytecode-shipped CLI tools without touching the binary — a fragile lever that breaks silently, which is exactly why the gist leans on verifiable telemetry rather than trust.
- #claude-code
- #ai-agents
- #bun
- #token-efficiency
- #opentelemetry