[Bug] Session summary lacks project isolation - causes cross-project context contamination

Resolved 💬 1 comment Opened Jun 3, 2026 by p4nt1um Closed Jul 7, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description

When working with multiple projects, Claude Code loads the most recent session.tmp file regardless of project context, causing cross-project context contamination in new sessions.

What Should Happen?

Expected Behavior

Session summaries should be:

  1. Isolated per project - stored in project-specific directories
  2. Matched before loading - check cwd/project match before injecting
  3. Scoped to current project - only load session summaries from the same project

Error Messages/Logs

## Actual Behavior

SessionStart:startup loads `~/.claude/sessions/*.tmp` by modification time, ignoring project boundaries.

Steps to Reproduce

Reproduction Steps

  1. Work on Project A (e.g., ~/projects/ProjectA)
  • Session ends → generates ~/.claude/sessions/YYYY-MM-DD-ProjectA-session.tmp
  1. Switch to Project B (e.g., ~/projects/ProjectB)
  • cd ~/projects/ProjectB
  • Launch Claude Code
  1. Problem: SessionStart:startup injects Project A's context into Project B's session

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.132

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Deleting only the most recent session.tmp is insufficient - the next-most-recent will become the "latest" and still cause cross-project contamination.

Suggested Fix

Option A: Project-Isolated Storage

// settings.json
{
"session": {
"storage": "project-isolated",  // store sessions in project directories
"summaryScope": "current-project-only"
}
}

Option B: cwd Matching

// SessionStart:startup hook logic
const currentProject = detectProjectFromCwd();
const sessionFile = findMostRecentSessionForProject(currentProject);
if (sessionFile && matchesProject(sessionFile, currentProject)) {
injectSessionSummary(sessionFile);
}

Option C: Configurable Scope

// settings.json
{
"session": {
"summaryScope": "current-project-only" | "global-most-recent" | "disabled"
}
}
Environment
  • Claude Code: v2.1.132
  • OS: Windows 11 (also observed on macOS/Linux)
  • Plugins: claude-mem v6.5.0, superpowers v5.0.1
  • Session files:
  • ~/.claude/projects/<project-id>/fc*.jsonl (5.3MB per project)
  • ~/.claude/sessions/*.tmp (4.4KB, globally shared)
Root Cause Analysis

Design Assumption vs Reality:
<br>
| Design Assumption | Multi-Project Reality |
|-------------------|----------------------|
| Single project continuous work | Multiple parallel projects |
| Latest session is always correct | Latest session may be from different project |
| No project isolation needed | Strict project isolation required |
<br>

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗