Context Compaction for AI Agents: Keeping Long Runs Inside the Window
When an agent run outgrows the context window, dropping the oldest turns is the default and the fastest way to lose the idempotency key, the job handle, and the constraint the user stated in their first message. This article builds context compaction as a memory design: a structured anchor block the harness renders and updates outside the transcript, an audited summary for the narrative, side-effect machinery that reads the ledger and never the context, and a test battery that pins each property.