The bar hits the top and the session stops carrying you.
“This makes long-running coding sessions unreliable because Claude Code can stop itself at the context limit instead of preserving state and continuing.” That’s one developer’s summary of hitting the ceiling mid-task — the session doesn’t crash, it just stops being the thing you were relying on to hold the thread.
Sometimes it isn’t even at the top when it happens. Another report filed the same symptom as an outright bug: “[BUG] Compaction fails with ‘context window limit’ error even when context usage is low (e.g., 20%).” Whether it fires right on schedule or misfires early, the question in the moment is the same: what do you actually do next?
There's a fixed ceiling, and compaction is the release valve.
Anthropic’s own documentation is direct about the normal case: “Claude Code compacts automatically as you approach the limit, so a full context window doesn’t end your session. The automatic pass works the same way as the /compactstep in the timeline.” (code.claude.com/docs/en/context-window.) Working as designed, that’s a non-event — the conversation gets summarized, the older turns drop, and the session keeps going thinner.
The two failure modes on this page both come from the same fixed-ceiling mechanic pushed to its edges. The deadlock: compaction itself has to process the conversation to summarize it, so a window that’s already flush against the top may not leave enough headroom for that pass to finish. The regression: some sessions have been forcing a compact far below where the ceiling actually is, which looks identical from the outside but has a different cause. Neither is what the docs describe as the normal path — both are the gap this page covers.
The instincts that seem reasonable, and where each one stops.
Trust auto-compact to always catch it.It usually does — that’s the documented behavior above. But “usually” is doing work: a compaction pass can misfire well before the real ceiling, and near the true top it can run out of room to complete at all. You can’t tell which session you’re in until it happens.
Keep going and hope it resolves.Pushing through doesn’t create room — the session can stop itself at the limit instead of preserving state and continuing, and every turn you spend hoping is a turn you didn’t spend acting.
Jump to a bigger-window model mid-session.A 1M-token variant genuinely buys more runway. But per Anthropic’s own docs, “compaction works the same way at the larger limit” — it’s a longer version of the same wall, not a different wall. See the longer version here.
What to actually do, by which situation you're in.
Check where you actually stand. Run /contextfor a live breakdown of what’s using the window, and /memory to open the files feeding it — before guessing, look.
Getting close, same task left to do. Run /compactwith instructions — “/compact focus on the auth bug fix,” for example — before starting the next chunk of work. Anthropic’s docs: “The summary keeps what you choose instead of what the automatic pass guesses is important.” Acting before it’s forced beats letting the automatic pass decide for you.
Getting close, switching to unrelated work. Run /clear instead of compacting. Per the docs, old conversation “crowds out the files you need next and costs tokens on every message” — there’s nothing in it worth summarizing if the next task doesn’t need it.
Heavy reading ahead. Delegate it to a subagent. Its file reads fill a separate context window; only its summary comes back to yours.
Already jammed — compaction won’t run.This is the path the docs don’t cover. There’s no move that recovers the working context from inside a deadlocked window. Take the loss deliberately: /clear, or end the session and start a new one, and re-orient from whatever you wrote down outside the conversation — a decisions log, a CLAUDE.md, notes from ten minutes ago. The failure isn’t that you lost the context; it’s not having anything durable outside it to come back to.
The session itself is the constraint, not one task. A 1M-token model variant (Fable 5, Sonnet 5, Opus 4.6 and later, Sonnet 4.6) raises the ceiling — see Extended context for availability. It helps exactly one session go further; it doesn’t carry anything past the point you close it.
What a session looks like when it never has to reach for the emergency toolkit.
One measurement, from our own production telemetry — a live workload, not a benchmark. A single Claude session ran 11,232 turns without ever needing the compact-or-clear decision above, because the standing record lived outside the conversation from the start. Each turn sent about 116 tokens of genuinely new input against roughly 445,000 tokens of already-computed context: 99.97% of what it reasoned against was served from cache, not re-summarized from a shrinking window.
| What was measured | The number |
|---|---|
| turns in one session | 11,232 |
| new input per turn | ≈ 116 tokens |
| served from cache | 99.97% |
| where it's from | Vinculum production telemetry, 2026-06-09 — one live session, measured, not a benchmark |
Closing a full session stops being a loss.
Every option above still works without any of this — /compact, /clear, and subagents are genuinely the right tools. What a substratechanges is what “starting over” costs. If the decisions, the dead ends, and the current state already live as addressable records outside the transcript, then /clearor a fresh session isn’t a step backward — it’s the same checkpoint compaction was always trying to be, just without the summarizer’s losses or its need for headroom to run.
A stateless model can then boot into continuity by reading a briefing instead of hoping the summary caught what mattered. The context window still fills. It just stops being the only place the work lived.
Common questions.
What if /compact won't run because there's no room left?
That’s the deadlock, not the normal case: compaction has to read the conversation to summarize it, so if the window is already flush against the ceiling there may not be enough headroom left for the compaction pass itself to complete. One report of a session stuck in exactly that cycles between auto-compacting and immediately showing almost no room left again, burning turns without finishing any work. There is no graceful recovery from inside that state — the two moves that work are /clear(accept losing the working context and keep the session) or ending the session and starting a fresh one. Either way you’re re-orienting from whatever you wrote down outside the conversation, not from the conversation itself.
Why did my session start forcing compaction way earlier than before?
If compacts are landing around 70% instead of running until the high-90s, that matches a logged regression where sessions block and force a compact at roughly 70% capacity instead of the usual ~99%. It isn’t a setting you broke — the same toolkit below still applies, it just gets forced on you sooner than it should.
Does a 1M-token model make this permanently go away?
It moves the wall, it doesn’t remove it. Anthropic’s own docs are direct about this: “Compaction works the same way at the larger limit.” A million-token window means a longer runway before you hit the mechanics described on this page, not an exemption from them. See vs. a bigger context window.