[BUG] Files referenced with relative path from user `$CLAUDE_CONFIG_DIR/CLAUDE.md` attempt to load from current working directory

Resolved 💬 4 comments Opened Jul 30, 2025 by Nemo157 Closed Jan 4, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.60 (Claude Code)
  • Operating System: NixOS 25.05
  • Terminal: irrelevant

Bug Description

When referencing files with @relative-path.md from the user CLAUDE.md they _sometimes_ fail to load because they are looked up relative to the current working directory

Steps to Reproduce

  1. Have a $CLAUDE_CONFIG_DIR/CLAUDE.md that has a relative reference to another file.
  2. Attempt something that causes the file to be loaded.

Expected Behavior

The file is loaded relative to the CLAUDE.md

Actual Behavior

It errors saying the file does not exist

Additional Context

I am using CLAUDE_CONFIG_DIR=$HOME/.config/claude to avoid polluting my homedir with _another_ dotdir and dotfile. The files within CLAUDE_CONFIG_DIR are also symlinked, maybe parts of this setup are relevant to why it fails. It also works sometimes, I haven't tested enough to say how often, but it's maybe 50/50 out of my few tests.

> ll ~/.config/claude
CLAUDE.md@ ⇒ /nix/store/ai2msz72bv9nc996v70y4a3l252lf5ph-home-manager-files/.config/claude/CLAUDE.md
jj.md@ ⇒ /nix/store/ai2msz72bv9nc996v70y4a3l252lf5ph-home-manager-files/.config/claude/jj.md
... > look at the revision first ● You're right, let me check the revision history first to see what was changed. ● Read(@jj.md) ⎿  Error: File does not exist. ● Bash(jj log -r @ --summary) ⎿  @ ktnltmts 6a62860b jj-claude.2025-07-30T09-50.gD8v8b@ ... │ ~ ⎿  Interrupted by user > what absolute path are you trying to read @jj.md from ● I was trying to read @jj.md from the current working directory /tmp/jj-claude.2025-07-30T09-50.gD8v8b. Let me check if there's a jj.md file in the home directory or elsewhere: ● Bash(find /home -name "jj.md" 2>/dev/null) ⎿  No (tell Claude what to do differently) > why aren't you trying to read relative to the CLAUDE.md that references the file? ● You're absolutely right! The CLAUDE.md references @jj.md, so I should look for it relative to where CLAUDE.md is located, which is /home/user/.config/claude/. Let me read it from there: ● Read(../../home/user/.config/claude/jj.md) ⎿  No (tell Claude what to do differently) > no, I don't want you to perform the action, I want to understand why you chose the base path you did and how to avoid that choice in the future ● You're right to question my reasoning. I made an incorrect assumption about how to resolve the @jj.md reference from the CLAUDE.md file. When I saw @jj.md referenced in /home/user/.config/claude/CLAUDE.md, I should have interpreted the @ as a relative path indicator and looked for jj.md in the same directory as CLAUDE.md (i.e., /home/user/.config/claude/jj.md). Instead, I initially tried to read it from the current working directory (/tmp/jj-claude.2025-07-30T09-50.gD8v8b/@jj.md), which was wrong because I should have resolved the path relative to where the referencing file (CLAUDE.md) is located, not relative to my current working directory. To avoid this in the future, when I see a file reference in a configuration or documentation file, I should resolve relative paths from the directory containing that file, not from my current working directory. > is that not part of your general system? ● You're absolutely right - this should be part of my general system understanding. When I encounter file references in configuration files or documentation, I should automatically resolve relative paths from the directory containing the referencing file, not from my current working directory. This is standard behavior for how file systems and most tools handle relative path resolution. I shouldn't need special instructions for this - it's a fundamental aspect of how file paths work. My mistake was treating the @jj.md reference as if it should be resolved from my current working directory instead of from the directory containing the CLAUDE.md file that referenced it. This is basic file system behavior that should be part of my core understanding, not something that requires explicit instruction. > but _is_ it part of your general system understanding, or not? ● No, it's not part of my general system understanding. I made an error in how I resolved the relative path reference, and I shouldn't have. This suggests there's a gap in my understanding of how to properly resolve file references in configuration files. The fact that I initially tried to read @jj.md from the current working directory rather than from the directory containing the referencing CLAUDE.md file indicates that this standard file system behavior isn't properly integrated into my default reasoning about file path resolution.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗