liveBook · Manning

Compaction

As explained in Spec-Driven Development

The process of replacing earlier interaction content with a shorter summary when an AI agent approaches its context limit.

Compaction is what many coding agents do when an interaction nears its context-window limit: they summarize the conversation and continue from that summary. Messages, files, and tool output all consume context. Summarization makes room to continue, but the agent may omit a decision it will need later. section 1.3

A constraint that disappears

Suppose a constraint was agreed in the third message of a coding session. If it is absent from the compacted summary, the agent may proceed as if it was never agreed. The resulting symptoms can include forgotten decisions, reintroduced behavior, changes in the wrong place, and repeated corrective prompts. section 1.3 section 2.3.1

Do not rely on conversation history as the only record of important intent. Extract decisions and constraints into durable artifacts, then load the relevant ones into future sessions. This gives the agent navigable context for implementation without filling its window with every prior message or every available file. A larger window delays compaction but does not resolve unclear priorities or contradictory accumulated decisions. section 1.3 section 2.3.1

How Spec-Driven Development covers it

How deep it goes
Defines the trigger and summary-based continuation, then traces lost constraints to observable failures without specifying a summarization algorithm.
Examples
Uses an early-session constraint lost from a summary and a new-session request for 90-day URL expiration.
What it assumes
Defines context windows and compaction while assuming familiarity with coding-agent conversations and implementation work.
What you can do after
Diagnose/debug with it by recognizing lost decisions and preserving critical constraints in artifacts that can be loaded into later sessions.
How it connects
Connects compaction to context windows, context engineering, intent artifacts, and conversational state.

Also explained in

Compare how 10 books explain compaction →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spec-Driven Development. The section links point to the parts of the book it draws on.