How do I keep Claude Code's memory through auto-compaction?
To keep Claude Code's working memory through auto-compaction, store that memory in files before compaction happens. Celeborn Code checkpoints the project's state to a local .context/ directory every turn and before compaction, then reloads a bounded summary when the session resumes — so auto-compaction clears the conversation window without losing what the agent knew. Install it with `uv tool install celeborn`.
uv tool install celeborn && celeborn initWhat compaction destroys, and what it doesn't
Auto-compaction summarizes and discards the conversation window to free room. Anything that lived only in the conversation — decisions made, files touched, the current plan — is lost or lossily summarized. Anything written to disk is untouched.
So the strategy is simple: get the important state onto disk before the window is compacted.
How Celeborn Code survives it
Celeborn Code runs a capture hook every turn that records a faithful account of the turn to disk, and a checkpoint step that keeps a small headline state file current. Before a compaction it panic-saves a snapshot first, so a durable record always exists before the window is summarized. On the next session, only the bounded Hot tier reloads, so resuming stays cheap even after many compactions.
The capture is deterministic — no model in the loop — and secrets are redacted on the way in. It never overwrites your authored summaries; it is an always-current safety net beneath them.
On one long-lived project, Celeborn's own memory-economy counter estimates roughly 325 million tokens saved across 167 session-load events — the difference between loading the bounded Hot tier and re-reading the entire accumulated context each time. The number is an estimate and grows with project age; the mechanism is what matters: the Hot tier stays a few thousand tokens no matter how much total memory the project accumulates.
Frequently asked
- Do I have to do anything manually before compaction?
- No. Celeborn Code's hooks checkpoint and capture automatically every turn, and it panic-saves before a compaction. You do not need to remember to save.
- Does resuming get slower as the project grows?
- No. Only the bounded Hot tier loads on resume regardless of total memory size, so resuming stays roughly constant in cost while the accumulated memory grows.