Skip to main content

Module bash_prefix

Module bash_prefix 

Source
Expand description

The Claude agent’s shell prefix: agentmux-bashwrap as the CLI’s CLAUDE_CODE_SHELL_PREFIX, which streams Bash output without the hook rewriting the call (docs/specs/SPEC_BASH_STREAMING_VIA_SHELL_PREFIX_2026_10_10.md).

Constants§

BASHWRAP_MODE_ENV 🔒
srv’s own environment variable that turns the shell prefix off: rewrite keeps the hook rewriting commands, as before the prefix.

Functions§

apply_bash_shell_prefix 🔒
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.
apply_for_spawn 🔒
Set the prefix in an agent’s spawn environment (input::build_persistent_spawn_env). Not for a pane in the MCP self-heal’s safe profile: its MCP server failed to start and reconnecting didn’t help, so its CLI runs without the prefix, as with AGENTMUX_BASHWRAP_MODE=rewrite (backend::mcp_health).
mode_for 🔒
rewrite for a pane in the safe profile, else srv’s own setting.