[BUG] Shell snapshot should not pull in user aliases by default

Status Open
Reported on v2.1.223
Maintainer reply None cached
Activity 2 comments · opened Sep 2, 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?

Bug Description
Shell snapshots should not apply shell aliases, as they can unpredictably modify commands that claude runs. This behavior should be disabled by default. The only current solution is to modify dotfiles to put alias definitions behind an interactive shell check, which is clumsy and inelegant.

For example, I use eza and alias it to ls, and it has different behavior for similar flags. Another example is zoxide. I alias cd to z which enables fuzzy directory changes, but this is dangerous when claude tries to change directory.

What Should Happen?

Claude should not use user aliases as it runs commands in a non-interactive shell. This is disabled by default in zsh, and does not work in bash by default without using shopt, but claude ignores this normal behavior and uses aliases in non-interactive shells, which can lead to unsafe or unpredictable behaviors.

Error Messages/Logs

Steps to Reproduce

  1. Alias any common command to another command (eg cd -> z, ls -> eza, cat -> bat).
  2. Let the agent start doing any work that requires these commands.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.223

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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