AI CompendiumA public chart of the language
Home / Agents & Harness / Compaction
Agents & Harness

Compaction

also called Summarisation, Context compression

Replacing old context with a shorter summary of it.

Definition

Compressing a long conversation or tool history into a summary that preserves what matters, freeing window space while keeping continuity. Usually a model call in itself.

Compaction is lossy and it compounds — compact a compacted history and detail erodes. Summarise conservatively, and keep original artifacts on disk so they can be re-read.

Compaction is lossy and it is a model call, so it is neither free nor guaranteed faithful. Treat it as a managed trade: you are buying headroom at the cost of detail, and the summary has to be checked against the goal rather than trusted.

How people use it
Approaching the context limit.
"Compact everything before the last ten turns, but keep the decisions list verbatim."
Worked example

Compaction that dropped the constraint

Work continues correctly after compaction but a requirement is silently violated.

The summariser kept the narrative and dropped the constraint list. Keep hard constraints pinned outside the compacted region — in the system prompt, in a file, or in the task list — so they cannot be summarised away.

Sources
  • blogEffective context engineering for AI agents ↗Anthropic Engineering · 2025

    Defines context engineering as curating everything supplied at inference, names context rot, and covers just-in-time retrieval, compaction and keeping the window high-signal.

  • docsContext windows ↗Claude platform docs · 2026

    What actually consumes the window — input, tools, thinking and output — plus context rot and compaction. Authoritative for this product, not for models generally.

  • docsAgents ↗OpenAI API docs · 2026

    Compares a managed hosted agent, an in-app SDK loop, and the raw Responses API, including sessions, handoffs, approvals, sandboxing and compaction.

Related terms