Skip to content

[BUG] Compacted context isn't saved if I exit immediately after compacting #22267

Closed as duplicate

Description

@JJC1138

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

I compacted a full context, then exited Claude Code, then resumed the session, and the context was full again as if it hadn't been compacted.

What Should Happen?

The compacted context should be saved even if Claude Code is exited immediately afterwards.

Error Messages/Logs

Steps to Reproduce

  1. Resume a session with a significant amount of the context window used.
  2. Run /compact and wait for that to complete normally.
  3. Exit Claude Code (I use Ctrl-D x 2 in case that's important).
  4. Resume session with claude --resume.
  5. Run /context and see that the context is still as full as it was before the compaction.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.29 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

Activity

  1. github-actions commented on Jan 31, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [Bug] Resume flag reverts to pre-compaction state after manual compaction #14462
    2. [BUG] Session data not persisting across recent compactions #14820
    3. [BUG] 2.1.27 session resume logic is loosing context #22107

    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

  2. github-actions commented on Feb 9, 2026

    @github-actions

    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.

  3. locked as resolved and limited conversation to collaborators on Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions