Five-Layer Compaction Architecture

Description

The complete public taxonomy of Claude Code's context management (Layer 1 Tool Result Budget → Layer 2 HISTORY_SNIP Snip Compaction → Layer 3 Microcompaction → Layer 4 Autocompact → Layer 5 CONTEXT_COLLAPSE). Layers 1–3 are zero-cost in-process operations that truncate tool outputs or edit cached messages locally with no API call. Layers 4–5 are hidden API calls to a separate summarization model, producing a new cache chain invisible to the user. Layer 5 CONTEXT_COLLAPSE exists only in internal/employee builds and is feature-gated behind USER_TYPE==='ant'. This is more granular than prior 3-layer and 5-stage compression taxonomies in the extraction: it names the Tool Result Budget and Snip Compaction steps as distinct layers from Microcompaction.

Key claims

Relations

Sources

src-20260409-09a1b2325b23