claude-code - 💡(How to fix) Fix [BUG] @imports in CLAUDE.md files outside the git repo root are not resolved [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49124Fetched 2026-04-17 08:50:13
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

Fix Action

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.

Code Example

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.

---

~/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

---

ln -sf AGENTS.md CLAUDE.md
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. 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
  1. Initialize a git repo in ~/src/some-project/ (the other directories are not git repos).
  2. Run claude from ~/src/some-project/.
  3. Observe the session context: only ~/src/some-project/AGENTS.md content is loaded. The parent CLAUDE.md files show @AGENTS.md as 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

extent analysis

TL;DR

The issue can be worked around by replacing each CLAUDE.md with a symlink to AGENTS.md, allowing the harness to read the content directly without needing @ resolution.

Guidance

  • Verify that the @ import resolution issue is specific to the directory level by checking if the AGENTS.md file exists relative to each CLAUDE.md file.
  • Check the documentation for the Claude Code version 2.1.110 to see if there are any known issues or limitations with @ import resolution in parent directories.
  • Test the provided workaround by replacing each CLAUDE.md with a symlink to AGENTS.md using the command ln -sf AGENTS.md CLAUDE.md.
  • If the workaround is successful, consider reporting the issue to the Claude Code developers to investigate a permanent fix.

Example

The provided workaround can be implemented using the following command:

ln -sf AGENTS.md CLAUDE.md

This will create a symlink to AGENTS.md, allowing the harness to read the content directly.

Notes

The issue may be specific to the Claude Code version 2.1.110, and it is unclear if this is a regression or a known issue. Further investigation is needed to determine the root cause of the problem.

Recommendation

Apply the workaround by replacing each CLAUDE.md with a symlink to AGENTS.md, as this allows the harness to read the content directly without needing @ resolution. This workaround is a temporary solution until a permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING