Terminal title escape sequences not passed through to terminal emulator

Resolved 💬 3 comments Opened Dec 22, 2025 by avinden Closed Dec 26, 2025

Problem

When running terminal title escape sequences via the Bash tool, they are captured as text output rather than being interpreted by the terminal emulator.

Example command:

printf '\033]0;Claude - MCP setup\007'

Expected: VS Code terminal tab updates to "Claude - MCP setup"
Actual: Output shows ]0;Claude - MCP setup as text, terminal title unchanged

Use Case

Users may want to set descriptive terminal tab names based on the current task (e.g., "Claude: Fix auth bug", "Claude: Review PR") for better session organization when multiple terminals are open.

Root Cause

Claude Code executes bash commands in a subprocess and captures stdout. Terminal escape sequences (OSC codes) require direct TTY access to be interpreted by the terminal emulator.

Proposed Solutions

  1. Detect and forward OSC sequences: Parse captured output for OSC escape sequences (specifically \033]0;...\007 for title) and forward them to the parent terminal
  2. Add native terminal title API: Provide a mechanism for Claude to set terminal title directly, e.g., via a config option or dedicated command
  3. PTY passthrough mode: Option to run certain commands with direct PTY access instead of captured subprocess

Environment

  • Claude Code v2.0.75
  • VS Code integrated terminal
  • macOS Darwin 24.6.0

View original on GitHub ↗

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