[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

  1. Set ZDOTDIR in ~/.zshenv to a custom path (e.g., ~/.config/zsh)
  2. Define aliases in $ZDOTDIR/.zshrc or files sourced from it (e.g., $ZDOTDIR/.aliases)
  3. Launch Claude Code
  4. 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 ZDOTDIR set in ~/.zshenv
  • Shell snapshot in ~/.claude/shell-snapshots/ contains only 6 aliases from default ~/.zshrc, missing 100+ from $ZDOTDIR config

Notes

  • The fix is likely small: source ~/.zshenv before determining the zshrc path during snapshot creation, so ZDOTDIR is respected.
  • Related: #25781 (the ! command has a similar ZDOTDIR issue)

View original on GitHub ↗

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