[BUG] @ links in subdirectory CLAUDE.md files not resolved when opened from parent directory
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a CLAUDE.md file in a subdirectory uses an @ link to reference an external file (e.g., @~/.claude/plugins/...), the link is not resolved if Claude Code is launched from a parent directory. The subdirectory CLAUDE.md file itself is found and loaded, but the @ link inside it is ignored.
What Should Happen?
When prompting CC and mentioning some file from a sub-folder with a CLAUDE.md file, external references in that file should be resolved.
Error Messages/Logs
Steps to Reproduce
- Create a monorepo structure:
/project/
CLAUDE.md
subdir/
CLAUDE.md → contains: @~/.claude/plugins/my-plugin/instructions.md
- Create the external file at
~/.claude/plugins/my-plugin/instructions.mdwith some distinctive content
- Test the following scenarios:
| Launch directory | Subdirectory CLAUDE.md | @ link resolved? |
|------------------|------------------------|------------------|
| /project/subdir/ | local content (no @ link) | ✅ works |
| /project/ | local content (no @ link) | ✅ works |
| /project/ | uses @ link | ❌ not resolved |
| /project/subdir/ | uses @ link | ✅ works |
- Ask Claude some question and mention inside
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.7
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗