# Compaction

Concept · [Building with AI](https://ecosystem.samcarlton.com/ai)

Also called: compact, compacting, /compact, context compaction, conversation summary, compacted

Shrinking a long [session](https://ecosystem.samcarlton.com/session) by replacing its history with a [summary](https://ecosystem.samcarlton.com/secondary-source) and carrying on from that summary in a fresh [context window](https://ecosystem.samcarlton.com/context-window). It frees room and restores focus, but details left out of the summary are gone.

**For example:** After a long debugging [session](https://ecosystem.samcarlton.com/session), the [founder](https://ecosystem.samcarlton.com/founder) compacts it. The [agent](https://ecosystem.samcarlton.com/ai-agent) keeps a page of notes on what was tried and continues with a clean slate.

## Connects to (8)

- [Autocompact](https://ecosystem.samcarlton.com/autocompact): Compaction that the agent's software starts on its own when the context window is nearly full.
- [Clearing](https://ecosystem.samcarlton.com/clearing): Ending a session and starting a completely empty one.
- [Session](https://ecosystem.samcarlton.com/session): One stretch of work with an AI agent, from a blank start until it is cleared, closed or compacted.
- [Context window](https://ecosystem.samcarlton.com/context-window): How much text an LLM can take into account at one time.
- [Handoff](https://ecosystem.samcarlton.com/handoff): Passing work from one session to the next, or from one agent to another, so the new one can continue without the full history.
- [Secondary source](https://ecosystem.samcarlton.com/secondary-source): A description of the original material rather than the material itself, such as a summary, a README or a compaction note.
- [Smart zone](https://ecosystem.samcarlton.com/smart-zone): A name for the early part of a session, when an agent is focused and accurate.
- [Attention degradation](https://ecosystem.samcarlton.com/attention-degradation): The drop in an agent's sharpness as a session gets long.

Map view: https://ecosystem.samcarlton.com/compaction
