chat-recall

Compacting conversation: what Claude Code keeps and drops

A long session fills the context window, Claude Code summarizes it, and the conversation carries on with less behind it. You get one line of warning beforehand and no marker afterwards, so the first real sign is the assistant re-asking something you settled an hour ago.

What compaction actually is

Two things put the word in front of you. The status line counts down in % until auto-compact, and when it gets close Claude Code says so outright:

shortly before it fires
Autocompact will trigger soon, which discards older
messages. Use /compact now to control what gets kept.

A session that outgrows the model's context window can't just keep going as-is. Claude Code summarizes everything that came before and carries that summary forward instead of the full transcript. That's the right engineering trade-off: the alternative is refusing to continue at all.

The summary itself is good. It's also lossy, and it's lossy in one specific direction: it keeps the conclusions and drops the reasoning that produced them.

How it shows up in practice

It re-suggests something you already rejectedThe rejection lived in the part that got summarized away. The reason it was rejected went with it, so the same idea comes back looking brand new.
It forgets a constraint you stated once"We can't use that library, licensing issue" survives as a fact for a while, then quietly stops. Constraints stated early in a long session are the most likely casualty.
It loses the shape of a failed attemptSix things you tried become "several approaches were attempted" — not enough detail to stop it from trying the seventh one identically.
You can't tell it even happenedThere's no marker anywhere in the answer. The assistant isn't aware it forgot anything, so it answers with the exact same confidence either way.

What's actually still there

The full transcript is still sitting on your disk. Compaction appends one record to the session's .jsonl file and then keeps appending to that same file:

the boundary record
{"type":"system","subtype":"compact_boundary",
 "content":"Conversation compacted",
 "compactMetadata":{"trigger":"manual","preTokens":205229}}

In one session I pulled apart, that line sits at 1588 of 2257. Every message, tool call and rejected approach from the first 1587 lines is still there, in order, under ~/.claude/projects/<project>/<session>.jsonl. The record straight after the boundary is a user message flagged isCompactSummary, and that summary is the whole of what the model now sees.

So the detail isn't gone. It's out of reach of the thing that needs it, and it has an expiry date: transcripts are deleted after cleanupPeriodDays, 30 by default.

Putting it back within reach

An index over those transcripts turns "gone" into "one search away" — and, more usefully, lets the assistant do the searching itself instead of you trying to remember what to paste back in:

after a compact
> what did we decide about the connection pooler earlier?
  recall_search finds the exchange in the pre-compact transcript
  and quotes the reasoning, not just the conclusion

The same trick works across the boundary a compact creates. recall_smart_resume reads the whole session straight from disk, so it can report what was decided and what was left unfinished even when the model's own context no longer holds any of it.

Compacting on purpose

The trigger field above is the difference between the two kinds. manual means you ran /compact; automatic means the token count ran it for you and chose what survived on its own. Running it yourself, early, is the only version where you get a say:

while you still have room
> /compact keep the three pooler configs we rejected
  and why each one failed. drop the file listings.

A PreCompact hook supplies those instructions on every compaction, including the ones you did not ask for.

If you are starting something unrelated, /clear is the better command. It opens a new transcript and carries nothing forward, which beats paying window on a summary of work you have finished.

The one habit that actually helps

Say decisions out loud, inside the session. "We're going with the pooler because prepared statements break in transaction mode" is a sentence that survives being indexed, and either of you can find it again later. The same decision left implicit in a diff isn't recoverable by anything, before or after a compact.

This is a real limit, not a marketing line: a classifier can only pick up reasoning that was actually written down somewhere. Nothing recovers what only ever existed in your head.

What this doesn't fix

It doesn't stop compaction, and honestly it shouldn't — a session that never compacted would just fail outright instead. It also doesn't make the model's context window any bigger: recall works as a tool call, so the assistant fetches what it needs exactly when it needs it, and nothing gets spent on context it never actually uses.

Start free, no card What claude --continue does not do

Questions

What does "compacting conversation" mean in Claude Code?The session has filled the model's context window, so Claude Code summarizes everything said so far and continues from that summary. It writes a compact_boundary record into the transcript and keeps appending to the same file, so the conversation carries on with a condensed version of itself behind it.
Does compacting delete my conversation?No. The transcript is a .jsonl file under ~/.claude/projects/ and compaction only appends to it. In a session I checked, the boundary was at line 1588 of 2257, with all 1587 earlier records intact. What changes is the model's view. Claude Code does delete transcripts after cleanupPeriodDays, 30 by default.
Why does Claude start repeating itself after compacting?The summary keeps conclusions and drops the reasoning behind them. An approach you rejected survives as "several approaches were attempted", without the reason, so the same suggestion comes back looking new. Constraints you stated once early in the session are the most likely casualty.
How do I stop Claude Code from compacting?DISABLE_AUTO_COMPACT in the environment, or autoCompactEnabled in settings, and the status line reads "auto-compact is off". Claude Code warns that you will hit the context limit and lose the conversation instead. Raising the threshold with /autocompact is usually the better move.
Can I get back what compaction dropped?Yes, from the transcript, because everything before the boundary is still in the file. Reading it back by hand means scrolling a JSONL file; an index over those files lets the assistant search across the boundary itself and quote the original exchange instead of the summary of it.
What is the difference between compacting and clearing?/compact summarizes and continues in the same session and the same file. /clear starts a fresh conversation in a new file and carries nothing over, leaving the old transcript untouched on disk. Compact to keep going on one task, clear when you switch to another.

More notes

Context left until auto-compact: what the number countsThe percentage in the status line, what makes it fall, how to move the threshold, and what actually happens to your conversation when it reaches zero.
/clear vs /compact in Claude CodeOne summarizes the conversation and keeps going. The other starts a fresh one. What each does to the transcript on disk, and which to reach for.
Compact instructions: tell /compact what to keepCompaction decides what survives unless you decide for it. Passing instructions to /compact, and the PreCompact hook that supplies them every time.