Claude Code Spends ~16% of Your Tokens on a Status Line: How to Measure agent_summary and Turn It Off ✅ yoDEV Tested

Claude Code sends a background request called agent_summary that, according to independent developer telemetry, consumed 16.4 percent of all token spending and nearly 1 in every 5 API requests, just to update a status line of three to five words for each background agent. Every ~30 seconds, for each active agent, Claude Code resends that agent’s full transcript to its own model (usually Opus) and asks it to describe its last action. You can measure it on your own machine with OpenTelemetry, and an MIT-licensed Bun preload script, no-agent-summary.js, disables it.

Source: README and no-agent-summary.js script on GitHub Gist

:white_check_mark: yoDEV Tested · October 29, 2026
We tested no-agent-summary.js with Claude Code 2.1.312 on macOS 27.0.1 (Apple Silicon), a platform its author hasn’t tested, we reviewed the Linux x64 binaries for 2.1.312 and 2.1.308 in a sandbox and reproduced two installation failures on Bun 1.4.4. The results we report as ours come from that testing.

What is Claude Code and what are background agents?

Claude Code is Anthropic’s programming agent that works from the terminal: it reads your repository, executes commands, and edits files. It can delegate work to subagents and leave some running in the background (background agents) while you do something else. The agent panel shows, next to each one, a short line summarizing what it’s doing. That line is what costs.

What is agent_summary in Claude Code?

agent_summary is the query_source that Claude Code assigns to the request that writes that status text next to each background agent. The response never reaches the model or your conversation: it only updates that label.

According to the script author, Flamerix AI:

  • It’s enabled by default for background agents in interactive mode since 2.1.232 (August 2026).
  • The interval comes from a server flag, limited to between 30 and 240 seconds, and the default value is already the minimum of 30.
  • There’s no setting to turn it off. The SDK option agentProgressSummaries can turn it on but not off, and the undocumented variable CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES also only serves to activate it.
  • In 2.1.310 a cheaper “short” mode arrived, around 2,000 tokens of notes instead of the entire transcript, but it comes off and only server flags can change it.

All of this is the author’s reading of the packaged code, not Anthropic documentation.

How much does agent_summary add to Claude Code’s cost?

In one week of the author’s use, agent_summary cost more than the main conversation. The figures are self-reported, they come from their own OpenTelemetry export and they didn’t publish the raw data:

query_source = agent_summary Week before hook 2 days after
Share of Claude Code spending 16.4% (main conversation: 15.7%) 0%
Share of API requests 19.7% 0%
Of that spending, in Opus 96% —
Input tokens per output token ≈ 9,000 : 1 —

“Spending” here is Claude Code’s own per-request estimate (cost_usd), not a bill. If you’re on a subscription plan, what you lose is margin against your usage limits.

The author isn’t alone. Issue #86879 is an open request for an official way to disable the timer, and it brings together measurements of between 18 and 26 percent in different sessions, including one where agent_summary was 22.7 percent of requests. The cost grows with how many background agents you have and for how long, not with useful work, because each cycle resends the agent’s current context. A commentator in 2.1.276 calculated that an agent with ~380,000 tokens of context pays about 45 million cached tokens per hour just for its status line.

Prompt caching smooths it out, but doesn’t eliminate it: according to the author, almost all of these calls hit the cache, and the small fraction that miss carries over a third of the cost.

As of this note’s publication date, October 29, 2026, neither of the two issues had a response from Anthropic, and Anthropic had not publicly confirmed this behavior.

Why does Claude Code consume tokens in the background without you seeing it?

Because these requests aren’t written to the session transcripts that are saved to disk. Issue #104358 documents that background requests (agent_summary, compact, calls from the auto_mode classifier, and others) are charged but leave no row in those files, so any tool that sums transcripts comes up short. The person who reported it found totals between 1.35 and 2.13 times below Claude Code’s own cost status, across 14 sessions with many subagents.

OpenTelemetry export is the only place they show up.

How to see token consumption in Claude Code by request type?

Enable logs export of Claude Code’s OpenTelemetry and group claude_code.api_request events by query_source. According to the official Monitoring documentation, the detailed value of query_source (like repl_main_thread, compact, or a subagent’s name) lives in the api_request event. The claude_code.cost.usage and claude_code.token.usage metrics only carry a rough category (main, subagent, or auxiliary), so with metrics alone you can’t isolate agent_summary.

The minimal setup, according to the documentation:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
claude

Point the endpoint to the OTLP collector you already use and sum cost_usd (or token attributes) by query_source. If nothing comes through, the documentation recommends starting Claude Code with claude --debug-file <path> and looking for [3P telemetry] errors in that log.

A quick check without a collector: the author’s own method counts the lines [AgentSummary] Forking from a --debug-file log while a subagent runs in the background. If that line appears every ~30 seconds per agent, you’re paying for it.

If you also use Codex, we have the equivalent guide: How to see token consumption in Codex CLI.

How to disable agent_summary in Claude Code?

With no-agent-summary.js, a Bun preload of about 80 lines. Claude Code’s native binary is a compiled Bun program, and Bun reads extra options from the BUN_OPTIONS environment variable, so the script loads before Claude Code without modifying the binary.

The script wraps setTimeout and setInterval. When a timer’s callback code contains one of its two anchors, the log line [AgentSummary] Timer fired or the id agent_summary, it returns an inert timer instead of arming it. All other timers pass through unchanged.

:warning: Two rules the README doesn’t say. Write --preload=/path, not --preload /path: with a space, setting BUN_OPTIONS globally breaks all bun subcommands. And save the hook in a path without spaces, because BUN_OPTIONS can’t have them, quote it however you quote it. We reproduced both failures (see “What breaks when you install it?”, below). All commands here use the = form and the location the README suggests, ~/.local/share/.

For a single session (adapted from the README summary):

curl -fsSL https://gist.githubusercontent.com/flamerix-ai/c3905705cc4205e5de3011fa2e74efce/raw/no-agent-summary.js -o ~/.local/share/no-agent-summary.js
claude daemon stop --any
BUN_OPTIONS="${BUN_OPTIONS:+$BUN_OPTIONS }--preload=$HOME/.local/share/no-agent-summary.js" claude

Permanently, add this to ~/.profile, ~/.bashrc, or ~/.zshrc, with the absolute path:

export BUN_OPTIONS="${BUN_OPTIONS:+$BUN_OPTIONS }--preload=/absolute/path/no-agent-summary.js"

Then restart the daemon so background processes pick it up:

claude daemon stop --any

That restart matters. The daemon, pty host, and preheated bg-spare sessions inherit the environment from whatever started the daemon, so a daemon started before defining BUN_OPTIONS keeps creating sessions without the hook. Non-interactive runs (claude -p, cron, CI, editor integrations) also need the variable.

What changes: the status line for each agent in the panel stops updating. Subagents, background agents, forked skills, and background sessions keep working normally.

Can you do it without a patch?

Partially. The README indicates that CLAUDE_CODE_FORK_SUBAGENT=0 and CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 also stop the summaries, but only because they completely turn off forked subagents or background agents. The variable that’s often suggested, DISABLE_NON_ESSENTIAL_MODEL_CALLS, doesn’t even exist in the binary: we searched both versions we tested and it doesn’t appear once.

What breaks when you install it?

There are three different ways it can go wrong. We reproduced the first two ourselves.

1. A global BUN_OPTIONS with a space breaks Bun

A comment on the gist reported that BUN_OPTIONS="--preload /path" makes bun install, add, test, build, and x fail with Script not found "install" (and similar) on Bun 1.4.3. The cause is Bun’s argument parser: any flag with a value placed before the subcommand causes it; bun --define x:1 install fails the same way.

We reproduced it on Bun 1.4.4:

BUN_OPTIONS bun install bun test bun build bun x
--preload /path :cross_mark: Script not found "install" :cross_mark: :cross_mark: :cross_mark:
--preload=/path :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
undefined :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

With --preload=/path, the hook still loads in Claude Code 2.1.312 and 2.1.308. The fix costs nothing on Claude Code’s side. On macOS we saw the same thing with the standalone Bun 1.3.13.

The same commentator also restricted the script’s installation check to only act inside the Claude Code binary, so other compiled Bun binaries on the machine don’t see their timers wrapped. As published, the script only checks that it’s running inside some compiled Bun binary. We didn’t test that modification.

2. A space in the hook’s path prevents Claude Code from starting

Bun splits BUN_OPTIONS by spaces, so a path like ~/my tests/no-agent-summary.js splits in two. It happened to us on our first test on macOS, from a folder whose name had a space. Bun read the second half as a loose flag (error: Invalid Argument '-s'), and every command that defined BUN_OPTIONS, claude included, printed Bun’s help and exited.

Quoting doesn’t help. In the sandbox we tested the path as-is, in double quotes, in single quotes, and with spaces escaped with backslash. All four failed with preload not found, with the path cut at the first space. The hook file has to be in a path without spaces.

At least this failure is visible: Claude Code refuses to start, instead of running without the hook.

3. Any Claude Code update can silently undo it

The hook recognizes the summary timer by text inside its callback. If an update renames the log line or the id, takes those texts outside the callback, passes the callback through .bind(), or moves the timer to an API the script doesn’t wrap, the hook detects nothing and the summaries come back without warning. The author calls this “fail-open”.

That’s why it’s good to re-verify after each Claude Code update:

BUN_OPTIONS="--preload=$HOME/.local/share/no-agent-summary.js" CC_AGENT_SUMMARY_LOG=/tmp/nas.log claude --version && cat /tmp/nas.log

You should see preload active mode=off …. Then, with the same variables, let a subagent run in the background for a minute or two: the log should show summary timer #1 suppressed. If you export OpenTelemetry, keeping query_source = agent_summary at zero is the only check that catches all failure modes.

For an A/B test, CC_AGENT_SUMMARY_MODE=pass loads the hook but leaves all timers armed. The summaries come back, which proves it’s the off mode that eliminates them.

Also keep in mind:

  • Platform: the author only tested it on Linux. Our test, below, shows it works on macOS (Apple Silicon) with 2.1.312. On Windows, according to the author, the hook probably never installs.
  • Terms of service: the README warns that changing a running client’s behavior may conflict with the service terms you use it under, and leaves that check in your hands.

What did we test at yoDEV?

We ran two tests on October 29, 2026.

On macOS: does the hook really stop agent_summary?

Environment: Claude Code 2.1.312, the native arm64 binary with Bun 1.4.4 built in, on macOS 27.0.1 on Apple Silicon. The hook was downloaded from the README’s own URL; its sha256 is dc6699da…59f7.

We followed the author’s method: three non-interactive sessions (claude -p --model haiku, with summaries forced via CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES=1). In each, a subagent ran eight 20-second steps, and we counted the lines [AgentSummary] Forking in the --debug-file log.

Run Timer fires Summary forks Duration Task completed
Without hook 5 5 181 s :white_check_mark:
Hook in pass mode (control) 5 5 220 s :white_check_mark:
Hook in off mode 0 0 212 s :white_check_mark:

The result matches the author’s in Linux for 2.1.312: the fork occurs, loading the hook by itself changes nothing, and off mode eliminates it. The subagent completed all eight steps in every run.

The hook log in off mode shows the mechanism: one suppressed timer, about 26 seconds after starting. A suppressed timer never fires, so it never re-arms, and the debug log shows no Timer fired or Forking lines.

The log without the hook also shows what gets paid in each of those calls. Each fork resent the subagent’s full context (23 messages in the first cycle) to produce a summary like “Running sleep 20, call 1 of 8”.

In a Linux x64 sandbox: does it fit the current versions?

With the npm package @anthropic-ai/claude-code-linux-x64:

Check 2.1.312 (latest) 2.1.308 (stable)
The sha256 prefix matches the table in the README :white_check_mark: 4f4178ce41d8 :white_check_mark: 356733f185fa
Hook anchors present in the binary :white_check_mark: :white_check_mark:
Preload loads and wraps timers :white_check_mark: :white_check_mark:
claude daemon stop --any exists :white_check_mark: :white_check_mark:
DISABLE_NON_ESSENTIAL_MODEL_CALLS in binary 0 matches 0 matches

What we didn’t measure: the cost part. Our runs show the call disappears, but don’t verify the author’s 16.4 percent figure, which depends on how many background agents you run and for how long. That’s why the measuring section comes first.

Is it worth installing?

If you leave background agents running for long periods, especially unattended or in CI, where nobody watches the status line, measure first. If agent_summary shows up as a big part of your api_request events, the hook is a small, readable script, with a control switch (pass mode) and a clear way to verify it. Install it with --preload= in a path without spaces, restart the daemon, and re-check after each Claude Code update.

If you work mostly in a single foreground session, without background agents, you might not be paying any of this, and that’s exactly what measuring is going to tell you.

If you want to understand better what you’re paying for in each request, start with what tokens are in AI and why they charge you for them.


What about you? What part of your Claude Code token consumption surprised you most when you measured it?

Do you use background agents in Claude Code?
  • Yes, every day
  • Once in a while
  • No, I work in a single session
  • I prefer another option (tell us which)
0 votantes

Comment below or, if this article reached you by email, reply directly to the email: your reply gets published here.

Related: TokenEconomizer: Microsoft’s Plugin for Claude Code, Codex, and Copilot CLI That Cut 31 Percent of Context :white_check_mark: yoDEV Tested