Skip to content

Conversation history lost when changing directories with cd command #4843

Closed as not planned

Description

@enraku

Bug Description

Conversation history is not recorded after changing to a subdirectory using the cd command. All conversations that occur after cd subdirectory are lost and not available in subsequent sessions.

Environment

  • Platform: WSL2 (Ubuntu 24.04)
  • Claude Code versions tested: 1.0.64 and 1.0.40
  • Verified on clean installation with no custom configurations

Steps to Reproduce

  1. Start claude in a project directory
  2. Have a conversation (e.g., "What's your favorite animal?")
  3. Create and cd into a subdirectory: mkdir abc && cd abc
  4. Continue conversation (e.g., "What's your favorite food?")
  5. Return to parent directory: cd ..
  6. Continue conversation (e.g., "What's your favorite movie?")
  7. Exit with /exit
  8. Start new session with claude -c
  9. Observe that only the conversation before cd abc is remembered

Expected Behavior

All conversations should be recorded and available in subsequent sessions, regardless of the current working directory.

Actual Behavior

  • Conversations in the main directory: ✅ Recorded
  • Conversations after cd subdirectory: ❌ Lost
  • Conversations after returning with cd ..: ❌ Lost

Impact

This is a critical issue for developers who:

  • Work across multiple subdirectories during development
  • Lose important context and decisions made during subdirectory work
  • Cannot resume conversations properly after directory changes
  • May not realize conversations are being lost until starting a new session

Additional Information

  • Tested on multiple Claude Code versions with same result
  • Reproduced on clean WSL2 installation
  • No error messages or warnings are shown
  • Users have no way to know their conversations aren't being recorded

This appears to be a fundamental issue with how Claude Code tracks conversation history relative to directory changes.

Activity

  1. rublev commented on Sep 3, 2025

    @rublev

    +1

  2. github-actions commented on Dec 6, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  3. jroes commented on Dec 16, 2025

    @jroes

    I renamed a directory I was working in and ran into this as well :(

    Any workarounds?

  4. jroes commented on Dec 16, 2025

    @jroes

    Found a workaround: less ~/.claude/history.jsonl

  5. naga-k commented on Dec 20, 2025

    @naga-k

    Yeah I'd like a feature to be able to change directories and still have claude remember the conversation.

    Will be super useful for larger projects. Or new projects where you start a conversation and create the project dir as a sub dir.

  6. github-actions commented on Jan 21, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  7. marcindulak commented on Jan 21, 2026

    @marcindulak

    This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at #16497. Please upvote that issue, so maybe it gets noticed.

  8. github-actions commented on Jan 28, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  9. locked as resolved and limited conversation to collaborators on Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions