Commands in symlinked .claude directory skipped as duplicates since v2.1.30 (Windows + network drive)
Bug Description
Since v2.1.30, custom slash commands in a symlinked ~/.claude directory are skipped as duplicates on Windows. Only the first command (alphabetically) is loaded; all others are silently dropped with "same inode already loaded from userSettings".
This is a regression introduced by the 64-bit inode precision fix in v2.1.30.
Environment
- Claude Code version: 2.1.37
- OS: Windows 11
- Setup:
C:\Users\<user>\.claudeis a symlink toX:\.claude(SMB network share mapped drive)
Root Cause
Claude Code scans ~/.claude/commands/ twice:
- Via the symlink path:
C:\Users\<user>\.claude\commands\ - Via the resolved realpath:
X:\.claude\commands\
Both paths point to the same physical directory. After the v2.1.30 inode precision improvement, the deduplication logic correctly detects identical inodes — but incorrectly skips files that were discovered through the same directory via two different paths.
// realpathSync resolves symlink to different path
C:\Users\<user>\.claude → symlink → X:\.claude
realpathSync('C:/Users/<user>/.claude') === 'X:\.claude' // different string, same directory
Debug Log Evidence
[DEBUG] Loading skills from: managed=C:\ProgramData\ClaudeCode\.claude\skills, user=C:\Users\<user>\.claude\skills, project=[]
[DEBUG] [STARTUP] Loading commands and agents...
[DEBUG] Skipping duplicate file 'C:\Users\<user>\.claude\commands\build.md' from userSettings (same inode already loaded from userSettings)
[DEBUG] Skipping duplicate file 'C:\Users\<user>\.claude\commands\debug.md' from userSettings (same inode already loaded from userSettings)
[DEBUG] Skipping duplicate file 'C:\Users\<user>\.claude\commands\expert.md' from userSettings (same inode already loaded from userSettings)
[DEBUG] Skipping duplicate file 'C:\Users\<user>\.claude\commands\test.md' from userSettings (same inode already loaded from userSettings)
... (all files except the first one alphabetically)
Only analyze.md (first alphabetically) is loaded. All other commands return "Unknown skill".
Reproduction Steps
- On Windows, create a symlink from
~/.claudeto a network share (SMB):
``powershell``
mklink /D C:\Users\<user>\.claude X:\.claude
- Place multiple
.mdfiles in.claude/commands/ - Run
claudeand try/buildor any command other than the alphabetically first one - Result:
Unknown skill: build
Expected Behavior
All commands in ~/.claude/commands/ should be loaded regardless of whether the directory is accessed via symlink or realpath. The deduplication should compare normalized paths or skip re-scanning when the resolved path is the same directory.
Suggested Fix
Before scanning commands, normalize the paths so that symlink path and realpath are recognized as the same source:
// Instead of scanning both the symlink path and realpath separately,
// resolve once and scan only the resolved path
const commandsDir = fs.realpathSync(path.join(homeDir, '.claude', 'commands'));
// scan commandsDir only once
Or deduplicate by resolved path rather than by inode across different scan passes of the same settings level.
Workaround
Remove the symlink and use a local .claude directory (loses sync between machines).
Additional Context
- This worked correctly on v2.1.29 and earlier because float-precision inode comparison didn't detect the duplicates
- The same
.claudedirectory works perfectly on Linux (local filesystem, no symlink needed) node -e "fs.realpathSync('C:/Users/<user>/.claude')"returnsX:\.claude, confirming the symlink resolution causes the path mismatch
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗