! shell escape prefix does not execute commands, sends as message instead

Resolved 💬 5 comments Opened Mar 21, 2026 by zebdro Closed Apr 18, 2026

Bug

The ! prefix for running shell commands directly from the Claude Code prompt does not work. Instead of executing the command in the shell, it sends the entire line (including the ! prefix) as a regular message to Claude.

Steps to reproduce

  1. At the Claude Code prompt, type: ! echo hello
  2. Press enter

Expected: The command echo hello executes in the shell and output appears in the conversation.
Actual: The text ! echo hello is sent as a message to Claude, as if ! has no special meaning.

Why this matters

Claude (the model) is instructed to suggest ! <command> for cases where the user needs to run something themselves — for example, interactive logins or entering sensitive credentials that shouldn't pass through the conversation. In this case, a user was instructed to store an API token via ! security add-generic-password ... to keep the token out of the conversation history. Because the ! prefix didn't execute, the permanent API token was sent as a plaintext message into the conversation instead.

This is a security-relevant bug. The feature exists specifically for cases where data should NOT flow through the conversation, and its failure causes exactly the exposure it was designed to prevent.

Environment

  • Claude Code (CLI)
  • macOS (Darwin 25.4.0)
  • Shell: zsh

View original on GitHub ↗

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