[BUG] Shell snapshot does not honor ZDOTDIR - aliases from redirected config silently absent
Resolved 💬 2 comments Opened Mar 19, 2026 by srobinson Closed Apr 16, 2026
Description
When ZDOTDIR is set in ~/.zshenv to redirect zsh configuration (e.g., ZDOTDIR=/Users/me/.config/zsh), Claude Code's shell snapshot mechanism does not follow the redirect. It sources ~/.zshrc at the default path instead of $ZDOTDIR/.zshrc, causing aliases defined in the redirected config tree to be missing from Bash tool invocations.
Steps to reproduce
- Set
ZDOTDIRin~/.zshenvto a custom path (e.g.,~/.config/zsh) - Define aliases in
$ZDOTDIR/.zshrcor files sourced from it (e.g.,$ZDOTDIR/.aliases) - Launch Claude Code
- Run a Bash tool command using one of those aliases
Expected: Aliases from the ZDOTDIR config tree are available
Actual: Only aliases from ~/.zshrc (default path) are captured in the snapshot; ZDOTDIR aliases are silently absent
Environment
- macOS (Darwin 25.2.0)
- zsh with
ZDOTDIRset in~/.zshenv - Shell snapshot in
~/.claude/shell-snapshots/contains only 6 aliases from default~/.zshrc, missing 100+ from$ZDOTDIRconfig
Notes
- The fix is likely small: source
~/.zshenvbefore determining the zshrc path during snapshot creation, soZDOTDIRis respected. - Related: #25781 (the
!command has a similar ZDOTDIR issue)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗