You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BUG] Claude Desktop "Code" tab: pre-existing CLI/VS Code sessions invisible — local_*.json index entries never created for them (reopen of #29331 with reverse-engineered schema + DIY fix proof) #58670
Reopening the unresolved behavior of #29331 (closed as not_planned), #25524, #29220, and #31787. Pre-existing CLI and VS Code extension sessions are absent from the Claude Desktop "Code" tab sidebar despite intact .jsonl files on disk. After reverse-engineering the Desktop's per-session index format, the root cause is clear and would be straightforward for Anthropic to fix.
Environment
OS: Windows 11
Claude Desktop: MSIX Claude_1.7196.0.0_x64__pzs8sxrjxfjjc
Bundled Claude Code: 2.1.138
Difference from #29331 and other prior reports — please do not auto-close as duplicate
Prior issues focused on the symptom ("sessions invisible") and on sessions-index.json rebuild attempts (which @xmeloun's comment in #29331 confirmed empirically have no effect). This report adds substantive new evidence:
Schema of the Desktop's per-session index file local_*.json decoded, including the bridge field (cliSessionId) that maps each index entry to the on-disk .jsonl.
Proof that a DIY forge of local_*.json entries successfully populates the Code-tab sidebar with all 207 pre-existing sessions — confirming this is a pure indexing gap, not a data-integrity, permissions, or path problem.
Concrete fix path (one-shot adoption scan at startup) with the exact field-mapping Anthropic engineers would need.
This is not a duplicate "my sessions disappeared" report — it's a root-cause + reproducible-fix submission.
Root cause (reverse-engineered)
The Code tab sidebar is populated exclusively from per-session JSON index entries at:
Each entry contains a cliSessionId field that maps to a .jsonl file at ~/.claude/projects/<slug>/<cliSessionId>.jsonl.
The Desktop app only writes local_*.json entries for sessions it itself creates. It never scans ~/.claude/projects/<slug>/ to detect / adopt pre-existing CLI or VS Code-extension sessions. There is no documented command, setting, or /slash to trigger a one-time scan-and-adopt.
Schema of local_*.json (decoded from a working Desktop-created sample)
The fields title, createdAt, lastActivityAt, and completedTurns are derivable from the .jsonl itself (type: ai-title entries, first/last timestamp entries, count of type: assistant entries).
Empirical evidence on my machine
~/.claude/projects/<slug>/: 225 .jsonl files (207 pre-existing from CLI + VS Code extension, 18 Desktop-created today).
%APPDATA%\Claude\claude-code-sessions\<accountId>\<orgId>\ before fix: only 2 local_*.json files (the 2 most-recent Desktop-created sessions — the other 16 from today had already been pruned by the app).
Code-tab sidebar before fix: listed only the 2 entries that had local_*.json files.
CLI claude --resume from terminal: lists and resumes all 225 correctly.
/resume slash command inside the Code tab: not available — a regression vs CLI and a missing escape hatch for this exact scenario.
After forging local_*.json entries for the 207 missing ones (matching the schema above): all 209 entries appear in the sidebar. The Code tab opens them and renders message history correctly.
Proposed fixes (any of the three would resolve)
Add a one-shot adoption scan at startup: enumerate ~/.claude/projects/<slug>/*.jsonl. For each .jsonl not already referenced by an existing local_*.json (via cliSessionId), create a corresponding entry. All required fields are derivable from the .jsonl content.
Add a /sessions adopt slash command that does the same on-demand.
Restore the /resume slash command parity with the CLI so users have at least one in-app access path to pre-existing history without needing sidebar discovery at all.
Pre-existing users have invested significant project context in their .jsonl history. Silently dropping visibility on Claude Desktop adoption is a hostile default.
Summary
Reopening the unresolved behavior of #29331 (closed as
not_planned), #25524, #29220, and #31787. Pre-existing CLI and VS Code extension sessions are absent from the Claude Desktop "Code" tab sidebar despite intact.jsonlfiles on disk. After reverse-engineering the Desktop's per-session index format, the root cause is clear and would be straightforward for Anthropic to fix.Environment
Claude_1.7196.0.0_x64__pzs8sxrjxfjjc2.1.138Difference from #29331 and other prior reports — please do not auto-close as duplicate
Prior issues focused on the symptom ("sessions invisible") and on
sessions-index.jsonrebuild attempts (which @xmeloun's comment in #29331 confirmed empirically have no effect). This report adds substantive new evidence:local_*.jsondecoded, including the bridge field (cliSessionId) that maps each index entry to the on-disk.jsonl.local_*.jsonentries successfully populates the Code-tab sidebar with all 207 pre-existing sessions — confirming this is a pure indexing gap, not a data-integrity, permissions, or path problem.This is not a duplicate "my sessions disappeared" report — it's a root-cause + reproducible-fix submission.
Root cause (reverse-engineered)
The Code tab sidebar is populated exclusively from per-session JSON index entries at:
Each entry contains a
cliSessionIdfield that maps to a.jsonlfile at~/.claude/projects/<slug>/<cliSessionId>.jsonl.The Desktop app only writes
local_*.jsonentries for sessions it itself creates. It never scans~/.claude/projects/<slug>/to detect / adopt pre-existing CLI or VS Code-extension sessions. There is no documented command, setting, or/slashto trigger a one-time scan-and-adopt.Schema of
local_*.json(decoded from a working Desktop-created sample){ "sessionId": "local_<desktop-uuid>", "cliSessionId": "<filename-uuid-of-.jsonl>", "cwd": "<absolute path>", "originCwd": "<absolute path>", "createdAt": <epoch-ms>, "lastActivityAt": <epoch-ms>, "model": "claude-opus-4-7[1m]", "effort": "max", "isArchived": false, "title": "<sidebar label>", "titleSource": "auto", "permissionMode": "bypassPermissions", "enabledMcpTools": { }, "remoteMcpServersConfig": [], "chromePermissionMode": "skip_all_permission_checks", "completedTurns": <int>, "alwaysAllowedReasons": [], "sessionPermissionUpdates": [], "classifierSummaryEnabled": true }The fields
title,createdAt,lastActivityAt, andcompletedTurnsare derivable from the.jsonlitself (type: ai-titleentries, first/lasttimestampentries, count oftype: assistantentries).Empirical evidence on my machine
~/.claude/projects/<slug>/: 225.jsonlfiles (207 pre-existing from CLI + VS Code extension, 18 Desktop-created today).%APPDATA%\Claude\claude-code-sessions\<accountId>\<orgId>\before fix: only 2local_*.jsonfiles (the 2 most-recent Desktop-created sessions — the other 16 from today had already been pruned by the app).local_*.jsonfiles.claude --resumefrom terminal: lists and resumes all 225 correctly./resumeslash command inside the Code tab: not available — a regression vs CLI and a missing escape hatch for this exact scenario.local_*.jsonentries for the 207 missing ones (matching the schema above): all 209 entries appear in the sidebar. The Code tab opens them and renders message history correctly.Proposed fixes (any of the three would resolve)
~/.claude/projects/<slug>/*.jsonl. For each.jsonlnot already referenced by an existinglocal_*.json(viacliSessionId), create a corresponding entry. All required fields are derivable from the.jsonlcontent./sessions adoptslash command that does the same on-demand./resumeslash command parity with the CLI so users have at least one in-app access path to pre-existing history without needing sidebar discovery at all.Pre-existing users have invested significant project context in their
.jsonlhistory. Silently dropping visibility on Claude Desktop adoption is a hostile default.References
not_plannedsessions-index.jsonrebuild has no effect. This report extends that finding by identifying the actual index format (local_*.json) and demonstrating it IS forgeable to restore visibility.