[FEATURE] Support persistent virtual environment activation
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
I have Claude Code for VS Code (2.0.5).
When working with Python projects that use virtual environments, Claude Code requires the venv to be activated separately for each command execution.
This creates significant friction and performance overhead in typical development workflows.
Current Behavior
Each Bash tool invocation starts a fresh shell session with no environment state from previous commands. This means:
# Command 1: Activate venv
source /path/to/venv/bin/activate
# Command 2: Run tests - venv is NOT activated
pytest test_file.py # ❌ Uses system Python, not venv Python
Proposed Solution
Claude Code should support one of the following:
Option A: Maintain a persistent shell session that preserves environment state across commands
Option B: Detect and automatically activate venv when present in the project (similar to VS Code's Python extension)
Option C: Allow shell initialization scripts (like .bashrc or project-specific setup) to run once per conversation
Alternative Solutions
In settings
Claude Code: Use Terminal
[x] Launch Claude in the terminal instead of the native UI
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗