@file picker shows incorrect relative paths in git repo subdirectories
Description
When working in a subdirectory of a git repository, the @ file autocomplete displays paths with incorrect ../ prefixes that don't resolve to the actual files being matched.
Environment
- OS: macOS (Darwin 24.6.0)
- Shell: zsh
Reproduction Steps
- Have a git repository with nested subdirectories (monorepo structure):
````
/repo-root/ # git root
└── a/b/c/ # working directory (3 levels deep)
└── reference/ # target directory
└── subdir/
- Launch Claude Code from the nested subdirectory:
``bash``
cd /repo-root/a/b/c
claude
- Type
@reto autocomplete a reference to the localreference/directory
Expected Behavior
Autocomplete should show:
+ reference/
+ reference/subdir/
Or equivalently:
+ ./reference/
+ ./reference/subdir/
Actual Behavior
Autocomplete shows paths with inverted ../ depth:
+ ../../../reference/
+ ../../../reference/subdir/
The number of ../ segments (3) matches the depth from git root to cwd, suggesting the path computation is using git root as a reference point incorrectly.
Note: The correct files are being found (the subdirectories match what exists locally), but the displayed paths are wrong and would resolve to a non-existent location at the git root level.
Workarounds
- Use absolute paths:
@/full/path/to/reference/ - Type the path manually without relying on autocomplete:
@./reference/
Additional Context
- The local directory structure has a
.claude/folder withsettings.local.json - Multiple
CLAUDE.mdfiles exist in the repo hierarchy (git root, intermediate dirs, and cwd) - The git repo is a monorepo with multiple projects
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗