Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Claude Code History Retrieve

Fix for the VS Code Claude Code extension showing empty "Past Conversations" on virtual/mapped drives.

Affected: Windows users with rclone mounts, subst drives, mapped network drives, or WinFsp/FUSE mounts.

Related: anthropics/claude-code#12872 (30+ affected users)

The Problem

The Claude Code VS Code extension computes a project directory name from your workspace path. For example, workspace Z:\ maps to ~/.claude/projects/z--/.

However, the extension calls fs.realpath() on the workspace path before computing the directory name. On virtual drives, realpath resolves to the underlying path:

Drive Type Workspace realpath resolves to Extension looks in
rclone SFTP Z:\ \\server\share\ --server-share-
subst Z:\ C:\Users\me\project C--Users-me-project
Network Z:\ \\nas\data\ --nas-data-

The CLI stores sessions in z-- but the extension looks in --server-share- (or similar). Mismatch = empty Past Conversations.

The CLI's claude --resume still works because it uses the raw path without realpath.

Quick Fix

python fix_sessions.py Z:\

This creates an NTFS directory junction linking the extension's expected directory to the CLI's actual session directory.

Usage

# Fix a specific drive
python fix_sessions.py Z:\

# Diagnose only (no changes)
python fix_sessions.py Z:\ --diagnose-only

# Scan all drives for mismatches
python fix_sessions.py --scan

# Group sessions by topic/project (preview)
python fix_sessions.py --group z-- --diagnose-only

# Group sessions by topic/project (apply titles)
python fix_sessions.py --group z--

# Auto-detect and group all projects
python fix_sessions.py --group

Example Output

=== Claude Code Session Fix Diagnostic ===

1. Workspace path: Z:\
   CLI directory name: z--
   CLI directory exists: True
   Sessions in CLI dir: 23 .jsonl files

2. Resolved path: \\server\hgcc_workspace\
   Extension directory name: --server-hgcc-workspace-
   Extension directory exists: False

3. MISMATCH DETECTED!
   CLI uses:       z--
   Extension uses: --server-hgcc-workspace-
   Sessions are in CLI dir (23 files), extension dir is empty/missing.

4. FIX: Creating directory junction...
   SUCCESS! Junction created.

5. Now reload VS Code: Ctrl+Shift+P -> 'Developer: Reload Window'
   Then check Past Conversations in Claude Code extension.

After Running

  1. Reload VS Code: Ctrl+Shift+P -> "Developer: Reload Window"
  2. Click Past Conversations in the Claude Code extension
  3. Your sessions should now appear

Notes

  • The junction persists across reboots -- you only need to run this once
  • If you change your rclone/mount configuration, re-run the script
  • Make sure the virtual drive is mounted before opening VS Code
  • No admin rights needed (NTFS junctions don't require elevation)
  • Requires Python 3.6+ (no external dependencies)

Session Grouping

When you have many sessions about the same project (e.g., 10 Centromere sessions), they appear as separate entries in Past Conversations. The --group feature auto-detects which sessions belong together and applies numbered custom titles:

Before:                          After:
  iridescent-conjuring-rocket      Project3_NicheQTL [1/1]
  reactive-spinning-walrus         Project2.1_NUMT_Fu_reproduce [1/1]
  proud-rolling-teapot             Project1_Centromere [1/8]
  tidy-conjuring-cloud             Project1_Centromere [2/8]
  curious-jumping-key              Project1_Centromere [3/8]
  ...                              ...

How grouping works (data-driven, no hardcoded keywords)

The script uses three layers of evidence from ~/.claude/, falling back automatically:

  1. search.db file_changes (strongest) -- SQLite database tracks which files each session edited. File paths reveal the project folder (e.g., z:/Project1_Centromere/src/Snakefile -> Project1_Centromere).

  2. file-history/ hash overlap -- Sessions that modified the same files (matching content hashes) are grouped together via connected-component clustering.

  3. First prompt path extraction (fallback) -- Extracts project folder names from file paths referenced in the session's first user message.

This works for any user without configuration -- it reads data Claude Code already stores locally.

How It Works

  1. Takes your workspace path (e.g., Z:\)
  2. Computes the CLI's directory name: z--
  3. Resolves the real path via os.path.realpath(): \\server\share\
  4. Computes the extension's expected directory name: --server-share-
  5. Creates an NTFS junction: ~/.claude/projects/--server-share- -> ~/.claude/projects/z--

Both the CLI and VS Code extension now read/write to the same session directory.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages