[BUG] @imports in CLAUDE.md files outside the git repo root are not resolved
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 CLAUDE.md files exist in parent directories above the git repo root, the harness finds and loads them correctly, but does not resolve @filename imports in those files. Only the @ import at the git repo level is resolved. The parent-level CLAUDE.md files show the raw literal text @AGENTS.md instead of the referenced file's content.
What Should Happen?
All @AGENTS.md imports should be resolved at every directory level where the harness loads a CLAUDE.md file, as long as the referenced file exists relative to that CLAUDE.md.
Error Messages/Logs
Session context shown at startup:
Contents of ~/CLAUDE.md (project instructions, checked into the codebase):
@AGENTS.md
Contents of ~/src/CLAUDE.md (project instructions, checked into the codebase):
@AGENTS.md
Contents of ~/src/some-project/CLAUDE.md (project instructions, checked into the codebase):
@AGENTS.md
Contents of ~/src/some-project/AGENTS.md (project instructions, checked into the codebase):
[full content loaded here]
Only the git repo-level AGENTS.md was resolved. The parent-level `@AGENTS.md` references were passed through as raw text.
Steps to Reproduce
- Create the following file structure:
~/AGENTS.md # file with some instructions
~/CLAUDE.md # contains only: @AGENTS.md
~/src/AGENTS.md # file with some instructions
~/src/CLAUDE.md # contains only: @AGENTS.md
~/src/some-project/AGENTS.md # file with some instructions
~/src/some-project/CLAUDE.md # contains only: @AGENTS.md
- Initialize a git repo in
~/src/some-project/(the other directories are not git repos). - Run
claudefrom~/src/some-project/. - Observe the session context: only
~/src/some-project/AGENTS.mdcontent is loaded. The parent CLAUDE.md files show@AGENTS.mdas literal text.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.110
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Workaround
Replace each CLAUDE.md with a symlink to AGENTS.md:
ln -sf AGENTS.md CLAUDE.md
The harness then reads the content directly without needing @ resolution.
Terminal/Shell
Ghostty with Fish
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗