claude-code - 💡(How to fix) Fix [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) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58670Fetched 2026-05-14 03:42:26
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1mentioned ×1subscribed ×1

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.

Root Cause

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.

Code Example

%APPDATA%\Claude\claude-code-sessions\<accountId>\<orgId>\local_<sessionId>.json

---

{
  "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
}
RAW_BUFFERClick to expand / collapse

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:

  1. 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.
  2. 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.
  3. 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 .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)

  1. 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.
  2. Add a /sessions adopt slash command that does the same on-demand.
  3. 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.

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.json rebuild has no effect. This report extends that finding by identifying the actual index format (local_*.json) and demonstrating it IS forgeable to restore visibility.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [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) [1 comments, 2 participants]