Immediate ! shell escape execution while Claude is processing (non-blocking bash mode)

Resolved 💬 3 comments Opened Mar 16, 2026 by brunorodmoreira Closed May 2, 2026

Feature Request

Allow ! shell escape commands to execute immediately, even while Claude is actively processing a task — similar to how /btw enables fast user interaction without waiting for idle state.

Problem

Today, ! bash escape only works when Claude is idle. In practice, the moments you most need a quick shell command are exactly when Claude is busy:

  • Checking git status or git diff while Claude is writing code
  • Tailing logs while Claude is debugging
  • Verifying a file exists or inspecting env vars mid-task
  • Running a quick curl to confirm an endpoint while Claude is iterating

This forces developers to either wait for Claude to finish or context-switch to another terminal — both break flow unnecessarily.

Proposed Behavior

  1. Non-blocking execution: ! commands should run immediately in a subprocess, regardless of Claude's current state (idle, processing, waiting for tool approval)
  2. Output displayed inline: Command output appears in the terminal without interrupting Claude's ongoing work
  3. No injection into context: The command and its output are not sent to Claude as conversation input — this is purely a developer convenience (unless explicitly piped back, e.g., via a future $ prefix as discussed in #3674)
  4. Guardrails for destructive commands: Before executing potentially destructive commands, prompt the user for confirmation:
  • rm, rmdir, rm -rf
  • git push --force, git reset --hard, git clean
  • docker rm, docker system prune
  • kill, killall, pkill
  • Any command matching a configurable denylist/warnlist

Why This Is Distinct from Existing Issues

  • #31274 focuses on inline shell execution from the prompt (UX improvement for idle state) — this issue is about execution during active processing
  • #27793 focuses on auto-continuing after ! commands — this issue is about the command not requiring idle state at all
  • Both are complementary. This feature would naturally compose with both proposals.

Prior Art

  • /btw flag: Already proves the pattern — users can inject fast interactions while Claude is working. ! commands are an even lighter-weight version of this (no AI processing needed)
  • IPython/Jupyter: !command runs immediately regardless of kernel state
  • Vim: :!command is always available

Suggested UX

# While Claude is actively generating/processing:
> ! git status        # runs immediately, output shown inline
> ! tail -20 app.log  # runs immediately
> ! rm -rf dist/      # prompts: "⚠️ Destructive command detected. Proceed? (y/n)"

Implementation Considerations

  • The subprocess can share the same CWD as Claude's session
  • Output should be visually distinct (e.g., dimmed, prefixed, or in a separate visual block) so it's clear it's user-initiated
  • Guardrail patterns could be user-configurable via settings.json (e.g., shellEscape.warnPatterns)
  • Long-running ! commands could support Ctrl+C to cancel without affecting Claude's process

View original on GitHub ↗

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