Mover

Why Claude Code forgets the plan after compaction

Claude Code forgets the plan after compaction when the plan existed only in the conversation, because compaction replaces the chat history with a summary, as of 2 October 2026. What comes back in full afterwards is what sits on disk: the project-root CLAUDE.md, auto memory, and a plan written in plan mode (Anthropic, What survives compaction). A plan you agreed in chat survives only as well as the summary describes it.

What survives compaction, and what is rewritten?

When a long session compacts, Claude Code summarises the conversation history to fit the context window, and each kind of content is treated according to how it was loaded (Anthropic).

WhatAfter compaction
Project-root CLAUDE.md and unscoped rulesRead again from disk. Anthropic
Auto memoryRead again from disk. Anthropic
A plan Claude wrote in plan modeRead again from disk. Anthropic
Files Claude read or editedUp to five read again, most recently changed first. Anthropic
Nested CLAUDE.md and path-scoped rulesReloaded only when Claude next reads a matching file. Anthropic
Everything else said in the chatKept only as the summary describes it. Anthropic

Every row is from Anthropic's page on the context window, read 2 October 2026.

The plan-mode row matters more than it looks. A plan Claude wrote in plan mode is stored as a file and comes back intact, while a plan you talked through and approved in ordinary chat becomes a few lines of summary.

When does Claude Code compact?

Automatically, as the context window nears its limit. Claude Code clears older tool outputs first and then summarises the conversation if it still needs room. Anthropic's own description says your requests and key code snippets are kept, and that detailed instructions from early in the conversation may be lost (Anthropic). That early stretch is usually where the plan was set.

You can move the point. /autocompact with a token count, such as /autocompact 500k, sets how full the window gets before the automatic pass runs, and models with a 1 million token window compact the same way at the larger limit (Anthropic).

How do you keep the plan through compaction?

Put the plan in a file Claude Code reloads. The project-root CLAUDE.md is read again after every compaction, and a file it imports with @path/to/plan.md loads with it at launch (Anthropic). Plan mode does the same job for a single task, since its plan is re-injected from disk.

Tell the summary what to keep. Run /compact with a focus, such as /compact focus on the auth bug fix, or add a section headed "Compact Instructions" to CLAUDE.md. The summary then keeps what you named instead of what the automatic pass guesses matters (Anthropic).

Run a hook either side of it. A PreCompact hook runs before every compaction, manual or automatic, and receives what triggered it; exiting with code 2 blocks the compaction. A SessionStart hook that matches the compact source runs afterwards, and its output is added to the compacted context (Anthropic). Our guide to Claude Code hooks shows how a hook is set up.

Clear between tasks. Starting unrelated work with /clear keeps old conversation from crowding the window, so the automatic pass comes later or not at all (Anthropic).

What do Claude Code users do about it?

We counted posts and comments in r/ClaudeCode and r/ClaudeAI from the 30 days to 2 October 2026 that matched this question. 13 of 154 distinct people across 4 threads write the plan and their decisions to a file before the chat is compacted or cleared, so the next stretch of work can read it back (thread 1, thread 2, thread 3, thread 4).

One thread asks outright whether Claude can be made to write a handoff file before a chat gets compacted (Reddit thread). In another, a commenter answers that to "warn Claude that a compaction is coming and to update a handoff doc that's a very simple hook that Claude can write in one go" (Reddit thread). Three people across two threads name what the summary drops (thread 1, thread 2), and one put it as "What gets lost is the why, and chat summaries are bad at keeping it" (Reddit thread).

A separate group, 5 of the same 154 people across 3 threads, talk about when compaction should happen, mostly by setting the threshold lower with /autocompact (thread 1, thread 2, thread 3).

Is an instruction missing after /compact?

Anthropic lists three causes when an instruction disappears after compaction: it was given only in conversation, it lives in a nested CLAUDE.md that has not reloaded yet, or it is a path-scoped rule that has not matched a file since. The fix it gives is to move conversation-only instructions into CLAUDE.md (Anthropic). To check what is loaded right now, run /context. For how CLAUDE.md itself should be written, see how to write a CLAUDE.md.

Common questions

Can I stop Claude Code from compacting?

A PreCompact hook that exits with code 2 blocks it. If the compaction was started to recover from a context-limit error the API already returned, blocking it makes the current request fail (Anthropic).

Does CLAUDE.md survive compaction?

The project-root CLAUDE.md does: Claude Code reads it again from disk after /compact. Nested CLAUDE.md files reload when Claude next reads a file in their folder.

Does auto memory survive compaction?

Yes. Anthropic lists auto memory among the things re-injected from disk after compaction.

How we checked

Every product fact on this page comes from Anthropic's Claude Code documentation (the context window, how Claude Code works, memory and hooks pages), all read on 2 October 2026. The forum count covers posts and comments in r/ClaudeCode and r/ClaudeAI over the 30 days to that date, pulled from the Arctic Shift archive and counted by distinct author. We quote no usernames.

Last verified 2 October 2026. Every product fact links to Anthropic's own documentation.

Sources

  1. Anthropic, What survives compaction checked 2 October 2026
  2. Anthropic, How Claude Code works: when context fills up checked 2 October 2026
  3. Anthropic, How Claude remembers your project checked 2 October 2026
  4. Anthropic, Hooks reference: PreCompact checked 2 October 2026

From the publisher

Mover (our product)

Mover keeps the plan in that kind of file for you, with what you decided and why, and its start-of-session hook loads it again after every compaction.

Mover is a $49 one-time planning tool that runs inside Claude Code or Codex, keeps your plan in plain files on your own computer, and says so when your work drifts from it. It is the wrong choice if you want something that keeps running while your computer is off.

One payment. 30-day money-back guarantee.