Contextcore
Compaction & summarisation
Shrinking long histories so long tasks keep fitting in the window.
What it is and why it exists
When a conversation or agent run approaches the limit, older turns are replaced by a summary that keeps decisions, facts and open tasks; old tool outputs are cleared or truncated. It trades some detail for the ability to keep going.
Quick prototype
Keep the last N messages.
In production, at scale
Trigger compaction at a threshold (say 70% of the window), summarise with explicit instructions on what to keep (goals, decisions, IDs, unresolved items), clear stale tool results first, and store full transcripts outside the window so nothing is truly lost.
Vendors and tools
| Claude Code / Agent SDK | Automatic compaction of long sessions |
|---|---|
| LangGraph / LangChain memory | Summary and trimming utilities |
| Anthropic context editing | Clears stale tool results server-side |
How it fails
- Summaries that drop the one ID the task needed
- Compacting every turn (cost) or never (overflow)
What the interviewer asks next
What must survive a compaction?
The user’s goal, constraints, decisions taken, identifiers in play, what’s done and what’s left — the things a colleague would need to pick up the task.