Claude Code "Context Limit Reached": How to Continue in a New Session Without Losing Progress
Hit "Context limit reached" in Claude Code? Here is what /compact, /clear and claude -c really do, and how to start a new session without losing what was finished, tested and next.
On this page
- Quick answers: what should I do right now?
- What does "Context limit reached" mean in Claude Code?
- What happens when the context window fills up?
- How do I continue with /compact?
- How do I continue with /clear?
- How do I resume the same conversation later?
- Why do I lose progress when I start a new session?
- How do I continue in a new session without losing progress?
- /compact vs /clear vs claude -c vs a handoff
- FAQ
- What does "Context limit reached" mean in Claude Code?
- Does Claude Code compact automatically?
- Does /compact lose information?
- What is the difference between /compact and /clear?
- How do I get yesterday's session back?
- Does a bigger context window fix this?
- Does PCSKit send my code anywhere?
- Sources
When Claude Code reports that the context limit is reached, run /compact (optionally with a focus) or /clear to continue, or start a new session and resume from saved state. /compact keeps a summary, while /clear starts empty. Neither guarantees the next session knows what was finished and tested, so record progress outside the chat.
Last updated: November 23, 2026 · Written by Kumar, founder of Causly. Disclosure: I build PCSKit, which is mentioned below.
Quick answers: what should I do right now?#
| Your situation | Do this |
|---|---|
| Same task, you need more room | /compact focus on what you are doing next |
| Switching to unrelated work | /clear |
| You closed the terminal and want the same conversation back | claude -c (most recent in this directory) or claude -r "<session>" |
| You want to see what is using the space | /context |
| You want a fresh session that still knows what is done, tested and next | Save state outside the chat, then resume from it (see below) |
What does "Context limit reached" mean in Claude Code?#
Everything Claude knows about your session sits in one context window: your instructions, the files it read, its own replies and tool output. When that window is nearly full, there is no room left for the next step. The message people report is "Context limit reached · /compact or /clear to continue" (see this bug report).
Claude Code normally compacts automatically as you approach the limit, so a full window does not have to end your session. If you do hit the wall, or you want control over what survives, you have the options below.
What happens when the context window fills up?#
According to the Claude Code docs, compaction replaces the conversation with a structured summary. After that:
CLAUDE.mdat the project root and auto memory are re-injected from disk.- Claude Code re-reads up to five of the files Claude read or edited, most recently modified first.
- Path-scoped rules and nested
CLAUDE.mdfiles are loaded into the conversation when triggered, so compaction summarizes them. If a rule must persist, put it in the rootCLAUDE.md.
The conversation itself, including the reasoning behind decisions, becomes a summary.
How do I continue with /compact?#
Run /compact with instructions about what to keep:
/compact focus on the auth bug fix and the failing refresh-token test
The summary then keeps what you chose, instead of what the automatic pass guesses matters. Anthropic recommends compacting proactively, with a description of where the work is heading, because automatic compaction can drop details when the model cannot predict your next step. Their session management article gives the example of a summary losing a warning from an earlier debugging session.
You can also compact earlier by setting the auto-compact window with /autocompact, for example /autocompact 500k (see the docs for accepted values).
How do I continue with /clear?#
/clear starts a new session. Nothing carries over except what you write into your first message, so it is more work than /compact, but it avoids a lossy summary. It is the right choice when you move to unrelated work. Old conversation takes up space the next task needs, and costs tokens on every message.
How do I resume the same conversation later?#
claude -ccontinues the most recent conversation in the current directory.claude -r "<session>" "query"resumes a session by ID or name, for exampleclaude -r "auth-refactor" "Finish this PR".
Both bring back the old conversation. If that conversation is already at the limit, resuming it does not give you free room.
Why do I lose progress when I start a new session?#
A new session starts without the old conversation. Three things usually go missing:
- What was actually finished. The old agent said "done", but did the tests run?
- What was in flight. The file it was halfway through editing.
- What not to touch. The constraint you explained once, early on.
The usual workaround is asking the agent to write a summary before it runs out of room. That summary is a claim, written by the agent under the most pressure. It can say tests pass when they never ran.
How do I continue in a new session without losing progress?#
Keep a record of the project that does not live in the chat. Whatever you use, carry these over:
- The original task
- What is done, and how you know (a test run, not a claim)
- What is in progress, and which files are uncommitted
- Failing tests and open problems
- Do-not-touch notes
- Exact next steps
You can do this by hand in a file. PCSKit (Project Continuity Kit) automates it: it records git state, file hashes and test runs while the agent works, then builds the handoff from that evidence.
npm install -g @knihal/pcskit
cd your-repo
pcs init
pcs connect claude-code
pcs hooks install
With hooks installed, Claude Code sessions start, checkpoint and end by themselves. While you work:
pcs task add "Add the --json flag to the exporter"
pcs test --task 1 -- npm test
pcs note add next "Wire the flag into the CLI entry, then add tests"
When the limit hits:
pcs session end --reason limit
pcs handoff
In the new session, run:
pcs resume --agent claude
With MCP connected, the agent calls pcs_resume itself. pcs resume --prompt prints a ready-to-paste takeover prompt. Resume checks the handoff against the evidence log and labels every line verified, reported or inferred. A task counts as verified only if a passing test run that PCSKit executed is linked to it and the code has not changed since.
PCSKit does not restore the old conversation. It restores the state of the project and what is known about it. If an agent died before writing a handoff, PCSKit builds one from the evidence log and marks the interrupted session as inferred.
/compact vs /clear vs claude -c vs a handoff#
| Keeps conversation | Separates verified from claimed | Fresh context | Effort | |
|---|---|---|---|---|
/compact | As a summary | No | Partly | Low |
/clear | No | No | Yes | You write a brief |
claude -c / -r | Yes | No | No | Low |
| Evidence-based handoff | No | Yes | Yes | One command (pcs resume) |
FAQ#
What does "Context limit reached" mean in Claude Code?#
The context window is nearly full. Run /compact or /clear, or let automatic compaction run.
Does Claude Code compact automatically?#
Yes. It compacts as you approach the limit, so a full window does not have to end the session. You can also compact earlier yourself.
Does /compact lose information?#
It is lossy: the conversation becomes a summary. CLAUDE.md and auto memory are reloaded from disk, and Claude Code re-reads up to five recent files.
What is the difference between /compact and /clear?#
/compact keeps a summary of the conversation. /clear starts a new session with nothing carried over except what you write.
How do I get yesterday's session back?#
Use claude -c for the most recent conversation in the directory, or claude -r "<session>" by ID or name.
Does a bigger context window fix this?#
It gives you more room. Some models support a 1M-token window, but Anthropic notes that context rot can still happen as context grows, so compacting proactively still helps.
Does PCSKit send my code anywhere?#
No. It is local-first, with no network access and no telemetry. Data lives in .pcs/ inside your project.
Sources#
Get new posts by email
High-signal notes on AI, automation and building systems. No spam.