Bash tool output is prefixed with a full environment variable dump on every call
Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 24, 2026
Description
Every Bash tool call's output in this session is preceded by a full "declare -x ..." dump of the process environment before the actual command output. This happened consistently across an entire multi-day session (hundreds of Bash calls), not intermittently.
Impact
- Token cost: the dump is dozens of lines per call, every call, with no way to suppress it. Across a long session this is a meaningful, unnecessary token tax.
- Potential information exposure: the dump includes internal session identifiers that look sensitive by convention even if not directly exploitable, e.g. CLAUDE_CODE_MESSAGING_TOKEN, CLAUDE_CODE_MESSAGING_SOCKET, CLAUDE_CODE_HOST_SESSION_ID, SSH_AUTH_SOCK. These end up in the model's context on every single shell command, and in this case some of this preamble ended up quoted into external documentation notes as literal tool-output evidence, since the assistant can't easily distinguish harness-injected preamble from real command output while drafting evidence-grounded reports.
- Independently flagged mid-session by a fresh-context subagent reviewing the transcript, as a candidate token-leak worth reporting.
Environment (from the dump itself)
- CLAUDE_CODE_DESKTOP_APP_VERSION: 2.7032.0
- CLAUDE_AGENT_SDK_VERSION: 0.3.280
- CLAUDE_CODE_ENTRYPOINT: claude-desktop
- Platform: macOS (Darwin 25.6.0)
- Shell: bash
Expected
Bash tool output should be just the command's own stdout/stderr, not a preamble of the invoking process's environment, or at minimum this should be an opt-in debug mode, not the default for every call.
Repro
Any Bash tool call in a Claude Code desktop session on the above version reproduces this, e.g. a trivial "echo hello" returns the full declare -x block first, then "hello".