[BUG] `/context` displays hardcoded `~/.claude/CLAUDE.md` path instead of respecting `$CLAUDE_CONFIG_DIR`
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_CONFIG_DIR is set to a custom directory (e.g. via .envrc), the /context slash command still displays the default ~/.claude/CLAUDE.md path under "Memory files", rather than $CLAUDE_CONFIG_DIR/CLAUDE.md.
Other commands such as /status correctly reflect the custom config directory, so the environment variable is being picked up — but /context appears to have the default path hardcoded.
Memory files · /memory
└ ~/.claude/CLAUDE.md: 1.1k tokens
What Should Happen?
/context should display the path derived from CLAUDE_CONFIG_DIR:
Memory files · /memory
└ ~/.claude-work/CLAUDE.md: 1.1k tokens
Error Messages/Logs
(no error messages — the command runs without error but displays an incorrect path)
Steps to Reproduce
- Create a
.envrcthat sets a custom config directory:
``bash``
# ~/work/.envrc
export CLAUDE_CONFIG_DIR="$HOME/.claude-work"
- Ensure
$CLAUDE_CONFIG_DIR/CLAUDE.mdexists with some content. cd ~/workand allow the.envrc(e.g.direnv allow).- Launch Claude Code.
- Run
/status— observe it correctly references the custom config directory. - Run
/context— observe the "Memory files" section shows~/.claude/CLAUDE.mdinstead of~/.claude-work/CLAUDE.md.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.83
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
This appears to be part of a broader pattern where CLAUDE_CONFIG_DIR is not consistently respected across the codebase. Several related issues have been filed:
- #36172 — Skills directory lookup fails when
CLAUDE_CONFIG_DIRis set - #4739 —
/idecommand ignoresCLAUDE_CONFIG_DIRfor lock file discovery - #2986 — Local installation detection ignores
CLAUDE_CONFIG_DIR - #3833 —
CLAUDE_CONFIG_DIRbehaviour unclear; local.claude/directories still created - #4754 — Relative path resolution from
$CLAUDE_CONFIG_DIR/CLAUDE.mduses working directory instead of config directory
It would be brilliant if there were a single pass through the codebase to replace all hardcoded ~/.claude references with the resolved config directory path.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗