Feature: Display script output in client via CLAUDE_DISPLAY_SCRIPT_OUTPUT environment variable
Summary
When Claude runs scripts via the CLI, the output is not currently visible in the client UI. This feature proposes an opt-in mechanism to surface script output directly in the client.
Proposed Solution
Introduce a new environment variable: CLAUDE_DISPLAY_SCRIPT_OUTPUT=1
When this variable is set, the stdout/stderr of any scripts executed by Claude via the Bash tool would be streamed and displayed in the client interface — not just consumed internally by Claude.
Usage Patterns
Always-on (user sets in shell profile):
export CLAUDE_DISPLAY_SCRIPT_OUTPUT=1
Per-script (user instructs Claude to set it conditionally):
The user can tell Claude: "Set CLAUDE_DISPLAY_SCRIPT_OUTPUT=1 before running the build script so I can see the output."
Claude would then prepend the variable to that specific invocation:
CLAUDE_DISPLAY_SCRIPT_OUTPUT=1 ./build.sh
This gives users fine-grained control over which script outputs are surfaced without permanently enabling verbose output for every command.
Motivation
- Users often want visibility into what a script is doing, especially for long-running processes (builds, tests, data pipelines).
- Currently, Claude sees the output but the user does not — creating an information asymmetry.
- An environment variable is a familiar, low-friction mechanism that fits naturally into existing shell workflows.
- The opt-in design avoids cluttering the client with output the user doesn't care about.
Acceptance Criteria
- [ ] When
CLAUDE_DISPLAY_SCRIPT_OUTPUT=1is set, script output (stdout + stderr) is displayed in the client in real time or upon completion. - [ ] When the variable is unset or
0, behavior is unchanged from today. - [ ] The variable can be set inline per-command (e.g.
CLAUDE_DISPLAY_SCRIPT_OUTPUT=1 ./script.sh) so users can instruct Claude to enable it selectively. - [ ] Documentation is updated to describe the variable and its behavior.
Alternatives Considered
- A CLI flag (
--display-output) — less flexible since it would apply globally per session rather than per script. - Always showing output — too noisy for routine commands; opt-in is preferable.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗