[BUG] Symlink Resolution Failure: Claude Code Unable to Traverse Symlinked Directory

Status Fixed / completed
Maintainer reply None cached
Activity 16 comments · opened Apr 11, 2025 · closed Aug 19, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • Platform: macos
  • Terminal: alacritty
  • Version: 0.2.68
  • Feedback ID: c3f75537-5be5-47f8-a46a-69c0c8c227ec

Bug Description

I have the dir ~/.claude symlinked to another dotfile repo which i store all my personal files. I'm using the command stow to symlink my home to this dotfiles repo. After doing so, Claude code is no longer able to detect the files in the dir ~/.claude. this sucks as now i can't checkin my claude files and have git to revise them.

Steps to Reproduce

  1. Create a dir, call it dotfiles.
  2. In that dir place the folder .claude with the contents of ~/.claude
  3. In dotfiles/.claude/commands/ create a hello world command
  4. Use the command stow --adopt -v --target=$HOME dotfiles
  5. Use ls to confirm that that ~/.claude is successfully symlinked and that you can cat the contents
  6. open up Claude code and attempt to invoke the command
  7. You should not be able to see your commands that are located and symlinked from dot files.

Expected Behavior

Claude code should be able to follow the symlinks and read the CLAUD.md file as well as any commands

Actual Behavior

Claude code shows none of the user commands defined in ~/.claude/commands/*

Additional Context

  • running /memory and chasing the local claude file, opens the file. adding a test instruction to the local memory file through claude code works fine and outputs the test message

View original on GitHub ↗

15 Comments

egalanos · 1 year ago

It would be good to get a setting/environment variable to enable following of symlinks.

I appreciate why this isn't done by default for security, but it does make using Claude with worktrees a pain as there are non checked-in resources that I want to share across all worktrees.

Edit December 2025: the /add-dir & setting for additionalDirectories were added after my original comment + sandboxing features which are a better solution so I personally think this issue should be closed as a WONT FIX now.

samuelho-dev · 1 year ago

Bump. Would love for this feature, ideally would like to be able to build a separate and symlink resources to other repositories to use the same architecture features built instead of copying the entire claude folder over.

mortbal · 1 year ago

well its far from perfect but in my case i needed claude code to read unreal engine source code and my unreal project (which is in another folder) source too so i rand claude code in both folders and ran /init then went to my project's instance of claude code and gave this prompt:
this is an unreal engine project located at "D:/Projects/MyProject" and it has its claude.md file unreal engine is located at "C:/ProgramFiles/EpicGames/UE5.5" and that also has its own claude.md file read engine's md file and merge it with my project's update paths to point to absolute paths instead of relative paths

i can see claude being more aware of the files in both folders but the best result is when i copy the entire project to engine folder , run one init there and just work there until finished, but the downside to that is that i can only do this for one project otherwise conflicts happen

swushi · 11 months ago

Another bump on this. For me, I have "project-level, but user specific" slash commands. Things that are specific to one project, but I'm not comfortable with merging in the codebase yet as I'm still experimenting with it. It's nice to keep this in my dot files repo and symlink it though, so I still have some sort of version control on it.

armoucar · 10 months ago

All my claude configs are inside my dotifles repo too. This is useful for keeping my env the same across my computers. Hopefully this is solved at some point. Subscribing to keep getting news on this issue.

leo-cheron · 9 months ago

This feature would massively help structuring & testing marketplace plugins.

patrickplaggenborg · 8 months ago

Tried to do the same, having my personal agent skills in my user folder /.claude/ but Claude Code is unable to follow them and the content is not available in any other repository where I want to use Claude Code to use my global Skills.

architeacher · 7 months ago

I was able to reproduce, @claude can you fix this ASAP?

github-actions[bot] · 6 months ago

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.

iammarcin · 6 months ago

still valid, still to solve

alejolizal · 6 months ago

the same problem here #25367

ericvhileman · 6 months ago

Still happening. Crazy.

yurukusa · 5 months ago

A PreToolUse hook can detect symlink traversal before rm follows them:

CMD=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
[ -z "$CMD" ] && exit 0
echo "$CMD" | grep -qE '^\s*rm\s+.*-[rf]' || exit 0
TARGET=$(echo "$CMD" | grep -oP 'rm\s+(-[rf]+\s+)*\K\S+' | tail -1)
[ -z "$TARGET" ] || [ ! -d "$TARGET" ] && exit 0
LINKS=$(find "$TARGET" -maxdepth 3 -type l 2>/dev/null | while read l; do
    R=$(readlink -f "$l" 2>/dev/null)
    [[ "$R" != "$(pwd)"* ]] && echo "$l -> $R"
done | head -3)
[ -n "$LINKS" ] && echo "BLOCKED: symlinks pointing outside project" >&2 && exit 2
exit 0

Install: \npx cc-safe-setup --install-example symlink-guard\
This catches the same class of issue as #36339 (NTFS junctions).

FKPSC · 3 months ago

also does not work for mentioning files with @

calvin-level · 1 month ago

Still happening. When I type @ it does not show or recognize symlink directories.

Showing cached comments. Read the full discussion on GitHub ↗