## Definition **Context compaction** is the harness behaviour of summarising earlier turns of a conversation to free room in the [[Context Window]] when it approaches its limit. The summary replaces the originals; what survives is a *paraphrase* of what happened, not the source. ## Failure Modes (the "lobotomy" effect) 1. **Decision drift.** A trade-off debated three turns ago gets re-debated because the rationale didn't survive compaction. 2. **Convention loss.** "We agreed on `snake_case` for these tables" becomes "we discussed naming." 3. **Phantom progress.** The summary asserts "implemented feature X" but the code on disk is incomplete — and the model now believes its own summary. ## Survival Rules - **Anchor durable decisions outside the conversation.** A [[Architecture Decision Record]] is immune to compaction. - **Restart sooner than instinct suggests.** A fresh session with a tight prompt and the right files often outperforms a 4-hour-old session with summary damage. - **Treat compaction warnings as checkpoints.** When the harness warns it's about to summarise, save state to disk *before* it does. ## Recovery Drill When drift is detected: 1. End the session. 2. Confirm the relevant convention lives in `docs/CONVENTIONS.md` or `docs/DECISIONS.md`. 3. Confirm [[AGENTS.md Convention File]] points at it. 4. Start a fresh session. ## Related - [[Context Window]] - [[Lost in the Middle Effect]] - [[Context vs Memory]] - [[Layered Memory Architecture]] - [[Architecture Decision Record]]