Shell snapshots don't capture zsh chpwd_functions/precmd_functions arrays
GitHub Issue for anthropics/claude-code
Title: Shell snapshots don't capture zsh chpwd_functions/precmd_functions arrays
Body:
Summary
Claude Code's shell snapshots don't capture zsh special arrays like chpwd_functions and precmd_functions, causing false positive warnings from tools that use these arrays (e.g., zoxide).
Environment
- macOS 15.2 (Darwin 25.1.0)
- zsh 5.9
- zoxide 0.9.x
- Claude Code (latest)
Steps to Reproduce
- Install zoxide with
--cmd cdoption in.zshrc:
``zsh``
eval "$(zoxide init zsh --cmd cd)"
- Run any command in Claude Code that triggers shell execution
- Observe warning:
````
zoxide: detected a possible configuration issue.
Root Cause Analysis
Claude Code creates shell snapshots (~/.claude/shell-snapshots/) that capture:
- Functions (including zoxide's
cdfunction) - Environment variables
- Aliases
But the snapshots do not capture:
chpwd_functionsarrayprecmd_functionsarray- Other special zsh arrays
When Claude Code runs commands:
- Snapshot is sourced (includes zoxide's
cdfunction) chpwd_functionsarray is empty (not captured in snapshot)cdruns → zoxide's__zoxide_doctorchecks if__zoxide_hookis inchpwd_functions- Since array is empty, warning appears
This is a false positive - the cd functionality works, but zoxide's health check fails because it can't find its hook in the empty array.
Workaround
Users can disable zoxide's doctor check:
export _ZO_DOCTOR=0
eval "$(zoxide init zsh --cmd cd)"
Suggested Fix
Shell snapshots should preserve zsh special arrays, particularly:
chpwd_functions- hooks called when directory changesprecmd_functions- hooks called before each promptpreexec_functions- hooks called before command execution
These arrays are used by many zsh tools and plugins beyond zoxide.
Impact
- Cosmetic warning messages in Claude Code output
- May confuse users into thinking their shell configuration is broken
- Affects any tool using zsh hook arrays (zoxide, direnv, various oh-my-zsh plugins, etc.)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗