Context compaction

Condensing earlier turns, tool logs and file reads inside a running agent session into a compact state summary so work can continue without hitting context limits or degrading accuracy.

Context compaction, common card #260 in The Glitch AI glossary: Condensing earlier turns, tool logs and file reads inside a running agent session into a compact state summary so work can continue without hitting context limits or degrading accuracy.
GLS 260 · common

Also called: Compaction, Context summarization.

For: Builders

Why it matters

Long coding and research sessions fill a context window fast with noisy tool output. Compacting early keeps latency lower, trims token spend and reduces context rot.

In practice

After 45 tool calls debugging a payment webhook, the harness replaces raw 60-KB stack traces with a 600-token structured summary listing files changed, hypotheses disproved, failing test name and next step. The agent keeps working in a fresh budget without re-reading the entire repo.

Watch for

Lossy summaries quietly drop edge cases, exact file paths or failed experiments, causing the agent to repeat dead ends. Keep critical invariants and failing assertions outside the summary in a structured file or checklist.

How it compares

Related terms

Context engineering · Context rot · Agent checkpointing · Agent memory

Try it here

Context engineering is the real job · Claude Code, the operator’s way

Sources

Use in an AI agent: connect MCP at https://www.theglitch.ai/mcp and call get_glossary_term with context-compaction, or read the Markdown edition.

Definition updated 2026-11-28.

The Ultimate AI Glossary (2027): every term