Terminal title escape sequences not passed through to terminal emulator
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
- Detect and forward OSC sequences: Parse captured output for OSC escape sequences (specifically
\033]0;...\007for title) and forward them to the parent terminal - Add native terminal title API: Provide a mechanism for Claude to set terminal title directly, e.g., via a config option or dedicated command
- 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
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/8834
- https://github.com/anthropics/claude-code/issues/9881
- https://github.com/anthropics/claude-code/issues/12239
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This issue has been automatically closed as a duplicate of #8834.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.