October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Claude Code Compaction: Why Your Session Forgets Mid-Task (and the Fix)

When a long Claude Code session loses the thread, save state to project files, then continue, resume by ID, or start fresh. Here's the workflow.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a long Claude Code session seems to lose the thread, the fix is to stop relying on the conversation as the only record of the task. Write the task state into files in your project, then resume or restart Claude Code and point it at those files. This guide covers the documented recovery commands, a state-file workflow, and what is and isn’t established about compaction.

What is actually known about compaction

Long sessions eventually run into the limits of a context window. Users describe the result as Claude Code “forgetting”: it repeats work, drops a decision you made earlier, or loses track of the next step. Anthropic’s documentation that covers this topic supports session-recovery commands and state-management advice. The pages reviewed for this article do not state a current automatic-compaction trigger threshold. They also do not guarantee which details survive compaction. So this article gives no numeric threshold and no list of what gets dropped. Treat any such claim elsewhere with caution unless it cites a current Anthropic Claude Code reference.

The practical consequence is simple: anything important that exists only in the conversation is at risk. Anything written into the project is not.

Step 1: Save state to files before a transition

Anthropic’s prompting best practices recommend that, for work spanning multiple context windows, you save progress and current state to memory. They also describe organizing progress in structured files that a later window can review. The template below is an editorial implementation of that advice, not a format Anthropic prescribes.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ask Claude Code to write a short state file (for example PROGRESS.md) in the project containing:

  • Goal: one or two sentences on what you are trying to achieve.
  • Decisions: choices made and the reason, so they aren’t relitigated.
  • Files changed: paths touched so far.
  • Checks run: tests or commands executed and their results.
  • Outstanding work: a short checklist.
  • Next step: the single next concrete action.

Update it at natural milestones, not only when the session feels strained. A short checklist is easier to recover than an implicit conversation summary.

Step 2: Choose how to get back in

Anthropic’s CLI reference documents two ways to return to earlier conversations.

Command What it does Use it when
claude -c or claude --continue Continues the most recent conversation in the current directory The session you want is the latest one in this project
claude -r "<session-id>" or claude --resume <session-id> Resumes a specific session by ID The session you want isn’t the most recent and you have its ID

Run claude -c from the same directory as the original work, since “most recent” is scoped to the current directory. Resuming recovers conversational context, but the CLI reference does not promise perfect recall of every detail, and neither command is documented as repairing or removing a compaction summary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 3: Decide between continuing and starting fresh

Anthropic’s guidance states: “Starting fresh versus compacting: When a context window is cleared, consider starting with a brand new context window rather than using compaction.” The stated reasoning is that Claude can rediscover state from the local filesystem. This is context-dependent advice, not a universal rule.

  • Favor a fresh session when the repository and your progress file reflect the real state of the work: code is committed or saved, tests exist, notes are current.
  • Favor continuing or resuming when the key information lives only in the conversation, such as exploratory reasoning, rejected approaches, or requirements you stated verbally and haven’t written down.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Step 4: Re-orient Claude explicitly

If a session feels disoriented, don’t just say “continue.” Give it a grounded instruction, for example:

Read PROGRESS.md and review the files it lists. Summarize the goal, what’s done, and the next step. Don’t change anything until I confirm.

Then check the summary against the repository (for instance with git status and git diff) and your notes. Don’t assume a resume alone restored every unstated decision. If something is wrong, correct it and update the progress file so the correction persists.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Failure modes to watch for

  • Stale state file: a progress file that isn’t updated is worse than none, because Claude will trust it. Refresh it after each milestone.
  • Wrong directory: claude -c looks at the current directory, so launching elsewhere gives you a different conversation.
  • Decisions kept only in chat: if a constraint matters, put it in the file.
  • Vague next step: “keep going” recovers poorly. Record a concrete action.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.