Skip to content

feat(agent-input): !-prefix bash command mode#1414

Open
chphch wants to merge 1 commit into
slopus:mainfrom
chphch:feat/bash-input-mode
Open

feat(agent-input): !-prefix bash command mode#1414
chphch wants to merge 1 commit into
slopus:mainfrom
chphch:feat/bash-input-mode

Conversation

@chphch

@chphch chphch commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Adds a !-prefix bash command mode to the chat input, mirroring the Claude Code CLI: a message that starts with ! runs as a one-off shell command in the session's working directory instead of being sent to the agent, and its output renders inline. It's per-message only — there's no persistent mode toggle. The command runs over the existing session-scoped bash RPC (the same handler that powers directory autocomplete and Windows cmd support), so it executes in and is sandboxed to the session cwd; the echoed command and its output are injected as local-only messages (no server round-trip, the agent is never involved), with output shown in a fenced code block. It's gated behind a new expBashMode experiment flag (off by default — Settings → Features → Experiments), so default behaviour is unchanged.

Proof

Captured locally via a standalone happy-server (PGlite) + Expo web + a paired happy-cli daemon, authenticated through the getDevWebQueryCredentials() dev URL bypass and driven headlessly with Playwright (live e2e — real daemon, real session). With the flag on, typing !pwd and !echo BASHMODE_OK_4242 runs each as a shell command and renders the output in a sh code block; the agent is never invoked.

!-bash mode running pwd and echo in a real session

Verification: tsc --noEmit clean, settings unit tests pass (settings.spec.ts, 34/34), and the new strings are added to all 10 locale files. No new message kind and no reducer changes — the output reuses the existing agent-text markdown rendering.

Related: addresses #568 (run shell commands from mobile without burning tokens). #597 proposes the same capability with a $ prefix; this uses ! to mirror the Claude Code CLI's bash mode.

Type a message starting with `!` to run it as a one-off shell command in the
session's working directory instead of sending it to the agent — mirrors the
Claude Code CLI's `!` bash mode. Per-message only, no persistent toggle.

The command runs via the session-scoped `bash` RPC (the same handler that
powers directory autocomplete), so it executes in and is sandboxed to the
session cwd. The echoed command and its output are injected as local-only
messages (no server round-trip), rendering the output in a fenced code block.

Gated behind a new `expBashMode` experiment flag (off by default), with a
toggle under Settings -> Features -> Experiments.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant