Support folder/project migration with context anchoring
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
When you reorganize a codebase (move folders, restructure directories), Claude Code loses context from previous conversations tied to those paths. If I had a project at src/old-path/ with a CLAUDE.md and conversation history, moving it to src/new-path/ means starting fresh — all prior context about decisions, architecture, and task history is gone.
This makes it painful to refactor folder structures in projects that actively use Claude Code, because you're trading organizational improvements for lost conversational context.
Proposed Solution
- .claude-redirect file — Leave a small file at the old path that points to the new location. When Claude Code encounters it, it follows the redirect and carries forward any associated context.
- Anchor file — A .claude-anchor (or field in CLAUDE.md frontmatter) with a stable project ID that persists across moves. Claude Code resolves context by ID rather than path, so moving the folder doesn't
break the link.
- Migration command — A CLI command like claude migrate --from ./old-path --to ./new-path that updates internal references so future sessions in the new location inherit history from the old one.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
File operations
Use Case Example
I'm restructuring my monorepo from a flat clients/[name]/code/[project] layout to clients/[name]/projects/[project]/code. Each project folder has a CLAUDE.md with generated context. I can't migrate without losing all prior conversation context, so I'm stuck maintaining two conventions indefinitely — new projects use the better structure, old ones stay in the legacy layout.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗