claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Directory Structure Not Updated After Folder Renaming

Open paulmaunders opened this issue 1 year ago • 3 comments

Bug Description Directory structure context is not updated when folders are renamed. Perhaps there could be a command to refresh the context, or it could do it on /clear, or automatically.

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 0.2.9
  • Feedback ID: 36e9eb63-c886-45e3-88d8-4a8e9590e2c0

Note that I have replaced my actual home dir with ~ in the example below:

% claude
╭───────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview!            │
│                                                       │
│   /help for help                                      │
│                                                       │
│   cwd:~/Projects/claude-code-test  │
╰───────────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude.
 2. Ask Claude questions about your codebase.
 3. Ask Claude to implement changes to your codebase.

> can you show me the directory structure context you are aware of?

⏺ Here's the directory structure I'm aware of:

  - ~/Projects/claude-code-test/
    - Test Directory/

> lets rename the test directory to remove the space

⏺ Bash(mv "Test Directory" TestDirectory)…
  ⎿  (No content)

> can you show me the directory structure context you are aware of?

⏺ I'm still aware of the initial directory structure:

  -~/Projects/claude-code-test/
    - Test Directory/

  Note that I've renamed "Test Directory" to "TestDirectory", but this change isn't reflected in my static context which was captured at the start of our conversation.

paulmaunders avatar Feb 25 '25 11:02 paulmaunders

Claude will likely self-correct in cases like this.

To illustrate, ask Claude to create a file in the test directory (e.g. "create a new text file in the test directory"). It will probably ls -la before creating the file anyways, but in case it just yolos something like touch ~/Projects/claude-code-test/TestDirectory/file.txt, this will fail and Claude will try to recover.

I suppose Claude could attempt to create the ~/Projects/claude-code-test/TestDirectory directory in it's recovery, but I think it's more likely to list the file system and then put the file in the appropriate place.

You should give it a shot and see what happens.

Joshuapwilley avatar Feb 27 '25 16:02 Joshuapwilley

Lmk if this is causing issues, but yeah Claude should be able to self-correct just fine.

bcherny avatar May 06 '25 00:05 bcherny

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.

github-actions[bot] avatar Aug 09 '25 14:08 github-actions[bot]