[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)
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 .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_*.jsondecoded, including the bridge field (cliSessionId) that maps each index entry to the on-disk.jsonl. - Proof that a DIY forge of
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. - 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:
%APPDATA%\Claude\claude-code-sessions\<accountId>\<orgId>\local_<sessionId>.json
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)
{
"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, 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.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).- Code-tab sidebar before fix: listed only the 2 entries that had
local_*.jsonfiles. - CLI
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.- After forging
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)
- Add a one-shot adoption scan at startup: enumerate
~/.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. - Add a
/sessions adoptslash command that does the same on-demand. - Restore the
/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 .jsonl history. Silently dropping visibility on Claude Desktop adoption is a hostile default.
References
- #29331 — canonical, closed
not_planned - #25524, #29220, #31787 — closed as duplicates of the same symptom
- #49775 — open feature request: unified session history across CLI, Desktop, VS Code, Web
- @xmeloun's comment in #29331 (2026-03-31, build 2.1.72) confirms
sessions-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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗