Allow Claude Code to interact with existing VS Code integrated terminals (shared shell sessions)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Summary
Claude Code's Bash tool creates ephemeral shell sessions that don't persist environment variables between calls. In the VS Code extension, Claude should be able to read from and write commands to an existing VS Code integrated terminal, giving both the user and Claude shared real-time visibility into a persistent shell session.
Problem:
Workflows that require heavy environment setup (e.g., ESP-IDF, ROS, conda, nix-shell) are painfully slow because Claude must re-source environment scripts on every single Bash tool invocation. For example, building ESP32 firmware with ESP-IDF + Matter requires sourcing scripts that set dozens of environment variables — this adds 5-10 seconds of overhead to every command.
Additionally, when Claude runs long builds, the user has no real-time visibility. They can't see compiler output streaming, can't spot errors early, and can't intervene. If another Claude Code session is building in the background, a second session can't observe or collaborate on that output.
Proposed Solution
Proposed solution:
In the VS Code extension, allow Claude Code to:
List open integrated terminals in the current VS Code window
Read recent output from a terminal (subscribe to onDidWriteTerminalData or use Shell Integration APIs)
Send commands to an existing terminal (via Terminal.sendText())
This would mean:
Environment variables persist naturally — source once, use forever
User sees build output in real-time as it streams
Multiple Claude Code sessions could share the same terminal for coordination
User can manually intervene in the same terminal if needed
Use case
I'm developing ESP32 firmware with two Claude Code tabs open — one building firmware, one for discussion. Today:
The build tab re-sources export.sh on every Bash call (wasted time)
I can't see build progress in real-time
The discussion tab can't see what the build tab is doing
If I have the environment already set up in a VS Code terminal, Claude can't use it
With this feature, both Claude and I would share a single terminal with the environment already configured, and I could watch builds stream in real-time.
Prior art:
#7586 — closed as not_planned due to inactivity (auto-closed)
#13735 — addresses env var persistence but not shared visibility
#9853 — closed as duplicate of #7586
Cursor has terminal integration features that allow similar workflows
VS Code APIs available
The building blocks already exist in the VS Code Extension API:
window.terminals — enumerate open terminals
Terminal.sendText() — send commands to a terminal
Terminal.shellIntegration — read command output (newer API)
window.onDidWriteTerminalData — subscribe to terminal output
Alternative Solutions
Constantly copy/pasting from the terminal window to Claude or letting Claude do builds in its own ephemeral shell and they take forever because it has to set up the shell each time.
Priority
High - Significant impact on productivity
Feature Category
Other
Use Case Example
Scenario: Developing ESP32 firmware using ESP-IDF + Matter SDK
I open a VS Code integrated terminal and run source ~/esp/esp-idf/export.sh && source ~/esp/esp-matter/export.sh — this sets ~40 environment variables (IDF_PATH, PATH additions, Python venv, etc.) and takes about 10 seconds.
I open Claude Code in a second VS Code tab to help me debug a build error.
Today: Claude runs idf.py build via its Bash tool, which spawns a fresh shell — the environment isn't set up. So Claude has to re-source both scripts first, adding 10+ seconds to every single command. I also can't see the build output streaming in real-time; I only see it after the command finishes.
With this feature: I tell Claude "use terminal 1 to build." Claude sends idf.py build to my already-configured terminal. The environment is already set up — no re-sourcing needed. I watch compiler output stream in real-time in the same terminal, and can spot errors as they happen. If I open a second Claude Code tab to discuss the errors, it can also read the terminal output without me copy-pasting.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗