Skip to content

Instantly share code, notes, and snippets.

@flamerix-ai
Last active November 13, 2026 17:09
Show Gist options
  • Select an option

  • Save flamerix-ai/c3905705cc4205e5de3011fa2e74efce to your computer and use it in GitHub Desktop.

Select an option

Save flamerix-ai/c3905705cc4205e5de3011fa2e74efce to your computer and use it in GitHub Desktop.
Claude Code burns ~15-20% of your tokens on a 3-word status line: a Bun preload that turns agent_summary off · by Flamerix AI, flamerix.ai · MIT

Claude Code burns ~15–20% of your tokens on a 3-word status line. Here's how to turn it off

by Flamerix AI · MIT License

Platforms: Linux and Windows 11 tested by us; macOS reported by others. Tested on Claude Code 2.1.257–2.1.317. The binary is not modified (BUN_OPTIONS=--preload). An update can silently undo it, so see Verify.

TL;DR

Every ~30 seconds, Claude Code re-sends each background agent's full transcript to the model to fill that agent's status line in the agents panel. no-agent-summary.js is a Bun --preload that stops that timer without modifying the Claude Code binary.

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

claude daemon stop --any ends running background sessions. To make it permanent for every Claude Code process, see Install; on Windows, Windows.

Contents

The problem

Every ~30 seconds, for every background agent, Claude Code sends that agent's entire transcript to the agent's own model (usually Opus) and asks it to "describe your most recent action in 3-5 words". The answer updates the agent's status line in the agents panel. It does not reach the model on ordinary turns; after a compaction, up to 256 characters of it return to the model as a Progress: line for a still-running agent (reported by wtfsayo from local transcripts; we confirmed the route in the 2.1.301 binary, not in a live capture). There is no setting that turns it off, and since 2.1.232 (August 2026) it has been on by default.

The anomaly was detected by DRIM in Claude Code's OpenTelemetry export: grouping claude_code.api_request events by query_source showed agent_summary costing more than the main conversation itself.

query_source = agent_summary week before the hook 2 days after
share of all Claude Code spend 16.4 % (main conversation: 15.7 %) 0 %
share of all API requests 19.7 %, about 1 in 5 0 %
part of that spend on Opus 96 % —
input tokens per output token ≈ 9,000 : 1 —

Spend here means Claude Code's own per-request estimate (cost_usd), not an invoice: on a subscription, what you lose is rate-limit headroom. We are not the only ones who measured it: #86879 collects four independent measurements of 18–26 %.

The fix (how it works)

no-agent-summary.js is a Bun preload (~70 lines of code). It wraps only the global setTimeout, the one the summary timer is armed through. When a callback's source text contains a summarizer anchor (e.g. the [AgentSummary] Timer fired log line), the wrapper returns an inert handle instead of arming the timer. Every other timer passes through untouched.

Why a timer hook rather than something simpler: the module ships as precompiled Bun bytecode, so editing its JS text inside the binary changes nothing, and the API client does not go through a wrapped globalThis.fetch. But Function.prototype.toString still returns a callback's source even when it runs from bytecode, so the timer can be recognised by a string inside it. The inert timer uses exactly 2³¹−1 ms: Node and Bun treat a larger delay as 1 ms, so an "infinite" delay would fire at once.

Which processes it touches

The hook installs only inside Claude Code: Bun.main must be the compiled entry (/$bunfs/root/cli, or B:/~BUN/root/cli on Windows) and process.execPath must be a Claude Code install. Any other bun or compiled Bun binary with another entry name loads the file and does nothing.

install channel (Linux rows measured by us with claude --version) process.execPath
nix …/bin/.claude-wrapped
npm @anthropic-ai/claude-code …/@anthropic-ai/claude-code/bin/claude.exe (.exe on Linux too)
npm platform package …/@anthropic-ai/claude-code-linux-x64/claude
native installer ~/.local/share/claude/versions/<version>
Windows, native and desktop-app bundled (reported by anhdoox, omgapnt) C:\Users\<user>\.local\bin\claude.exe, %APPDATA%\Claude\claude-code\<ver>\<hash>\claude.exe

On any platform, Verify step 1 tells you whether the hook installed. One known pass-through: a foreign binary built with bun build --compile --outfile cli and renamed claude; there, only timers whose callback carries an anchor change.

Install

  1. Put no-agent-summary.js somewhere stable; note its absolute path.

  2. Set BUN_OPTIONS globally so every Claude Code process gets it. Write --preload=<path>, with =: BUN_OPTIONS reaches every bun on the machine, and with a space (--preload <path>) bun subcommands break (bun install → error: Script not found "install"). Claude Code reads both forms. One of the following (on Windows, see Windows):

    # ~/.profile, ~/.bashrc, ~/.zshrc
    export BUN_OPTIONS="${BUN_OPTIONS:+$BUN_OPTIONS }--preload=/abs/path/no-agent-summary.js"
    # ~/.config/fish/config.fish
    set -gx BUN_OPTIONS (string trim -- "$BUN_OPTIONS --preload=/abs/path/no-agent-summary.js")
    # ~/.config/environment.d/50-no-agent-summary.conf (systemd user env; also reaches
    # user services and timers; applies when the user manager next starts, usually next login)
    BUN_OPTIONS=--preload=/abs/path/no-agent-summary.js

    Or a wrapper named claude earlier on PATH (the case keeps it idempotent when one Claude Code process starts another, and also recognises the v2 space form):

    #!/bin/sh
    HOOK=/abs/path/no-agent-summary.js
    case " ${BUN_OPTIONS-} " in
      *" --preload=$HOOK "*|*" --preload $HOOK "*) ;;
      *) export BUN_OPTIONS="${BUN_OPTIONS:+$BUN_OPTIONS }--preload=$HOOK" ;;
    esac
    : "${CC_AGENT_SUMMARY_LOG:=${XDG_RUNTIME_DIR:-/tmp}/no-agent-summary.log}"
    export CC_AGENT_SUMMARY_LOG
    exec /path/to/the/real/claude "$@"
  3. Stop the daemon with the command below. Restart every running session from an environment that has BUN_OPTIONS.

    claude daemon stop --any

Windows

Save no-agent-summary.js as .local\share\no-agent-summary.js in your user folder. In PowerShell:

$hook = "$env:USERPROFILE/.local/share/no-agent-summary.js".Replace('\', '/')
if ($hook -match '\s' -or -not (Test-Path -LiteralPath $hook)) {
  Write-Error 'hook file missing, or its path has a space'
} else {
  $old = [Environment]::GetEnvironmentVariable('BUN_OPTIONS', 'User')
  if (-not " $old ".Contains(" --preload=$hook ")) {
    [Environment]::SetEnvironmentVariable('BUN_OPTIONS', "$old --preload=$hook".Trim(), 'User')
  }
}

A User variable, not $PROFILE, reaches the desktop app and every process not started from PowerShell. Keep the forward slashes. The guard stops on a missing file or a space in the path (bun splits BUN_OPTIONS on whitespace): point $hook at an 8.3 short name or a folder without spaces that only your account can write to. Then fully quit the desktop app. Run claude daemon stop --any. Open new terminals.

Desktop app

The Code tab runs its own bundled Claude Code, not the one on your PATH, so the Code tab needs a global BUN_OPTIONS. For the bundled binary on Windows, see Tested versions. Cowork is probably not covered: by omgapnt's reasoning, Cowork runs in its own VM.

Env

variable values effect
CC_AGENT_SUMMARY_MODE off (default), pass off suppresses the summary timer. pass is the A/B control: loads and logs, arms every timer untouched. Any other value warns on stderr and acts as off.
CC_AGENT_SUMMARY_LOG file path, optional Appends preload active mode=… bun=… hooked=global.setTimeout on load, one line per matched timer (first 20), and an exit count.
CC_AGENT_SUMMARY_MARKER file path, optional Overwritten on load with the preload active … line.

Uninstall

Order matters: a BUN_OPTIONS that names a missing file, or a preload that throws on load, stops Claude Code from starting (error: preload not found). So:

  1. Remove the --preload= entry from wherever you set it (Windows: the User variable), or the wrapper.
  2. Quit every running session and the desktop app. Run claude daemon stop --any.
  3. In a new terminal, confirm BUN_OPTIONS no longer names the file. Delete the file last.

Nuances

  • Background processes: the daemon, pty host and pre-warmed bg-spare sessions inherit the environment of the client that started the daemon, so a daemon started before BUN_OPTIONS was set keeps spawning unhooked sessions. On Linux, /proc/<pid>/environ of each must carry --preload; if it does not, restart the daemon (Install step 3).
  • Headless runs need it too: claude -p, cron, CI, editor integrations.
  • npm --ignore-scripts: bin/claude stays a shell stub and Bun never starts, so the hook never runs.
  • Upgrading from v2: overwrite the file in place. Switch BUN_OPTIONS to the = form. Restart the daemon. If both forms name the same path, bun loads it once. Two different paths (say an old copy kept beside the new one) both load: a second v3 or v4 copy is a no-op, but v2 has no such guard, so do not leave a v2 path in BUN_OPTIONS.

Verify (after every update)

  1. Preload loads:

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

    Expect preload active mode=off …. No line: BUN_OPTIONS did not reach the process, the path is not absolute, or the gate does not match your install.

  2. Timer suppressed: with the same BUN_OPTIONS and CC_AGENT_SUMMARY_LOG=/tmp/nas.log, run a background subagent for a minute or two. The log shows summary timer #1 suppressed (setTimeout, delay=30000) and the agent's status line stops updating. If you export OpenTelemetry, query_source = agent_summary should stay at zero; this is the only check that catches every failure mode.

On Windows, in a new terminal: $env:CC_AGENT_SUMMARY_LOG = "$env:TEMP\nas.log"; claude --version; Get-Content "$env:TEMP\nas.log".

Fail-open

Matching is by source text: an anchor must sit inside the callback passed to the timer. If an update breaks that, the hook matches nothing and summaries silently come back. Ways it can happen:

  • the log line or query-source id is renamed;
  • the callback is passed via fn.bind(...) (no source in toString) or another wrapper;
  • the strings move to a shared constant outside the callback;
  • the timer moves off the global setTimeout (setInterval, require("timers"), timers/promises, a scheduler loop).

Effect

  • We have run the hook under every Claude Code process on our machine since 2026-10-26 (then 2.1.301). Our telemetry since then shows zero agent_summary requests outside our no-hook and pass control runs, and no other side query grew to take its place.
  • Subagents, background agents, forked skills and background sessions run normally, without the summary fork.
  • Visible change: the per-agent status line stops updating; SDK task_progress has no summary.
  • Model-side change: after a compaction the model no longer gets the Progress: line for a still-running agent. We have not measured whether that changes its behaviour.
  • Overhead: one Function.prototype.toString per distinct timer callback, cached in a WeakMap. claude --version: ~10 ms → ~17 ms (one measurement).

Tested versions

Linux x64 binary from npm @anthropic-ai/claude-code-linux-x64 (its sha256 equals the native installer's manifest.json checksum). Static: in the extracted bundle, the callback of the summary timer carries a hook anchor. Live: claude -p --model haiku with CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES=1 (headless runs don't arm the summary timer without it), one subagent doing 8 steps of ~20 s, counting [AgentSummary] Forking in --debug-file.

Hook version per row: v4 (current, run 2026-11-03), v3 (re-run 2026-10-29), unmarked v2. v4 changes only the gate.

version published sha256 static summary forks in a ~2.5-min agent run: no hook / hook pass / hook off notes
2.1.317 v4 2026-11-02 eb224419e344 OK 5 / 5 / 0 latest on 2026-11-03
2.1.312 v3 2026-10-27 4f4178ce41d8 OK 5 / 6 / 0 the pass run took 232 s on a loaded machine, so one more 30 s tick fit; off with the gist file itself: 0
2.1.301 v3 2026-10-15 bc1aad9982c7 OK 5 / 5 / 0 run through the Nix-packaged binary rather than the npm one
2.1.312 2026-10-27 4f4178ce41d8 OK 5 / 5 / 0 latest on 2026-10-28; interactive: 6 no hook, 0 off
2.1.310 2026-10-23 b73676430af1 OK 5 / 5 / 0
2.1.308 2026-10-22 356733f185fa OK 5 / 6 / 0 stable on 2026-10-28; the pass run's agent took 9 steps instead of 8
2.1.301 2026-10-15 bc1aad9982c7 OK 5 / 5 / 0 same with earlier hook builds; interactive off also 0
2.1.280 2026-09-22 1e08503dbdf3 OK 1 / 1 / 0 (timer fired 11 / 11 / 0) interactive: -p cannot enable summaries on this version. The agent sat at a permission prompt, so later timers skipped the unchanged transcript
2.1.257 2026-09-01 9a64bda9d872 OK 1 / 1 / 0 (timer fired 11 / 11 / 0) same as 2.1.280

v4 on Windows: Windows 11 Enterprise 24H2 (build 26100) in a KVM virtual machine, native installer, bun 1.4.4, PowerShell 5.1, same live test as above, 2026-11-03: 2.1.316 5 / 5 / 0; 2.1.317 5 / 5 / 0 (a 6th no-hook fork was aborted empty because the agent had finished).

5 / 5 / 0 = the fork happens on this version, merely loading the hook changes nothing, and off removes it.

Reported by others

platform version checked by
macOS 26.7.1, native darwin-arm64, bun 1.4.4 2.1.312 static: the 3–5 words prompt, the timer (30 s, clamped 30–240 s), no off switch; live: the preload loads, and an interactive session with a background subagent logged summary timer #1 suppressed (setTimeout, delay=30000). Token numbers not checked (no OTEL export) lostsock, HN, 2026-10-29
macOS, native darwin-arm64, bun 1.4.4 2.1.312 v3. Headless -p --model haiku with CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES=1: 5 / 5 / 0. Interactive, background agent, nothing opted in: 5 pass / 0 off declanbx, 2026-10-30
Windows 2.1.312 5 / 5 / 0. A derivative with its own gate fix, not this hook omgapnt, 2026-10-29
Windows, desktop app's bundled binary 2.1.309 5 / 5 / 0. Same test, same derivative; headless, not through the app's UI omgapnt, 2026-10-29
Windows 11, bun 1.4.4 2.1.314 Headless, one subagent, three sleep 20 calls, CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES=1. pass: matched=3 suppressed=0. off: matched=1 suppressed=1. Used anhdoox's own gate, not v4's anhdoox, 2026-10-30
not stated 2.1.308 5 / 5 / 0 Bedz01, 2026-10-29
Windows 11, embedded bun 1.4.3 2.1.293 (npm), 2.1.301 (VS Code extension bundle) Load only: with their own gate fix the hook reports preload active mode=off. Suppression not run (not signed in) apoapostolov, 2026-10-30

Why there is no setting for this

  • The documented switch only turns it on. The SDK option agentProgressSummaries defaults to false, but in the bundle it is one term of an OR, and every code path that writes it sets true. So false changes nothing, and the undocumented CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES can only enable summaries too.
  • The interval belongs to the server. It comes from a per-model-family server flag and is clamped to 30–240 s. The default is already the minimum, and no value disables the timer.
  • The obvious env vars miss. DISABLE_NON_ESSENTIAL_MODEL_CALLS, which some packagers set, does not occur in the binary at all. CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 stops the summary, but only by taking background agents with it. CLAUDE_CODE_FORK_SUBAGENT=0 costs you fork subagents and can help only in interactive sessions: forked skills are always summarized, and reports on 2.1.312 disagree on whether it works at all (#86879, #105981).
  • The prompt cache makes it cheaper, not cheap. About 98 % of these calls re-read the transcript from cache; the ~2 % that hit a cold cache carry over a third of the summary's cost.
  • Cost tools that read transcripts don't see it. These requests are not written to the session logs on disk (#104358); only the OpenTelemetry export shows them. The docs section on background token usage doesn't list it either, while Agent View's row summaries are documented as a Haiku-class model refreshing every few minutes.
  • A cheaper short mode sits behind a server flag. In the 2.1.317 binary, the flag tengu_groovy_ember ({"mode":"short"}) switches the summary to short notes of about 1.5k tokens written by Haiku, but only when a first-party Haiku model is available; otherwise the summary stays full. claude -p runs that opt in via CLAUDE_CODE_AGENT_PROGRESS_SUMMARIES do not consult the flag. On our account the flag is unset, so our live runs used full mode. The hook covers both modes: both run from the same timer callback, which carries the anchor.

Timeline (2026)

version (published) what changed
2.1.32 (Feb 5) the code first appears; dead in public builds
2.1.72 (Mar 9) reachable as an SDK opt-in
2.1.117 (Apr 21) reachable in the interactive CLI behind the fork gate or a server rollout
≤ 2.1.220 (Jul 24) forked skills are always summarized
2.1.232 (Aug 13) on by default for interactive background agents
2.1.300 (Oct 14) interval becomes server-tunable, 30–240 s
2.1.310 (Oct 23) the cheaper short mode lands, switched off

In our telemetry its weekly share of spend went from 3.5–7 % in July (the fork gate was already open for us) to 7.3 % and then 11.8 % in the week we picked up 2.1.233, and to about 16 % by mid-October.

FAQ

Does this apply to the Agent SDK or ACP? Mostly no. In the 2.1.301 bundle (2.1.310 has the same call sites) a background Agent-tool agent is summarized only in interactive mode, unless the host opts in with agentProgressSummaries: true. Fork subagents and forked skills always are, SDK included. The preload works there too, provided BUN_OPTIONS reaches the claude process. Not checked: whether a given ACP adapter sets it, and whether versions after 2.1.301 changed the non-interactive default.

Doesn't "awaySummaryEnabled": false turn this off? No. That setting controls the welcome-back recap (gist comment).

See also (not audited by us): claude-summary-tuner, v1.0.2 or later only (earlier versions wiped other apps' startup entries when the logger was on); declanbx's fork.

Changelog

  • v4 — Windows: the gate also accepts Bun.main = B:/~BUN/root/cli, normalises backslashes in Bun.main and process.execPath, and lowercases the basename (v3 never matched there). README: the compaction route in The problem; new Windows, Desktop app, Uninstall, FAQ and Contributions sections; our Windows runs and community results in Tested versions.
  • docs — first macOS report (darwin-arm64, 2.1.312) added to Tested versions.
  • v3 — --preload=<path> everywhere (the space form broke bun subcommands); the hook installs only inside Claude Code (Bun.main plus process.execPath, see Which processes it touches); a second load in the same process is a no-op.
  • v3 — wraps only the global setTimeout, the one the summary timer is armed through (v2 also wrapped setInterval and require("timers")).

Contributions

  • Bedz01: the --preload= form, the Claude-Code-only gate, an independent 5 / 5 / 0 on 2.1.308.
  • omgapnt: first Windows and desktop-app results, Windows path tips.
  • anhdoox: the Windows Bun.main and execPath probe, a working gate, the user-variable install.
  • declanbx: macOS results, the ~8 % replay estimate, the build-check fork.
  • Genbox: first look at the desktop app's source.
  • lostsock: the first macOS report, on HN.
  • wtfsayo: the correction that a summary can return to the model after a compaction.
  • apoapostolov: an independent Windows gate probe on 2.1.293 and 2.1.301, and the failed-preload hazard.
  • tonyvince: the answer to the awaySummaryEnabled question.

License and disclaimer

MIT © 2026 Flamerix AI. Provided as is, without warranty of any kind; you use it at your own risk. Flamerix AI is not liable for any damage, data loss or account action arising from its use. Changing a client's runtime behaviour may conflict with the terms of the service you use it with; checking that is on you.

"Claude" and "Claude Code" are trademarks of Anthropic, PBC. This project is independent and is not affiliated with, sponsored or endorsed by Anthropic.

// no-agent-summary.js v4: Bun --preload hook that switches off Claude Code's `agent_summary`
// side-query. Unofficial, not affiliated with Anthropic. Tested by us on Linux; macOS reported working by others; Windows 11 tested by us (Claude Code 2.1.316–2.1.317) (see README).
// Install, env vars, verification and fail-open caveats: README.md.
//
// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Flamerix AI (https://flamerix.ai). Provided "as is", without warranty;
// full license text: README.md.
// Contributions: Bedz01 (https://gist.github.com/Bedz01) — the --preload= form and the
// Claude-Code-only gate (gist comment 6448932); anhdoox (https://gist.github.com/anhdoox) — the
// Windows Bun.main and execPath probe (gist comment 6449685); omgapnt
// (https://github.com/omgapnt) — first Windows and desktop-app results (gist comments 6449451,
// 6449469).
//
// Anchors: the summarizer's debug-log line and its query-source id, both inside the timer
// callback on 2.1.301.
//
// Gate: installs only inside Claude Code itself, i.e. when Bun.main is the compiled CC entry AND
// process.execPath is a CC install. Entry: `/$bunfs/root/cli`; on Windows `B:/~BUN/root/cli`, as
// reported (gist comment 6449685). Install, as measured on Linux: nix `.claude-wrapped`, npm
// `bin/claude.exe`, npm platform package `claude`, native installer `claude/versions/<semver>`; on
// Windows `claude.exe`, as reported, native and desktop-app bundled. Backslashes in both values are
// normalised and the basename is lowercased before matching.
// Any other bun or compiled Bun binary that inherits BUN_OPTIONS loads this file and does nothing;
// the one exception is a foreign binary built with `--outfile cli` and renamed to a CC-looking
// path (e.g. `claude`), where only timers whose callback carries an anchor change.
// Double load: bun loads one path once even if BUN_OPTIONS names it in both --preload forms;
// two different paths (an old and a new copy) both load, and the second v4 load is a no-op.
const INSTALLED = Symbol.for("flamerix.no-agent-summary.installed");
const CC_MAINS = ["/$bunfs/root/cli", "B:/~BUN/root/cli"];
const CC_EXEC_BASENAMES = [".claude-wrapped", "claude.exe", "claude"];
const CC_NATIVE_VERSION = /\/claude\/versions\/\d+\.\d+\.\d+$/;
function isClaudeCode() {
if (typeof Bun === "undefined") return false;
const slash = (s) => String(s).replace(/\\/g, "/");
if (!CC_MAINS.includes(slash(Bun.main))) return false;
const p = slash(process.execPath);
const base = p.slice(p.lastIndexOf("/") + 1).toLowerCase();
return CC_EXEC_BASENAMES.includes(base) || CC_NATIVE_VERSION.test(p);
}
function install() {
const fs = require("fs");
const ANCHORS = ["[AgentSummary] Timer fired", "agent_summary"];
const RAW_MODE = process.env.CC_AGENT_SUMMARY_MODE || "off";
const MODE = RAW_MODE === "pass" ? "pass" : "off";
if (RAW_MODE !== MODE) process.stderr.write(`[no-agent-summary] unknown mode ${RAW_MODE}, forcing off\n`);
const LOG = process.env.CC_AGENT_SUMMARY_LOG;
const log = (s) => { if (LOG) { try { fs.appendFileSync(LOG, `${new Date().toISOString()} pid=${process.pid} ${s}\n`); } catch {} } };
const verdict = new WeakMap(); // fn -> bool (is the summary timer callback)
function isSummaryTimer(fn) {
if (typeof fn !== "function") return false;
let v = verdict.get(fn);
if (v === undefined) {
try {
const src = Function.prototype.toString.call(fn);
v = ANCHORS.some((a) => src.includes(a));
} catch { v = false; }
verdict.set(fn, v);
}
return v;
}
let matched = 0;
let suppressed = 0;
const PROMISIFY = Symbol.for("nodejs.util.promisify.custom");
const hookedFns = new WeakSet();
function wrap(orig) {
if (typeof orig !== "function") return orig;
const hooked = function (fn, delay, ...args) {
if (isSummaryTimer(fn)) {
matched++;
if (MODE === "off") {
suppressed++;
if (matched <= 20) log(`summary timer #${matched} suppressed (setTimeout, delay=${delay})`);
const t = orig(() => {}, 2 ** 31 - 1); // clearTimeout-compatible handle, never fires
if (t && typeof t.unref === "function") t.unref();
return t;
}
if (matched <= 20) log(`summary timer #${matched} passed (control, setTimeout, delay=${delay})`);
}
return orig(fn, delay, ...args);
};
Object.defineProperty(hooked, "name", { value: "setTimeout" });
// util.promisify(setTimeout) reads these; without the custom one it calls the wrapper
// callback-last and node throws ERR_INVALID_ARG_TYPE.
if (orig.__promisify__) hooked.__promisify__ = orig.__promisify__;
if (orig[PROMISIFY]) hooked[PROMISIFY] = orig[PROMISIFY];
hookedFns.add(hooked);
return hooked;
}
globalThis.setTimeout = wrap(globalThis.setTimeout);
const hookedApis = hookedFns.has(globalThis.setTimeout) ? "global.setTimeout" : "";
const active = `preload active mode=${MODE} bun=${Bun.version} hooked=${hookedApis}`;
log(active);
if (LOG) process.on("exit", () => log(`exit: ${suppressed} summary timer(s) suppressed, ${matched} matched`));
const MARKER = process.env.CC_AGENT_SUMMARY_MARKER;
if (MARKER) {
try { fs.writeFileSync(MARKER, `${active} pid=${process.pid}\n`); }
catch (e) { process.stderr.write(`[no-agent-summary] cannot write marker ${MARKER}: ${e.message}\n`); }
}
}
if (isClaudeCode() && !globalThis[INSTALLED]) {
globalThis[INSTALLED] = true;
install();
}
@tonyvince

Copy link
Copy Markdown

I don't get it. Doesn't the "awaySummaryEnabled": false option disable this?

No. That setting is to turn off "welcome back" recap

@wtfsayo

wtfsayo commented Oct 30, 2026

Copy link
Copy Markdown

One correction to the README: the claim that the generated summary “never reaches the model or your conversation” is too strong.

In local transcript/API-request records, I found generated progress summaries in stored context messages referenced by ordinary model requests, with matching assistant responses carrying usage. These were not the hidden agent_summary requests themselves; they were later requests carrying the already-generated summary text.

The Claude Code 2.1.314 implementation explains the route: accepted summary text is stored in task.progress.summary, copied into a running agent’s task_status.deltaSummary during context restoration, and rendered as progress text into API-bound context. This is conditional, not something that happens on every turn. skipTranscript: true on the summarizer fork does not prevent its output from appearing in subsequent context.

This does not establish that disabling summaries causes a regression. It does mean the workaround is not strictly cosmetic, so the docs should acknowledge the information it can remove from Claude’s context rather than imply guaranteed behavioral equivalence.

Separately, the percentage in the headline is workload-specific. A gap between cumulative accounting and visible transcript usage cannot, by itself, be attributed entirely to agent_summary calls.

@apoapostolov

Copy link
Copy Markdown

Windows note: as written, v3 loads on win32 and does nothing, because the gate never matches.

Measured on Windows 11, Claude Code 2.1.293 (npm install) and 2.1.301 (VS Code extension bundle), embedded bun 1.4.3. BUN_OPTIONS=--preload=... does reach claude.exe — a probe preload runs and reports the environment — but isClaudeCode() returns false:

  • Bun.main is B:/~BUN/root/cli, not /$bunfs/root/cli.
  • process.execPath is a backslash path such as C:\Users\...\@anthropic-ai\claude-code\bin\claude.exe, so p.slice(p.lastIndexOf("/") + 1) returns the whole path and CC_EXEC_BASENAMES.includes(base) misses.

Normalising separators and accepting the drive-letter entry fixes it:

const CC_MAIN_WIN = /^[A-Za-z]:\/~BUN\/root\/cli$/;

function isClaudeCode() {
  if (typeof Bun === "undefined") return false;
  const main = String(Bun.main || "").replace(/\\/g, "/");
  if (main !== CC_MAIN && !CC_MAIN_WIN.test(main)) return false;
  const p = String(process.execPath || "").replace(/\\/g, "/");
  const base = p.slice(p.lastIndexOf("/") + 1);
  return CC_EXEC_BASENAMES.includes(base) || CC_NATIVE_VERSION.test(p);
}

Both anchor strings ([AgentSummary] Timer fired, agent_summary) are present in the win32-x64 binaries, and with the gate fixed the hook reports preload active mode=off bun=1.4.3 hooked=global.setTimeout for both installs above.

Second Windows hazard worth mentioning in the README: a preload path that does not exist, or one that throws, aborts claude.exe before the CLI starts (error: preload not found / error: <message>). With BUN_OPTIONS set machine-wide, deleting or breaking the hook file makes Claude Code unusable until the variable is cleared. Wrapping install() in try/catch and degrading to "unhooked" avoids that.

Caveat on my own result: I could not verify the timer suppression live. claude auth status on that machine reports loggedIn: false, so no subagent run was possible. Install and hook-identity are verified; the suppression itself is still open on Windows, and someone signed in there can close it with CC_AGENT_SUMMARY_LOG plus one background subagent run.

@insilications

Copy link
Copy Markdown

This is why I hate Claude Code being closed source. We are forced to resort to this kind of solution

@flamerix-ai

Copy link
Copy Markdown
Author

v4 is out: the hook now works on Windows.

v3 loaded on Windows but did nothing, because the gate never matched there. v4 accepts the Windows Bun.main and backslash paths; nothing else in the hook changed. We tested it on the latest Claude Code, 2.1.317, on Linux and on Windows 11 (native installer, PowerShell 5.1): 5 / 5 / 0 on both (no hook / pass / off). Short mode is still off by default.

As far as we can tell, this is the final shape of the hook. To upgrade, overwrite no-agent-summary.js, run claude daemon stop --any and restart your sessions. Windows install steps are in the README.

The README also has two corrections. A summary can reach the model after a compaction (thanks @wtfsayo), and CLAUDE_CODE_FORK_SUBAGENT=0 is not a reliable off switch. Thanks to everyone who tested and reported; you are all in the new Contributions section.

@dhkts1

dhkts1 commented Nov 4, 2026

Copy link
Copy Markdown

CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1

@zachthedev

Copy link
Copy Markdown

CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1

As of 2.1.318, that env var is working.

@flamerix-ai

Copy link
Copy Markdown
Author

Update — Claude Code 2.1.318 adds an off switch.

CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1 — not in the changelog, but it's in the 2.1.318 binary: when set, the per-agent summary timer returns early (no agent_summary fork), and summaries are turned off at agent start (debug log: No progress summaries for … CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES is set).

  • Set it to exactly 1 — only "1" is forwarded to background/child sessions.
  • Works from the shell or from settings.json → "env".
  • Present in the linux-x64, darwin-arm64 and win32-x64 builds of 2.1.318; absent in 2.1.317 and earlier (checked 2.1.317, 2.1.316, 2.1.311).

So: on ≥2.1.318 use the env var — the preload hook should no longer be needed. On ≤2.1.317 the preload hook is still the only way.

@enricodias

Copy link
Copy Markdown

These summaries seem to be left off for ordinary background agents in desktop sessions using the claude desktop app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment