compaction
The tracked changes tagged compaction, newest release first. Every sentence is an item's summary.
Goes with
Changes
Claude Code v2.1.332
-
Desktop Code tab on Anthropic's API now ignores CLAUDE_CODE_AUTO_COMPACT_WINDOW under 200K in user settings when a gateway address is set; use /autocompact instead.
-
Added a warning in VS Code and the desktop Code tab when part of a session could not be saved, explaining how to save it with /compact.
-
Turns no longer end in Prompt is too long after repeated auto-compaction failures when one more compaction at the context limit could have continued them.
-
Compaction no longer fails when a summary runs past the output limit; after three cut-off replies the last try asks for a shorter summary.
-
Fixed a freeze and context overflow when a hook blocks or fails during a turn or after /compact with a very large log; text over about 50,000 characters is now shortened.
+4 more
-
Fixed idle compaction being skipped for subscribers well under their weekly limit.
-
Remote Control: fixed sessions hosted by the desktop app or VS Code showing as idle while /compact runs.
-
Improved recovery for long conversations behind a proxy or gateway with a request size limit where every message and /compact failed with a 413.
-
VS Code: fixed the compaction summary showing as the user's prompt in chat, Rewind and prompt history after reload, resume or fork.
Claude Code v2.1.331
-
Fixed /compact and auto-compact sometimes losing part of the summary when it quoted certain XML tags.
-
[VSCode] Fixed a quick double click pressing a button that appeared after the first click, or starting a second compaction from the context usage circle.
Claude Code v2.1.330
-
Fixed Claude Code freezing for up to several minutes right after compacting a very long conversation.
Claude Code v2.1.329
-
Fixed sessions from a pre-warmed process ignoring autoCompactWindow in the project's .claude/settings.json.
-
Fixed CLAUDE_AUTOCOMPACT_PCT_OVERRIDE staying active in a running session after removal from settings.json.
Claude Code v2.1.328
-
Automatic compaction rebuilds the system prompt as /compact does instead of reusing the session's earlier one.
-
Agent hooks no longer run past their timeout while compacting after a request was refused as too large.
Claude Code v2.1.327
-
Fixed a compaction right after a reply cut at the output token limit losing that reply's tool call and result.
-
Fixed Edit refusing with "File has not been read yet" after compaction on unchanged files outside the project that were already read in full.
-
Fixed in-process agent teammates on a different model from the lead compacting at the lead's context limit and on the wrong model.
Claude Code v2.1.326
-
Automatic compaction in plan mode uses the answering model, such as Opus with opusplan, which can cost more.
-
Compaction on Bedrock, Vertex, Foundry, and with telemetry off no longer sometimes replies to a message instead of summarizing, or drops Claude's last reply from the summary.
-
Image-heavy sessions on Vertex AI now compact and retry instead of getting stuck on a 400 error about a 30 MB request limit.
-
The first message after /compact is faster in git repositories.
Codex 0.167.0
-
Automatic context compaction accounts for retained output from failed responses and responses with missing token usage data.
Claude Code v2.1.318
-
Fixes idle compaction replacing a conversation with a reply that was not a summary.
Claude Code v2.1.317
-
Fixes the Claude apps gateway hiding Amazon Bedrock's Input is too long error, which left sessions failing every turn instead of compacting.
-
Fixes Prompt is too long errors after automatic compaction in sessions whose very large CLAUDE.md changed since it was last sent.
compactionclaude-md -
Fixes very long conversations losing their earlier summary when compaction had to shorten its own request.
Claude Code v2.1.314
-
Added idle compaction to VS Code and the Claude Desktop Code tab: a conversation of 200K+ tokens left idle is summarized, and the summary is used on the next message if the prompt cache has expired.
-
Fixed Bedrock sessions with many images failing every turn and /compact failing with "400 Input is too long"; older images are now removed before compacting.
-
Fixed a PreCompact hook with very large output making compaction fail or repeat; each hook's output is now cut at 10,000 characters.
-
Fixed Remote Control clients showing a stray Compacted row after /compact.
-
Changed idle compaction to run for subscribers with telemetry off, and on Bedrock, Vertex, Foundry and LLM gateways once the one-hour prompt cache is on.
Codex 0.166.0
-
Preserved reasoning-token accounting across resume and fork to avoid premature compaction.
-
Preserved reasoning token accounting across resume and fork to avoid premature compaction.
Claude Code v2.1.312
-
A subagent's autoCompactWindow now lowers the window set by CLAUDE_CODE_AUTO_COMPACT_WINDOW, where it previously had no effect; it still never raises that window.
Claude Code v2.1.311
-
Changed DISABLE_COMPACT in settings files and in a mod's $.env.set so it can only turn compaction off, not back on.
-
Fixed standard-context sessions stopping with a usage credits error when a request ran over 200K tokens; Claude Code now compacts the conversation and continues.
-
Fixed Claude seeing stale MEMORY.md and CLAUDE.md content right after automatic compaction when those files were edited earlier in the session.
-
Fixed agent teammates compacting their history when DISABLE_COMPACT is set.
-
Fixed the rewind menu offering Summarize from here and Summarize up to here when DISABLE_COMPACT is set.
+2 more
-
Improved /teleport and claude --teleport to warn when a compacted cloud session loads from its last compaction, so messages it summarized are missing from the local copy.
-
Improved compaction so that when the model's reply has no summary, Claude Code usually asks for the summary once more before replacing the conversation.
Claude Code v2.1.310
-
Compaction after a "Prompt is too long" error no longer keeps too much of a conversation with dense text such as base64 or SVG, which could cause the next request to fail again.
-
Non-interactive sessions (-p, Agent SDK) use less memory during compaction when the transcript file is very large.
Codex 0.164.0
-
Failed compaction no longer leaves partial summaries in conversation history, and background compaction failures fall back without panicking.
OpenAI Python SDK v3.36.0
-
Adds compaction trigger IDs.
Claude Code v2.1.306
-
Fixed an API error being replaced by "prompt is too long" and an unneeded compaction in sessions with many MCP tools.
Claude Code v2.1.305
-
Fixed cloud sessions and teammates not being told when a compaction had to leave the oldest messages out of its summary.
Claude Code v2.1.304
-
Added the names of tools called earlier to the compaction summary in the transcript view (Ctrl+O).
-
Fixed a "Context limit reached" or "Prompt is too long" error after stopping a turn while Claude Code was compacting a conversation the API had rejected as too long.
-
Fixed CLAUDE_CODE_AUTO_COMPACT_WINDOW=200k silently setting a 100K window; the variable now accepts k and M suffixes like --autocompact and warns when a value is out of range or ignored.
-
Changed compaction to send Claude the skill list again afterwards; /reload-skills now sends only new or changed skills.
Claude Code v2.1.300
-
/autocompact no longer warns about high token usage when a smaller auto-compact window is chosen.
-
Resuming a headless or Agent SDK session no longer loses recent messages kept by a compaction that followed a reply cut at the output token limit (compactions from this version on).
-
Claude is now told about an MCP server's tools and instructions when the server finishes connecting after a compaction, not only at its next tool call.
-
Resuming a headless or Agent SDK session no longer loses its compaction summary or brings back pre-compaction history when the compaction followed a retried or unfinished reply in the same turn.
Claude Code v2.1.299
-
Added idle compaction in the terminal: conversations of 200K+ tokens idle about 54 minutes are compacted before the one-hour prompt cache expires.
-
Added CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS to change the 200K-token minimum for idle compaction, and "idleCompaction": false in settings.json to turn it off; both need v2.1.290 or later.
-
Fixed cloud sessions sometimes leaving a message unanswered when the worker was replaced right after a compaction.
Claude Code v2.1.292
-
Fixed a compaction summary that repeated /name letting Claude invoke a skill reserved for the user.
Claude Code v2.1.290
-
Fixed compaction sometimes failing with a "null is not an object" error.
-
Fixed automatic compaction failing with Prompt is too long after Mac sleep.
Claude Code v2.1.288
-
Fixed long conversations failing with "Prompt is too long" instead of auto-compacting when the last reply reported zero token usage.
-
Fixed --resume sometimes dropping files and context that a compaction had just restored.
-
Fixed the first request in a fresh environment or after a model switch using built-in output and auto-compact limits instead of the server's; that request may now wait up to 1.5 seconds.
-
Auto mode now compacts a conversation too long for the client-side safety classifier instead of prompting for or failing every tool call.
-
/autocompact now saves the auto-compact window per model.
Claude Code v2.1.287
-
Fixed the commit attribution reminder being delivered inside a tool result after compaction.
-
Fixed cloud sessions sometimes losing earlier conversation when restarted during compaction.
Claude Code v2.1.285
-
Fixed compacting or resuming a session failing, losing history, or crashing when the transcript holds a malformed compaction marker or loop wakeup entry.
Claude Code v2.1.284
-
Fixed persistent "Prompt is too long" errors after compacting by compacting once more with less recent conversation.
-
Fixed VS Code "Prompt is too long" errors after compaction when a large text file is attached.
Claude Code v2.1.283
-
The compaction spinner timer now starts when compaction begins and counts streamed summary tokens, replacing the percentage bar.
Claude Code v2.1.282
-
Fixed compaction failing when the summarization request is refused; it now retries on a fallback model.