technique

Conversation compaction

Conversation compaction summarises a long agent or chat history into a tight representation that preserves the relevant signal — used when the conversation approaches the model's context window.

As agent loops and long chats grow, the history eventually approaches the context window. Compaction runs a summariser (typically a cheaper model) that rewrites the history as a structured summary — current goal, key facts learned, open subtasks, important decisions — and discards verbatim tool outputs once their information has been extracted. Production implementations: Claude Code's auto-compact, OpenAI Assistants thread summarisation, LangGraph state compaction nodes. The hard problem is what to keep vs drop; aggressive compaction loses signal, light compaction barely helps. Most teams in 2026 trigger compaction at 70-80% context fill.

When to use conversation compaction

Common mistakes

FAQ

What is conversation compaction?

Conversation compaction summarises a long agent or chat history into a tight representation that preserves the relevant signal — used when the conversation approaches the model's context window.

When should I use conversation compaction?

Long agent loops (15+ steps). Multi-hour chat sessions.

What are the most common mistakes with conversation compaction?

Compacting too aggressively — losing context the next step needed. Compacting too late — the model has already lost quality from context pressure.

Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/compaction.md.