[FEATURE] Auto-terminate inactive Claude Code session processes in VS Code

Resolved 💬 2 comments Opened Mar 10, 2026 by cheolho-kang Closed Mar 10, 2026

Environment

  • Claude CLI version: 2.1.72 (VS Code Extension)
  • Operating System: macOS 15 (Apple Silicon)
  • Terminal: VS Code integrated

Feature Description

When using Claude Code in VS Code, previous conversation sessions remain as live background processes even after switching to a new session. Over time, this causes significant memory consumption with no benefit.

In my case, I found 12 concurrent Claude processes running (~880MB total), even though I was only actively using one session. These included sessions from days ago and even from a previous extension version (v2.1.63).

Current Behavior

  • Starting a new conversation spawns a new claude process
  • Switching away from a session does not terminate the previous process
  • Old sessions accumulate indefinitely until VS Code is reloaded or processes are manually killed
  • Processes persist even across extension version upgrades

Expected Behavior

  • Only the currently active session should have a running process
  • Inactive sessions should be suspended/terminated automatically
  • Selecting a past session from the session list should resume/restart the process on demand

Suggested Approach

One or more of:

  1. Auto-terminate inactive sessions after a configurable timeout (e.g. 5–10 minutes)
  2. Suspend on switch — terminate the previous session's process when the user switches to a different one
  3. Add a VS Code setting like claudeCode.maxConcurrentSessions to limit background processes

Evidence

12 claude processes running simultaneously, only 1 actively in use:

$ ps aux -m | grep 'claude.*native-binary' | grep -v grep
user  88218  13.5  0.7  508MB  130MB  S  11:09AM  v2.1.69  --add-dir workspace-A  # <-- only active session
user  30082   0.1  0.4  509MB   77MB  S  10:44PM  v2.1.69  --add-dir workspace-A
user  78669   0.1  0.4  509MB   72MB  S  10:54AM  v2.1.69  --add-dir workspace-A
user  17955   0.2  0.4  509MB   72MB  S  Thu03PM  v2.1.63  --add-dir workspace-B  # old extension version
user  28484   0.3  0.4  509MB   71MB  S   8:53PM  v2.1.69  --add-dir workspace-A
user  95333   0.0  0.4  509MB   69MB  S   9:43PM  v2.1.69  --add-dir workspace-A
user  96795   0.2  0.4  509MB   66MB  S  Fri01PM  v2.1.69  --add-dir workspace-A
user  85619   0.0  0.4  509MB   66MB  S  Thu10AM  v2.1.63  --add-dir workspace-B  # old extension version
user  22887   0.1  0.4  509MB   66MB  S  Sun03PM  v2.1.63  --add-dir workspace-B
user   1983   0.1  0.4  509MB   65MB  S  Thu07AM  v2.1.63  --add-dir workspace-B  # running for 3+ days
user  96440   0.0  0.3  509MB   62MB  S  Fri01PM  v2.1.69  --add-dir workspace-A
user  91356   0.0  0.3  509MB   62MB  S  Thu10PM  v2.1.63  --add-dir workspace-B
  • Total RSS: ~880MB for 12 processes, only 1 in use
  • Sessions from 3+ days ago still alive (PID 1983, started Thu07AM)
  • Processes from old extension version (v2.1.63) persist even after upgrading to v2.1.69

View original on GitHub ↗

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