Project memory & session context orphaned silently when a repo directory is renamed/moved
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code project memory and session history are keyed to the absolute working-directory path (~/.claude/projects/<slugified-path>/). When a repo's directory is renamed or moved, the prior context stays parked at the old path. The new session starts near-empty, with no pointer to the old memory and no migration prompt.
A new session (post-rename) was told to re-read the project history and reported it done — but the curated memory was stranded under two prior directory names (~/src/trainervids → ~/src/coaching → ~/src/ccpt-ipp). With none of it in context, the session answered a factual status question (app store review state) wrong, and confidently, because the real answer lived in orphaned memory + an append-only log it never opened.
Low-stakes in this case — the user caught it. The same failure on a destructive or outward-facing action (deploy target, prod-vs-test, credentials, "is this already submitted") would not be low-stakes. The silent part is the danger: nothing signals that context was left behind.
Proposed Solution
- Detect a renamed/moved repo by git identity (remote URL / first-commit hash), not just the path.
- At session start, surface sibling
~/.claude/projects/*/memory/dirs that share a git origin with the current repo, and offer to load/migrate them. - A
claude memory migrate <old-path> <new-path>command for explicit carry-over.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
- Build up project memory in a repo at path A.
- Rename/move the repo directory to path B (
mv, or agit-tracked rename of the working dir). - Start a new Claude Code session in path B.
- Memory dir for B is empty; A's
~/.claude/projects/<A-slug>/memory/is untouched and unreferenced. No prompt, no migration.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗