Claude Code project history lost after renaming local root directory
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I encountered a critical issue where all conversation history in Claude Code becomes inaccessible after renaming the local project root folder. Even though the files remain identical, Claude Code seems to treat the renamed folder as a completely new, empty project.
Interestingly, if I rename the folder back to its original name, all previous chat sessions reappear immediately. This suggests that session indexing is strictly hard-coded to the absolute local path rather than a persistent project identifier.
What Should Happen?
Claude Code should be able to maintain project session continuity even if the root directory is moved or renamed. There should be a mechanism (e.g., a persistent .claude ID or a CLI command like claude link) to re-associate an existing session history with a renamed directory.
Error Messages/Logs
Steps to Reproduce
Open a terminal and navigate to a project directory (e.g., /path/to/my-project).
Run claude and start a conversation with several messages.
Exit Claude and close the terminal.
Rename the local root folder from my-project to my-project-v2.
Navigate into my-project-v2 and run claude again.
Observe that the previous conversation history is gone.
Rename the folder back to my-project and run claude again; notice the history is restored.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
ALL
Platform
Other
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗