{"version":"2.1.284","anchor":"auto-compact-threshold-now-counts-tokens-the-server-already","canonical_anchor":"auto-compact-threshold-now-counts-tokens-the-server-already","heading":"Auto-compact now counts context the server has already cleared","tier":"notice","area":"Compaction","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.284\/e\/auto-compact-threshold-now-counts-tokens-the-server-already","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.284","markdown":"### Auto-compact now counts context the server has already cleared\n\nServer-reported context_management results are kept on assistant messages, and auto-compact adds the cleared tokens to its estimate\n\n**Unclear.** It is not clear why the cleared tokens are added to the estimate rather than taken away from it.\n\n**What**\n\nThe server can clear parts of the conversation itself, for example old tool results, through a feature called `context_management`. Claude Code now keeps and uses that information:\n\n- When a streamed reply is put together, `context_management` from the final `message_delta` is now copied onto the stored message. Before, only `stop_reason`, `stop_sequence`, `stop_details` and `research` were copied.\n\n- A new helper also copies `message.context_management` when assistant messages are merged.\n\n- The auto-compact check (which decides when to summarize a long conversation to save space) now adds the tokens the server reported as cleared (the `applied_edits` on the last assistant message) to its token estimate before choosing a compact level.\n\n- The debug log line gains a `serverCleared=` part.\n\n**Why**\n\nFor sessions where the server has been clearing context, auto-compact can now start earlier than before. The debug log shows how much the server cleared.\n\n- Area: Compaction\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 3\/5"}