2.1.132 untested · changelog-derived

Claude Code 2.1.132

**Session identity in Bash subprocesses:** Bash tool commands can now read `CLAUDE_CODE_SESSION_ID` to correlate their execution with the parent Claude Code session and hook invocations. This enables agents to build session-aware audit logs, cross-reference hook events, and reason about causality within long-running sessions.

2 new primitives 1 workflow recipes 26 fixes

New primitives

CLAUDE_CODE_SESSION_IDenv-var

Passed to Bash tool subprocess environment; matches the `session_id` in hook payloads, allowing bash commands to self-identify their session

Added `CLAUDE_CODE_SESSION_ID` environment variable to the Bash tool subprocess environment, matching the `session_id` passed to hooks
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1env-var

Disables the fullscreen alternate-screen renderer, keeping the conversation in the terminal's native scrollback instead of a separate screen

Added `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1` env var to opt out of the fullscreen alternate-screen renderer and keep the conversation in the terminal's native scrollback

Workflow recipes

Session-Correlated Audit Log with Native Scrollback Persistence
CLAUDE_CODE_SESSION_ID + CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1

Agents running in headless, containerized, or remote environments need durable output trails that survive terminal reconnects and can be audited post-session. Disabling alternate-screen keeps all output in native scrollback; stamping each bash subprocess's output with CLAUDE_CODE_SESSION_ID enables post-hoc log reconstruction and session replay without losing context to terminal mode switches or buffer flushes.

An agent workflow that (1) sets CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 at session start, (2) runs bash commands that each read and log $CLAUDE_CODE_SESSION_ID as a prefix or structured header, (3) collects all output in a session-wide transcript keyed by session_id, and (4) at closeout, produces a session audit log linking tool invocations, hook events, and bash output by shared session_id. Use case: compliance workflows, post-mortem analysis, or distributed agent coordination where scrollback is the source of truth.

Agentic relevance

The `CLAUDE_CODE_SESSION_ID` env var enables session-correlated logging and causality tracking within agents' bash workflows. When combined with hook invocations, agents can now trace execution lineage and build audit trails that persist across tool boundaries. The `DISABLE_ALTERNATE_SCREEN` flag supports long-form session replay and analysis by keeping all output in native scrollback, critical for agents working in containerized or headless environments where alternate-screen buffering is problematic.

Hardening & fixes (26)

  • Added a "Pasting…" footer hint while a Ctrl+V image paste is being read from the clipboard
  • Fixed external SIGINT (e.g. IDE stop button, `kill -INT`) not running graceful shutdown — terminal modes are now restored and the `--resume` hint is printed instead of an abrupt exit
  • Fixed an uncaught exception when the terminal is closed or SSH disconnects mid-session under the native build
  • Fixed `--resume` failing with `no low surrogate in string` when a tool error truncation split an emoji; pre-corrupted sessions are sanitized on load
  • Fixed `--permission-mode` flag being ignored when resuming a plan-mode session with `-p --continue`/`--resume`, and plan mode not being re-applied after `ExitPlanMode` within the same session
  • Fixed fullscreen mode showing a blank screen after laptop sleep/wake or Ctrl+Z/`fg` until the next keystroke or stream output
  • Fixed cursor landing mid-grapheme on Ctrl+E/A/K/U/arrow keys when an Indic conjunct or ZWJ emoji wraps across lines
  • Fixed vim operators corrupting text containing decomposed (NFD) accented characters
  • Fixed pasting text starting with `/` silently swallowing the input or triggering an unknown-command reply
  • Fixed pasting dumping stray escape sequences into the prompt when focus events or mouse-tracking reports interleave with the bracketed paste
  • Fixed mouse wheel scrolling being too fast in Cursor and VS Code 1.92–1.104 due to an upstream xterm.js bug
  • Fixed scroll-wheel handling in JetBrains IDE 2025.2 terminals (spurious arrow keys, wrong-direction events, runaway acceleration)
  • Fixed `/usage` Ctrl+S hanging when copying the stats screenshot to the clipboard on Linux/X11
  • Fixed `/terminal-setup` showing a contradictory error in Windows Terminal — Shift+Enter is natively supported there
  • Fixed `/effort` picker not reflecting the `CLAUDE_CODE_EFFORT_LEVEL` env var override
  • Fixed `/status` showing the wrong default model for some users
  • Fixed slash command autocomplete popup being capped at ~3–5 visible commands instead of scaling with terminal height
  • Fixed statusline `context_window` token counts reflecting cumulative session totals instead of current context usage
  • Fixed Alt+T (thinking toggle) not working on macOS terminals without "Option as Meta" enabled (iTerm2, Terminal.app defaults)
  • Fixed dead keyboard input on Windows after re-opening a background session from `claude agents`
  • Fixed unbounded memory growth (10GB+ RSS) when a stdio MCP server writes non-protocol data to stdout
  • Fixed MCP servers that connect but fail `tools/list` silently showing 0 tools — they now retry once and show "connected · tools fetch failed" in `/mcp`
  • Fixed unauthorized claude.ai MCP connectors showing as "failed" instead of "needs auth", and headless `-p` mode retrying non-transient 4xx connection failures
  • Improved visual consistency in slash command dialogs and `/login`, `/upgrade`, `/extra-usage` dialog spacing
  • Updated the `/tui fullscreen` startup banner to describe additional renderer benefits (lower memory usage, mouse support, auto-copy on select)
  • Fixed Bedrock and Vertex 400 errors when `ENABLE_PROMPT_CACHING_1H` is set

Raw changelog

## 2.1.132

- Added `CLAUDE_CODE_SESSION_ID` environment variable to the Bash tool subprocess environment, matching the `session_id` passed to hooks
- Added `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1` env var to opt out of the fullscreen alternate-screen renderer and keep the conversation in the terminal's native scrollback
- Added a "Pasting…" footer hint while a Ctrl+V image paste is being read from the clipboard
- Fixed external SIGINT (e.g. IDE stop button, `kill -INT`) not running graceful shutdown — terminal modes are now restored and the `--resume` hint is printed instead of an abrupt exit
- Fixed an uncaught exception when the terminal is closed or SSH disconnects mid-session under the native build
- Fixed `--resume` failing with `no low surrogate in string` when a tool error truncation split an emoji; pre-corrupted sessions are sanitized on load
- Fixed `--permission-mode` flag being ignored when resuming a plan-mode session with `-p --continue`/`--resume`, and plan mode not being re-applied after `ExitPlanMode` within the same session
- Fixed fullscreen mode showing a blank screen after laptop sleep/wake or Ctrl+Z/`fg` until the next keystroke or stream output
- Fixed cursor landing mid-grapheme on Ctrl+E/A/K/U/arrow keys when an Indic conjunct or ZWJ emoji wraps across lines
- Fixed vim operators corrupting text containing decomposed (NFD) accented characters
- Fixed pasting text starting with `/` silently swallowing the input or triggering an unknown-command reply
- Fixed pasting dumping stray escape sequences into the prompt when focus events or mouse-tracking reports interleave with the bracketed paste
- Fixed mouse wheel scrolling being too fast in Cursor and VS Code 1.92–1.104 due to an upstream xterm.js bug
- Fixed scroll-wheel handling in JetBrains IDE 2025.2 terminals (spurious arrow keys, wrong-direction events, runaway acceleration)
- Fixed `/usage` Ctrl+S hanging when copying the stats screenshot to the clipboard on Linux/X11
- Fixed `/terminal-setup` showing a contradictory error in Windows Terminal — Shift+Enter is natively supported there
- Fixed `/effort` picker not reflecting the `CLAUDE_CODE_EFFORT_LEVEL` env var override
- Fixed `/status` showing the wrong default model for some users
- Fixed slash command autocomplete popup being capped at ~3–5 visible commands instead of scaling with terminal height
- Fixed statusline `context_window` token counts reflecting cumulative session totals instead of current context usage
- Fixed Alt+T (thinking toggle) not working on macOS terminals without "Option as Meta" enabled (iTerm2, Terminal.app defaults)
- Fixed dead keyboard input on Windows after re-opening a background session from `claude agents`
- Fixed unbounded memory growth (10GB+ RSS) when a stdio MCP server writes non-protocol data to stdout
- Fixed MCP servers that connect but fail `tools/list` silently showing 0 tools — they now retry once and show "connected · tools fetch failed" in `/mcp`
- Fixed unauthorized claude.ai MCP connectors showing as "failed" instead of "needs auth", and headless `-p` mode retrying non-transient 4xx connection failures
- Improved visual consistency in slash command dialogs and `/login`, `/upgrade`, `/extra-usage` dialog spacing
- Updated the `/tui fullscreen` startup banner to describe additional renderer benefits (lower memory usage, mouse support, auto-copy on select)
- Fixed Bedrock and Vertex 400 errors when `ENABLE_PROMPT_CACHING_1H` is set