claude-code - 💡(How to fix) Fix Session memory should not be scoped to working directory path [1 comments, 2 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#54791Fetched 2026-04-30 06:35:54
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1
RAW_BUFFERClick to expand / collapse

Currently, Claude Code's auto-memory system stores memories under a path derived from the working directory (e.g. .claude/projects/-home-user-scm-myproject/memory/). This means:

  • Moving or renaming a project directory silently orphans all accumulated memory.
  • Switching to a different workspace for the same work starts a blank session with no prior context.
  • There is no way to resume a session's memory from a different directory without manually copying files.

Expected behaviour: Memory should be associated with a named session or project identifier that the user controls, not the filesystem path. This would allow memory to survive project moves, renames, and workspace switches.

Suggested fix: Allow users to assign a named project ID (e.g. in CLAUDE.md or a config flag) that is used as the memory key instead of the directory path. The directory-derived key could remain as the default for backwards compatibility.

extent analysis

TL;DR

Assign a named project ID to use as the memory key instead of the directory path to resolve memory orphaning issues.

Guidance

  • Introduce a configurable project ID (e.g., in CLAUDE.md or a config flag) to serve as the memory key.
  • Update the auto-memory system to use this project ID when storing memories, ensuring backwards compatibility by defaulting to the directory-derived key.
  • Consider adding a migration mechanism to associate existing memories with their respective project IDs.
  • Evaluate the impact of this change on existing workflows and session resumption.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The suggested fix assumes that implementing a project ID-based memory key will not introduce significant performance or complexity issues. Further analysis may be required to ensure a seamless integration with the existing auto-memory system.

Recommendation

Apply the workaround by introducing a configurable project ID, as it directly addresses the issue of memory orphaning and provides a flexible solution for users to manage their sessions across different workspaces and directory changes.

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