[BUG] Memory Loss After Auto-compact

Resolved 💬 4 comments Opened Jun 3, 2025 by diegonix Closed Jun 10, 2025

Environment

  • Platform (select one):
  • [ x ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.9 (Claude Code)
  • Operating System: Ubuntu 24.04
  • Terminal: Konsole

Overview

First, I'd like to express my appreciation for Claude Code - it's an excellent tool that has significantly improved my development workflow. The auto-compact feature is particularly valuable for maintaining long-running conversations on track.

I understand that Claude's 200K token context window has received criticism from some users who consider it insufficient. However, I believe the context size isn't the core issue - rather, it's about applying effective techniques to manage context properly. The auto-compact feature has been tremendously helpful in this regard. Having 2M tokens of context wouldn't necessarily be better if attention gets lost among so many tokens. It's more valuable to have a smaller, focused context window with a tool that maintains complete attention on the problem being discussed and solved.

Bug Description

After an auto-compact operation occurs, Claude Code appears to lose its working memory completely. While the system can read memory when explicitly prompted, it doesn't proactively apply previously established context, project settings, or environment configurations without manual intervention.

Steps to Reproduce

  1. Start a Claude Code session and establish project configuration (environment variables, project keys, etc.)
  2. Continue working until auto-compact is triggered
  3. Attempt to continue with tasks that rely on previously established context

Expected Behavior

After auto-compact, the session should:

  • Automatically restore essential memory and context
  • Maintain awareness of project settings and environment variables
  • Continue the conversation seamlessly without requiring manual context restoration
  • Preserve the established workflow and configurations

Actual Behavior

After auto-compact:

  • Claude appears to lose all working memory
  • Manual prompting is required: "Please read the memory again"
  • Even after reading memory, Claude doesn't apply the context effectively
  • Additional manual prompts needed: "Did you read the project keys and settings from environment variables?"
  • The session becomes less productive until all context is manually re-established

Impact

This significantly disrupts the development workflow, as users must repeatedly stop productive work to restore context that should persist automatically after compaction.

Suggested Resolution

Implement a post-compact memory restoration process that automatically reloads and applies essential context, ensuring continuity in long-running development sessions.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗