Expand description
Where a running Claude CLI will auto-compact, from its own answer.
The context meter’s countdown used to assume the CLI’s default
(window − 33K). The real point moves with CLAUDE_CODE_AUTO_COMPACT_WINDOW,
the autoCompactWindow setting and CLAUDE_CODE_DISABLE_1M_CONTEXT, and
auto-compaction can be off altogether. The CLI says which: the
get_context_usage control request (detail: "summary", answered locally
with no inference call) returns autoCompactThreshold (absent when off),
isAutoCompactEnabled, maxTokens (the auto-compact window) and the
model. Verified on CLI 2.1.288:
docs/reports/REPORT_AGENT_PANE_CONTEXT_METER_2026_10_05.md §9.1.
Asked at the same points as get_settings (agent_runtime.rs): at spawn
and at every turn boundary, of a control-protocol process only. Published
as the persisted per-pane agentcontextusage event.
Structs§
- Agent
Context Usage - What the CLI reported about auto-compaction for its current model.
- Agent
Context Usage Event - The
agentcontextusageevent’s payload (mps_events::AgentContextUsageChanged). An unknown value is null, not omitted.
Constants§
- CONTEXT_
USAGE_ REQUEST_ PREFIX - Prefix of the
request_idof ourget_context_usagerequests, so the answer can be told from the answers to anything else.
Functions§
- agent_
context_ usage_ event - The
agentcontextusageevent data for one pane. - context_
usage_ from_ control_ response - The usage in a
get_context_usageanswer, orNonefor any other frame, an error answer (a CLI without the request) or one missingisAutoCompactEnabled. Shape:{type: control_response, response: {subtype: success, request_id, response: {model, maxTokens, autoCompactThreshold?, isAutoCompactEnabled, ...}}}. - context_
usage_ request_ line - The
get_context_usagerequest.summaryis answered from local state;fullwould call the token-count API. - count 🔒
- A positive count no larger than any real window (100M), else
None. - publish_
agent_ context_ usage - Publish it, persisted, so a pane that mounts later still gets the latest.