[BUG] `/context` displays hardcoded `~/.claude/CLAUDE.md` path instead of respecting `$CLAUDE_CONFIG_DIR`

Resolved 💬 3 comments Opened Mar 25, 2026 by smorimoto Closed May 4, 2026

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

  1. Create a .envrc that sets a custom config directory:

``bash
# ~/work/.envrc
export CLAUDE_CONFIG_DIR="$HOME/.claude-work"
``

  1. Ensure $CLAUDE_CONFIG_DIR/CLAUDE.md exists with some content.
  2. cd ~/work and allow the .envrc (e.g. direnv allow).
  3. Launch Claude Code.
  4. Run /status — observe it correctly references the custom config directory.
  5. Run /context — observe the "Memory files" section shows ~/.claude/CLAUDE.md instead 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_DIR is set
  • #4739 — /ide command ignores CLAUDE_CONFIG_DIR for lock file discovery
  • #2986 — Local installation detection ignores CLAUDE_CONFIG_DIR
  • #3833 — CLAUDE_CONFIG_DIR behaviour unclear; local .claude/ directories still created
  • #4754 — Relative path resolution from $CLAUDE_CONFIG_DIR/CLAUDE.md uses 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.

View original on GitHub ↗

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