Skip to main content

apply_bash_shell_prefix

Function apply_bash_shell_prefix 

Source
fn apply_bash_shell_prefix(
    env_vars: &mut HashMap<String, String>,
    bashwrap: Option<PathBuf>,
    mode: Option<&str>,
)
Expand description

Claude Code runs every Bash tool command through CLAUDE_CODE_SHELL_PREFIX when it is set: pointed at agentmux-bashwrap, that streams the command without the hook rewriting the call, so the CLI’s permission rules and labels see the model’s own command (docs/specs/SPEC_BASH_STREAMING_VIA_SHELL_PREFIX_2026_10_10.md §2.4). Only Claude Code reads the variable. A prefix the agent’s own cmd:env sets is kept (the hook then rewrites, as it does without a prefix); no prefix is set without the wrapper, or when srv runs with AGENTMUX_BASHWRAP_MODE=rewrite.