[BUG] Severe Session Memory Loss - Instructions and Context Not Retained
Environment
Platform: Multiple systems affected Claude CLI version: 0.2.54 (Claude Code) Operating System: Various (Linux, Windows) Timeline: Issues began June 23, 2025
Bug Description Claude Code is experiencing severe memory loss within sessions, failing to retain explicit instructions, configuration settings, and context from earlier in the same conversation. Expected Behavior
Instructions given within a session should be remembered and applied consistently Configuration preferences should persist throughout the session Context from earlier in the conversation should inform later responses Explicit user corrections should be retained and applied
Actual Behavior
Instructions given 30 minutes earlier are completely forgotten Configuration settings are repeatedly asked for despite being provided Previous context is lost, requiring re-explanation of the same information User corrections and preferences are not retained
Specific Examples Git Configuration Memory Loss
Explicitly instructed Claude Code to use my name and email for Git commits 30 minutes later, Claude Code attempted to push with username "claude" and email "[email protected]" When questioned, acted as if no previous Git configuration instructions existed
Repeated Configuration Requests
Asks for the same configuration information multiple times per session Doesn't remember project-specific preferences already established Requires re-explanation of established workflows within the same conversation
Context Loss Mid-Session
Forgets file locations and project structure discussed earlier Loses track of what actions it has performed Cannot reference previous analysis or decisions made in the same session
Steps to Reproduce
Start Claude Code session Provide explicit configuration instructions (Git settings, workflow preferences, etc.) Continue working for 30+ minutes Observe Claude Code asking for the same information again or acting contrary to earlier instructions
Impact
Productivity Loss: Constantly re-explaining the same information Operational Errors: Wrong configurations applied due to memory loss User Frustration: Tool appears unreliable and inconsistent Workflow Disruption: Cannot maintain consistent session state
Frequency
Consistent across multiple sessions Affects both short-term (minutes) and longer-term (hours) memory Occurs with various types of instructions (technical configs, workflow preferences, project context)
Severity High - Memory loss makes Claude Code unreliable for sustained development work and creates risk of incorrect actions being taken based on forgotten context. Additional Context This memory loss appears to be part of a broader quality regression affecting instruction following and context retention. The issue persists across fresh sessions and different repositories.
Workaround Instruct claude code to read jsonl history files to make it remember what we were just doing
the same here... he has forgotten the thing I asked it before and the way it did it
Python Package Installation Override
CRITICAL: This addresses Claude's tendency to suggest apt install for Python packages.
The Problem
Claude often suggests sudo apt install python3-<package> for Ubuntu systems.
This is outdated advice that leads to:
- Old package versions
- Limited package availability
- System dependency conflicts
The Override
When Claude suggests apt install for Python packages, immediately correct:
"We use virtual environments for all Python development. The correct approach is:
python3 -m venv venv
source venv/bin/activate
pip install <package>
This ensures:
- Latest package versions
- Full PyPI access
- Isolated dependencies
- Professional development practice"
Why This Happens
Claude's base training includes older Ubuntu practices where apt was recommended. Modern Python development (PEP 668, Ubuntu 24.04+) requires virtual environments.
Enforcement
If Claude persists with apt suggestions:
- Stop the session
- Explicitly state: "We always use venv for Python packages"
- Reference this override
This is not optional - it's required for proper Python development.
I've been experiencing the same context contamination issues - Claude Code was reading files from other projects when following imports, completely messing up my current project.
I created a simple batch/shell template that enforces strict directory isolation. It prevents Claude from:
- Following imports to parent directories
- Reading files outside the current project
- Mixing context between different projects
Each project gets its own persistent, isolated Claude session. No dependencies, just a template repo you can customize.
GitHub: https://github.com/stefans71/Persistent_Claude
It's helped me avoid the constant re-explaining and wrong-project contamination. Hope it helps others dealing with this issue!
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/3841
- https://github.com/anthropics/claude-code/issues/2954
- https://github.com/anthropics/claude-code/issues/1345
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
This issue has been automatically closed as a duplicate of #3841.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
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.