Compaction
Definition
Summarising earlier parts of a long conversation and replacing them with the summary to free context space for the work still to do.
In more detail
Coding agents compact automatically as they near the context limit, and some let you trigger it yourself, such as /compact in Claude Code. Summaries lose detail, so important decisions are better written to a file the agent can re-read.
Related terms
Context rot
The gradual decline in a model's accuracy and instruction-following as its context fills up with long, stale or irrelevant content.
Context window
The maximum number of tokens a model can consider in one request, covering both the input you send and the output it writes.
Agent harness
The software around a model that turns it into an agent: the loop, tools, prompts, context management, permissions and limits.
Agent memory
Information an agent keeps beyond a single context window, such as user preferences, past decisions or task notes, and retrieves when needed.
Context engineering
Deciding what information, tools and history a model sees at each step, and what to leave out, to get the result you want.
Context poisoning
When a wrong fact, hallucination or bad tool result enters an agent's context and keeps steering later steps in the wrong direction.
Read more about Compaction
- Agent memory and compaction in practice
Keep long Claude Code sessions accurate with compaction, CLAUDE.md, auto memory, subagents and a summarise-and-restart routine, and know what survives each.
- Context engineering
Deciding what instructions, documents, tools and history a model sees at each step.
- Context rot: why long contexts fail and what to do
Why models get worse as their context fills up, from lost-in-the-middle to distractors and poisoned context, and the practical fixes for agents and RAG.