---
title: "Discussion on \"Claude Code forgets what it was doing after compaction: why, and the fix\" | Hashnode"
description: "Discussion on \"Claude Code forgets what it was doing after compaction: why, and the fix\". What survives Claude Code compaction and what doesn't, how to keep rules and the plan across it, and how to resume a task after /clear or a new session."
url: "https://hashnode.com/posts/claude-code-forgets-what-it-was-doing-after-compaction-why-and-the-fix/6b00e5a57106a726553a481f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Claude Code forgets what it was doing after compaction: why, and the fix](https://greatworkco.hashnode.dev/claude-code-forgets-what-it-was-doing-after-compaction-why-and-the-fix?utm_source=hashnode&utm_medium=feed)

What survives Claude Code compaction and what doesn't, how to keep rules and the plan across it, and how to resume a task after /clear or a new session.

1d ago · 6 min read · greatworkco.hashnode.dev  
Read the article

-   [#claude](https://hashnode.com/tag/claude)
-   [#ai](https://hashnode.com/tag/ai)
-   [#llm](https://hashnode.com/tag/llm)

## Written by

[Great Work](https://hashnode.com/@greatworkco)

@greatworkco

  
[View profile](https://hashnode.com/@greatworkco)

Small, focused apps for Mac, iPhone and the web, including Multimeter for the Mac menu bar.

## Responses 1

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[23h ago](https://hashnode.com/posts/claude-code-forgets-what-it-was-doing-after-compaction-why-and-the-fix/6b00e5a57106a726553a481f/comment/6b0175f4ec266a07f8720c08)

Listing exactly what survives compaction from disk versus what gets flattened into the summary clears up why long agent sessions suddenly drift after two hours. Chat-only constraints feel permanent while you are typing them, yet they are the first details smoothed away during summarization.

Using a SessionStart hook with the compact matcher to re-inject live state like recent git commits and active checklist items is much more reliable than relying on the model to remember prior turns. Keeping durable invariants in root CLAUDE.md while storing volatile step progress in an external file keeps both halves predictable.
