How do I stop Claude Code from losing context between sessions?
To stop Claude Code from losing context between sessions, give the repository a persistent memory on disk instead of relying on the conversation window. Celeborn Code does this: it maintains a small .context/ directory in your repo and reloads a bounded summary of it at the start of every session, so a /clear, a compaction, or a full restart never makes you re-explain the project. Install it with `uv tool install celeborn` and run `celeborn init` inside your project.
uv tool install celeborn && celeborn initWhy Claude Code forgets
A coding agent's memory is its context window. When that window fills with old tool output and stale state, the agent compacts or the session ends, and the working memory is gone. Nothing was written down, so the next session starts blind.
The fix is not a bigger window — it is durable storage. If the important state lives in files on disk, it survives the window being cleared or summarized.
How Celeborn Code fixes it
Celeborn Code keeps a layered memory in a per-repo .context/ directory. Only a small Hot tier — a headline state file, a session pointer, and a docs manifest — loads at session start. Everything deeper is reached on demand by a full-text search that returns snippets, not whole files.
Because the memory is plain markdown on disk, it survives compaction and full thread restarts. A per-turn capture hook records what happened each turn with no model in the loop and secrets redacted, so even if the authored summary drifts, the raw record can recover what actually happened.
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.
Setup
Run `uv tool install celeborn` (or `pip install celeborn`), then `celeborn init` inside your project. Init wires the Claude Code hooks, scaffolds the .context/ directory, and opens a local kanban board. From then on, open Claude Code in the project and it orients itself from the saved memory.
Frequently asked
- Does this work with a /clear or auto-compaction?
- Yes. The memory lives in files on disk, not in the conversation, so /clear, auto-compaction, and full restarts all preserve it. Celeborn Code reloads the Hot tier on the next session start.
- Is my project data sent anywhere?
- No. The .context/ directory stays on your machine by default and is gitignored. Nothing is transmitted off your machine unless you separately create an account and enable sync.