Shell snapshot omits single-underscore functions, breaking scm_breeze (zsh)
Summary
Claude Code's shell snapshot (~/.claude/shell-snapshots/snapshot-zsh-*.sh) captures some shell functions but skips others — specifically, it omits functions whose names start with a single underscore (e.g. _safe_eval) while preserving double-underscore ones (__git_alias, __zoxide_hook, etc.). The snapshot does, however, capture functions and aliases that reference the skipped ones, producing a broken shell where bare commands like git status fail with command not found: _safe_eval.
Repro
Environment that triggered it for me:
- macOS 26.4.1, zsh 5.9, Claude Code 2.1.144
- zsh setup: prezto + zplug, with
zplug \"scmbreeze/scm_breeze\"loaded in~/.zprezto/runcoms/zshrc - scm_breeze aliases
gittoexec_scmb_expand_args git, andexec_scmb_expand_argsinternally calls_safe_eval
Inside a Claude Code session, run any git command via the Bash tool:
git status
Output (the command runs, but a follow-up error is appended):
exec_scmb_expand_args:3: command not found: _safe_eval
Inspecting the snapshot confirms the asymmetry:
$ grep -c \"^exec_scmb_expand_args\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
1
$ grep -c \"^_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
0
$ grep \"_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
_safe_eval \"\${args[@]}\" # call, never defined
Double-underscored functions from the same shell are in the snapshot (12 of them in mine: __git_alias, __zoxide_hook, etc.), so the filter appears to be specifically against _<letter> names, not all leading underscores.
Impact
Anything that wraps a common command (git, ls) and relies on single-underscored helpers will be broken inside Claude Code. The user-visible symptom is command not found errors appearing after seemingly successful tool calls, which silently swallows multi-command bash invocations (e.g. git add . && git commit -m \"...\" — the commit half is killed).
This took a while to diagnose because the first command in a chain succeeds and prints its output normally; only later commands hit the missing function.
Expected
The shell snapshot should either:
- Include all user-defined functions regardless of leading underscore, or
- Strip aliases/functions that reference names it doesn't define, so the resulting shell is internally consistent.
Workaround
For affected users: append the missing function definition to the current snapshot, or remove the offending plugin. Both are fragile — the snapshot regenerates.
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗