claude-code - 💡(How to fix) Fix [BUG] Project memory silently drops when session cwd differs from user's main project directory [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53336Fetched 2026-04-26 05:18:23
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Root Cause

Project memory is path-scoped under ~/.claude/projects/{slugified-cwd}/memory/. When a session starts from a subdirectory or unrelated directory, it loads a different memory directory that may be empty or nearly empty.

User's main memory: ~/.claude/projects/-Users-prochoi7/memory/40 files (12 feedback corrections, 11 project, 5 reference, 7 user)

Session's loaded memory: ~/.claude/projects/-Users-prochoi7-Downloads-Claude-Cowork/memory/1 file

There is no cascade or inheritance — child/sibling directories don't inherit parent project memories.

Fix Action

Workaround

The user is implementing a 2-layer defense:

  1. Promoting critical feedback corrections to ~/.claude/rules/*.md (globally loaded regardless of cwd)
  2. Creating symlinks from secondary project memory directories to the main memory directory

Code Example

{"type":"queue-operation","operation":"enqueue","timestamp":"2026-04-25T16:25:43.240Z",
 "sessionId":"23207c7d-b3f5-476c-90af-ce66394ad5df","content":"/이어서"}

{"type":"user","entrypoint":"claude-desktop",
 "cwd":"/Users/prochoi7/Downloads/Claude-Cowork", ...}
RAW_BUFFERClick to expand / collapse

Bug Description

When a Claude Code session starts with a working directory (cwd) different from the user's main project directory, all project-scoped memories are silently dropped — no warning, no fallback, no inheritance from parent directories. This caused a complete loss of 39 out of 40 carefully curated feedback/project/reference memory files, resulting in severe quality degradation.

Root Cause

Project memory is path-scoped under ~/.claude/projects/{slugified-cwd}/memory/. When a session starts from a subdirectory or unrelated directory, it loads a different memory directory that may be empty or nearly empty.

User's main memory: ~/.claude/projects/-Users-prochoi7/memory/40 files (12 feedback corrections, 11 project, 5 reference, 7 user)

Session's loaded memory: ~/.claude/projects/-Users-prochoi7-Downloads-Claude-Cowork/memory/1 file

There is no cascade or inheritance — child/sibling directories don't inherit parent project memories.

Impact

In the affected session (23207c7d), zero feedback correction keywords appeared across the entire 229-message session. The assistant repeated the exact failure patterns that the user had already corrected through months of feedback:

  • Made ungrounded conclusions (feedback #1)
  • Failed to retract unsupported claims (feedback #3)
  • Offered to stop work prematurely (feedback #4)
  • Assumed abbreviations without verification (feedback #6)

This is not a minor quality drop — it's a complete loss of behavioral calibration.

Reproduction

  1. Build up project memories at ~/.claude/projects/-Users-{username}/memory/ (home directory scope)
  2. Start a Claude Code session from any other directory (e.g. ~/Downloads/some-folder/)
  3. Observe: none of the home-directory-scoped memories are loaded
  4. The assistant behaves as if it has never received any feedback corrections

Evidence (JSONL)

Session 23207c7d — started from Claude Desktop with cwd: /Users/prochoi7/Downloads/Claude-Cowork:

{"type":"queue-operation","operation":"enqueue","timestamp":"2026-04-25T16:25:43.240Z",
 "sessionId":"23207c7d-b3f5-476c-90af-ce66394ad5df","content":"/이어서"}

{"type":"user","entrypoint":"claude-desktop",
 "cwd":"/Users/prochoi7/Downloads/Claude-Cowork", ...}

Keyword search across all 229 lines for core feedback correction identifiers (feedback_no_baseless_conclusion, feedback_no_drop_option, reference_data_mode, feedback_retract_format, feedback_explicit_consent): 0 matches.

Expected Behavior

At minimum:

  1. Warning: Alert the user when a session loads significantly fewer memories than their most-populated project scope
  2. Fallback/Cascade: Consider inheriting memories from parent directory scopes (e.g. ~/Downloads/X/ inherits from ~/)
  3. Global memories: Allow users to mark certain memories as global (loaded regardless of cwd), similar to how ~/.claude/rules/*.md files work

Environment

  • Claude Desktop v2.1.119
  • macOS (Darwin 25.4.0), MacBook Air M1
  • 40 memory files in main project scope, 1 in affected scope

Workaround

The user is implementing a 2-layer defense:

  1. Promoting critical feedback corrections to ~/.claude/rules/*.md (globally loaded regardless of cwd)
  2. Creating symlinks from secondary project memory directories to the main memory directory

Related

This issue is architecturally similar to the discussion in #42050 (unified sessions/settings across surfaces) — project memory scoping is a surface-level fragmentation issue.

extent analysis

TL;DR

To mitigate the issue of silently dropped project-scoped memories when starting a Claude Code session from a different working directory, consider implementing a fallback or cascade mechanism to inherit memories from parent directory scopes.

Guidance

  • Verify the issue: Check if the session's loaded memory directory is different from the user's main project directory and if it contains significantly fewer memory files.
  • Implement a warning system: Alert the user when a session loads fewer memories than their most-populated project scope to prevent silent data loss.
  • Explore global memories: Allow users to mark certain memories as global, loaded regardless of the current working directory, to ensure critical feedback corrections are always applied.
  • Test the workaround: Evaluate the effectiveness of promoting critical feedback corrections to ~/.claude/rules/*.md and creating symlinks from secondary project memory directories to the main memory directory.

Example

No code snippet is provided as the issue is more related to the architecture and design of the project memory scoping system.

Notes

The provided workaround may not be suitable for all users, and a more robust solution, such as implementing a fallback or cascade mechanism, may be necessary to fully address the issue.

Recommendation

Apply the workaround by promoting critical feedback corrections to ~/.claude/rules/*.md and creating symlinks from secondary project memory directories to the main memory directory, as it provides a temporary solution to mitigate the issue until a more permanent fix is implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Project memory silently drops when session cwd differs from user's main project directory [1 participants]