claude-code - 💡(How to fix) Fix Claude Code project history lost after renaming local root directory [1 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#48394Fetched 2026-04-16 07:01:25
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4unlabeled ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

extent analysis

TL;DR

Renaming the project root folder breaks conversation history in Claude Code, suggesting a need for a persistent project identifier to maintain session continuity.

Guidance

  • Investigate the possibility of using a relative path or a project-specific identifier instead of relying on the absolute local path for session indexing.
  • Consider implementing a mechanism, such as a .claude ID file or a claude link command, to re-associate an existing session history with a renamed directory.
  • Review the Claude Code documentation and source code to understand how session history is currently stored and retrieved, and identify potential areas for modification.
  • Test the behavior on different platforms and operating systems to determine if this is a Windows-specific issue or a more general problem.

Example

No specific code example can be provided without access to the Claude Code source code, but a potential solution might involve storing the session history in a file or database that is identified by a project-specific ID rather than the absolute path.

Notes

The issue may be related to how Claude Code stores and retrieves session history, and modifying this behavior may require significant changes to the underlying code. Additionally, the fact that renaming the folder back to its original name restores the conversation history suggests that the issue is specific to the absolute path used by Claude Code.

Recommendation

Apply a workaround, such as using a symbolic link or a junction to maintain the original folder name, until a more permanent solution can be implemented. This will allow users to continue using Claude Code with renamed project folders while a more robust solution is developed.

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