[FEATURE] Allow claude to save important context for a session and avoid auto compacting that

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Sep 16, 2025 · closed Sep 18, 2025

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When auto compaction happens, claude trims the context. There should be a way to allow claude to save the important context and prevent it from auto trimming. If I ask claude to read a document, it creates a list of tasks to perform, it should not be auto compacted after a while when task 1 to k is run. The list of tasks to perform should be present for task k + 1 to n to avoid mistakes.

Proposed Solution

There should either be a wildcard to allow claude to store the summary of context like Read the document (it should store summary or list of tasks to perform to avoid auto-compacting) or it should automatically decide if the context should be persisted. If needed, it should read the context again after auto compacting to not lose sense.

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] · 1 year ago

---

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7584
  2. https://github.com/anthropics/claude-code/issues/3841
  3. https://github.com/anthropics/claude-code/issues/6354

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

---

coygeek · 1 year ago

Hey, I've definitely run into this issue myself! It's frustrating when you have a good plan going and then auto-compaction makes Claude lose the plot.

I dug into the docs and changelogs a while back and found a couple of features that really help manage this. It seems like the team has built-in ways to guide the compaction process.

Guiding the Compaction

You can actually give Claude instructions on what to remember when it compacts the conversation.

  1. Manual Compaction: You can trigger a compaction yourself and tell it exactly what's important. For your use case, you could try:

/compact Keep the full list of remaining tasks to perform and the key takeaways from the document.

  1. Guiding Auto-Compaction: For a more permanent fix, you can add instructions to your project's CLAUDE.md file. This tells Claude how to handle auto-compaction every time for that specific project. Add a section like this:

```markdown
# Summary instructions

When you are using compact, please focus on preserving the full, un-summarized list of tasks to be performed. Also, retain the main summary points of any documents we've discussed.
```

Other Helpful Commands

I also noticed a couple of commands (some might not be in the main docs yet) that are super useful for this:

  • /context: This command is a lifesaver. It shows you a visual breakdown of your current context window usage. It helps you see why a compaction is about to happen, so you're not caught by surprise.
  • /todos: This one seems tailor-made for your issue. Claude has an internal to-do list tracker. If you ask it to create a list of tasks, you can use /todos to see what it's tracking. This seems more robust than just relying on the conversation history and might survive compaction better.

And if all else fails, you can disable auto-compaction completely in the /config menu, though I've found that guiding it with CLAUDE.md usually works well enough.

Hope this helps you out

bhutani92 · 1 year ago

Thank you so much! This is helpful.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.