[Feature Request] Per-Session Workspace Isolation - Critical for Multi-Session Workflows
Problem Statement
Current Behavior:
Claude Code shares ALL project files across concurrent sessions working in the same directory. This causes severe context contamination when users work on multiple aspects of the same project simultaneously.
Impact:
- Session A working on infrastructure writes to
.claude/CLAUDE.local.md - Session B working on CSV analysis reads Session A's contaminated context
- Context windows bloat with irrelevant cross-session history
- Users cannot maintain separate mental models for different task types
- Workarounds (file swapping hooks) are fragile and complex
User Context
I frequently work on the same project with 3-4 concurrent sessions:
- Session 1: Infrastructure/hooks development
- Session 2: CSV content work
- Session 3: Planning/architecture
- Session 4: Bug fixes
Each session needs completely isolated project memory. Right now, they all contaminate each other.
Current Workaround (Implemented Today)
Created file-swapping hooks that:
- SessionStart: Copy session-specific memory INTO project directory
- SessionEnd: Copy project memory OUT to session storage
Issues with this approach:
- ❌ Race conditions if sessions overlap
- ❌ Potential data loss on crashes
- ❌ Complex hook maintenance
- ❌ Not transparent - requires manual infrastructure
- ❌ Doesn't work for users without deep Claude Code knowledge
Requested Feature
Native per-session workspace isolation:
Session A:
~/.claude/sessions/<session-A-id>/workspace/<project-name>/.claude/CLAUDE.local.md
Session B:
~/.claude/sessions/<session-B-id>/workspace/<project-name>/.claude/CLAUDE.local.md
What this enables:
- ✅ Complete session isolation (like history.jsonl already has)
- ✅ No cross-contamination
- ✅ Each session maintains its own context
- ✅ Transparent to users
- ✅ No fragile workarounds needed
Why This Matters
The history.jsonl isolation (recently added) proves this architecture is possible and valuable. Please extend the same approach to all project files in .claude/.
Urgency
This is critically blocking multi-session workflows. Users working on complex projects with multiple concurrent sessions experience:
- Constant context pollution
- Wasted time re-explaining context each session
- Inability to maintain task-specific mental models
- Frustration from contaminated AI responses
Technical Details
Current architecture:
~/.claude/history.jsonl→ per-session symlinks ✅ (working perfectly).claude/CLAUDE.local.md→ shared across sessions ❌ (causes contamination)
Requested architecture:
- Extend per-session isolation to ALL
.claude/project files - Use same symlink or copy-on-write approach as history.jsonl
- Make it transparent - no user configuration required
Related Issues
This appears to be the same architectural pattern request as session isolation for command history (which was successfully implemented).
---
User Account: @EmanuelFaria
Severity: High
Category: Feature Request - Session Management
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗