Project memory & session context orphaned silently when a repo directory is renamed/moved

Resolved 💬 2 comments Opened Jun 29, 2026 by david7902 Closed Jul 3, 2026

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

  1. Detect a renamed/moved repo by git identity (remote URL / first-commit hash), not just the path.
  2. At session start, surface sibling ~/.claude/projects/*/memory/ dirs that share a git origin with the current repo, and offer to load/migrate them.
  3. 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

  1. Build up project memory in a repo at path A.
  2. Rename/move the repo directory to path B (mv, or a git-tracked rename of the working dir).
  3. Start a new Claude Code session in path B.
  4. 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_

View original on GitHub ↗

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