Learning resourcesReviewed · Anthropic

Claude compaction overview

Claude's compaction overview is a guide for developers managing long AI conversations, but both API approaches it describes are in beta. It compares application-triggered summarization with automatic compaction at a token threshold, including recent-turn retention, background operation and thinking compatibility.

Researched 15 Nov 2026

In short.

Claude's compaction overview is a guide for developers choosing how to summarize long conversation histories, but implementation details and compatibility requirements are on separate pages. It explains who triggers each approach, how conversation history changes afterward, and when recent turns or thinking can be retained. Pricing, supported model and platform combinations, and measured effects on quality or performance are not established by this page.

Researched and written by an AI model and checked by a second AI model. How it works

The scope is the complete selected page at [https://platform.claude.com/docs/en/build-with-claude/compaction.md], including its comparison table, beta notices, on-demand options and topic links. Linked pages are excluded; their implementation examples, compatibility conditions, error handling and usage details are not established here. No separate library files are included, and the page supplies no redistribution notice. Runtime behavior, summary fidelity, quality, latency and costs were not tested.

The overview

Identity

Compaction overview is a first-party Claude documentation guide to server-side conversation summarization. Its source address is [https://platform.claude.com/docs/en/build-with-claude/compaction.md], and its declared documentation address is [https://platform.claude.com/docs/en/build-with-claude/compaction]. It introduces compaction approaches and directs developers to task-specific implementation pages.

Assessment

The guide is useful for choosing a context-management approach before integration. Its strongest contribution is the comparison of timing, application code, history replacement and thinking retention. Developers still need the linked documentation for complete requests, compatibility conditions and error handling.

Users

The intended readers are developers building extended chats or agent tasks that accumulate conversation history. Beginners get an explanation of why older turns are summarized. Experienced developers get distinctions relevant to asynchronous operation, message-history management and preserved thinking.

Capabilities

On-demand compaction lets the application choose when to request a summary. The overview describes options for retaining recent turns verbatim, running summarization in the background, replacing the default summarization prompt and compacting again as the conversation grows.

Threshold compaction lets the API trigger summarization when input tokens reach a configured threshold. It operates inside the triggering request. Recent turns can be retained by pausing after compaction and reinserting them.

Using it

Requirements

Both API approaches are described as beta features. On-demand compaction uses the beta identifier compact-2026-09-04 and the top-level compaction parameter. It requires application code to request a summary and replace the summarized history.

The overview describes threshold compaction as adding one parameter to ordinary requests, but refers elsewhere for its beta header and syntax. Supported models, platform availability and detailed feature compatibility are unknown from this page.

Mechanism

Compaction replaces older conversation turns with a summary written by Claude on the server. This reduces the active conversation content occupying the context window, the limited space available for the model's input.

For on-demand compaction, the returned block goes first in messages and replaces the messages it summarizes. For threshold compaction, the application appends the response as usual, and the API drops the context preceding the compaction block.

Setup

The overview recommends starting with on-demand compaction wherever it is available. The conceptual integration is a loop that requests a summary, receives its block and substitutes it for the summarized history. Recent-turn retention and background operation are optional extensions that can be combined.

The page provides navigation rather than a complete executable example. Full request construction, missing-summary handling and interactions with other API features require the implementation documentation at [https://platform.claude.com/docs/en/build-with-claude/compaction-on-demand].

Example

An illustrative use is a coding-agent conversation where older discussion can be summarized while the latest exchanges remain verbatim. The guide points to on-demand compaction with recent-turn retention for this need. If work must continue while the summary is generated, background compaction can be combined with it, with the returned block substituted when available. Runtime behavior for this scenario is not assessed.

Assessment & evidence

Limitations

A summary can omit information needed later; the guide points to a replacement summarization prompt when this happens. It provides no measurements of summary fidelity, response quality or latency.

Thinking retention has additional constraints. On-demand compaction can preserve thinking in retained turns only on models with preserved thinking and under conditions documented elsewhere. With threshold compaction, thinking must be removed from reinserted turns, explicitly or through prefix_mismatch_behavior set to drop_block. Threshold compaction cannot run in the background.

Choosing an approach

The comparison favors on-demand compaction when the application needs control over timing, must keep working during summarization or needs to retain recent turns and their thinking. Threshold compaction suits applications that want the API to manage context within ordinary requests. The practical tradeoff is responsibility for the application loop versus summarization occurring inside the request that reaches the threshold.

Alternatives

The overview compares both API approaches with a custom summarizer, where developers own the summarization call, prompt and history rewrite. It warns that thinking in retained turns fails the prefix check with a custom summary.

Context editing is another documented option when the goal is to remove old tool results or thinking blocks according to rules. That approach removes selected content rather than replacing older conversation turns with a summary. Its implementation is outside this page.

Evidence

The evidence consists of the complete selected documentation page, including its comparison table and descriptions of linked topics. It documents intended API behavior but contains no benchmarks or observed execution results. Nothing was executed.

The captured source revision is sha256:d9d5718eb8875dab1a316c8046f35accd0e95054dd9ee83239fd502e2d02ed10. Linked implementation, compatibility and usage pages are outside the available evidence.

Access & freshness

Costs

Pricing and total operating costs are unknown. The page links separate usage-accounting guidance for each approach but supplies no rates, billing calculation or measured savings. A smaller active context does not, by itself, establish the total cost after summarization.

Rights

The supplied page states no license or redistribution permission for its documentation. It also does not establish the service terms governing API use. Documentation reuse rights and applicable API terms are unknown from this evidence.

Freshness

The page was captured on 2026-11-15 at 01:42:37.198 UTC. No publication or last-updated date appears in the supplied text. The on-demand beta identifier compact-2026-09-04 is an API identifier, not evidence of the page's publication date. Availability and compatibility beyond the captured overview remain unknown.

Next steps

For an integration, start with [https://platform.claude.com/docs/en/build-with-claude/compaction-on-demand] and confirm model support, platform availability, request syntax and usage accounting. If API-managed triggering is preferable, consult [https://platform.claude.com/docs/en/build-with-claude/compaction-threshold].

Before relying on summaries, evaluate whether later turns still receive essential facts. Applications that retain recent turns or return thinking blocks also need the corresponding retention and preserved-thinking requirements. Measured quality, latency and cost remain unknown until assessed for the intended workload.

Evidence for this report

selected-page.txtselected · checked 2026-11-15