HYDRALOGIC
All posts
16 August 2026 · 4 min read

Auto-compact is eating your session

Claude was doing fine, then it forgot a decision we made an hour ago.

Topicsclaude code auto compactclaude code forgets contextclaude code context window full/compact command

You are three hours into a session. Early on you told Claude the API returns snake_case and must stay that way. Now it is writing camelCase, confidently, and you cannot work out what changed.

Nothing changed. Your conversation got long enough that Claude Code compacted it.

What actually happened

When the context window fills, Claude Code summarises the conversation so far and continues from the summary. That is the whole mechanism, and the important part is in the word “summarises”. A summary is lossy on purpose. The high-level shape of the session survives. The specific constraint you stated once, in passing, ninety minutes ago does not.

So the model is not ignoring you. It is answering honestly from a record that no longer contains what you said.

This is also why the failure feels arbitrary. Compaction fires on a token threshold, not on a task boundary — so it lands wherever you happen to be, which is usually mid-problem, and it takes whatever was least recently mentioned. The rules you set at the start are exactly the rules most likely to go.

What to do about it

Put durable rules in a file, not in the chat. Anything that must hold for the whole session belongs in CLAUDE.md, which is re-read rather than summarised. If a constraint matters in hour three, it was never safe as a sentence in hour one.

Compact when you finish something, not when you run out of room. Run /compact yourself at a task boundary — after a feature lands, after a debugging pass ends. Practitioners generally suggest compacting nearer 60% of capacity than 95%. The difference is not the token count; it is that you choose a moment where losing the detail is safe.

Tell it what to keep. /compacttakes instructions. “Keep the API contract decisions, drop the test refactoring” produces a materially better summary than the default.

Give isolated work its own context. A subagent starts fresh and hands back a result, so a long exploratory detour never enters your main session at all. Just watch what that costs — see the post on subagent bills.

The one-line version

Compaction is not a bug, and there is no setting that makes it lossless. Treat the conversation as scratch space and the file as memory, and the whole class of problem stops happening.

Provenance

Written by Hydralogic, not yet reviewed by a second person. This post describes problems reported by others rather than ones we measured ourselves — the reasoning is ours, the numbers are theirs. Check them below.

Where you stand

Twenty minutes to know what to fix first.

Free readiness check, scored by exam domain. No account, no card.