CRITICAL: Conversations disappear when closing VSCode or navigating away

Status Open
Maintainer reply None cached
Activity 16 comments · opened Feb 8, 2026

Description

Conversations are completely disappearing and becoming unrecoverable when:

  • Closing and reopening VSCode
  • Navigating to the chat summary page and returning to a conversation
  • Switching between conversations

The chat history is lost with no way to recover it. This makes it impossible to maintain long-running development sessions.

Reproduction Steps

  1. Start a conversation in Claude Code
  2. Work for a while (multiple exchanges)
  3. Close VSCode or navigate to chat summary page
  4. Reopen VSCode or return to the conversation
  5. Expected: Conversation history is preserved
  6. Actual: Conversation is gone, completely vanished

Impact

  • Severity: CRITICAL - Work cannot be persisted across sessions
  • Blocker: Prevents any meaningful development work
  • Frequency: 100% reproducible - happens every time

Environment

  • OS: Windows (win32)
  • Date: 2026-02-08
  • Branch: hdfc-skr-snapshot (finance_app)

Current Workaround

Users are forced to manually create git backups of entire conversation transcripts after each session, which is not a sustainable solution.

Expected Behavior

Claude Code conversations should persist automatically and be fully recoverable when:

  • Reopening VSCode
  • Returning from chat summary
  • Switching between active conversations

This is a core feature that should "just work".

View original on GitHub ↗

16 Comments

BrittJuliff · 7 months ago

Please fix.

AndyHaack · 7 months ago

Yes, it's quite bad and very annoying.

chousertest · 6 months ago

We're experiencing this across multiple enterprise users on Windows/VSCode. Conversation persistence is a hard requirement for our workflows, and the current behavior is blocking adoption for longer development tasks. Happy to provide logs or assist with testing a fix if that would be helpful.

czgray · 6 months ago

I am also experiencing this problem. I lose 1 chat every time i close Claude code. I believe it is the one I have worked on most recently, which is obviously extremely frustrating. I have also noticed that VSCode chats do not keep their name changes most of the time. Unsure if it is a symptom of the same problem, or a separate problem.

matr1x-1 · 6 months ago

Same here. Very frustrating. I have just lost an important conversation after 2 hours of debugging. I am on Linux and it does not happen all the time.

markwhitehead · 6 months ago

I threw Claude at this and sorted out a fix by patching the vs code extension JS. Works for me on Windows 11, hopefully it works for others.

It adds a fallback path for history/session loading:

  • If the extension’s normal session index returns nothing, it reads session .jsonl files directly from ~/.claude/projects/<mapped-cwd>/.
  • If opening a specific session returns empty, it directly loads <sessionId>.jsonl.
  • It restores list titles from ai-title records (or first user text).
  • It filters loaded records to message types the UI can render.

Patch file:
~/.vscode/extensions/anthropic.claude-code-2.1.101-win32-x64/extension.js

Replace the entire listSessions() method with:

async listSessions(){let K=this.cwd,V=await zd({dir:K,includeWorktrees:!1});if(V.length===0&&typeof K==="string"&&/^[a-z]:\\/.test(K)){let q=K[0].toUpperCase()+K.slice(1);if(q!==K){let z=await zd({dir:q,includeWorktrees:!1});z.length>0&&(this.logger.warn(`listSessions path-case fallback: ${K} -> ${q} (${z.length} sessions)`),K=q,V=z)}}let B=await g1.readTeleportMetadata(K,V.map((H)=>H.sessionId)),j=V.map((H)=>{let N=B.get(H.sessionId);return{id:H.sessionId,lastModified:H.lastModified,fileSize:H.fileSize,summary:H.summary,gitBranch:H.gitBranch,worktree:UR4(H.cwd),isCurrentWorkspace:!0,...N}});if(j.length===0)try{let q=require("os"),z=require("path"),U=require("fs"),Z=typeof K==="string"?K.replace(/[\\/:]/g,"-"):String(K),D=z.join(q.homedir(),".claude","projects"),L=z.join(D,Z),O=U.existsSync(L)?U.readdirSync(L).filter((F)=>F.endsWith(".jsonl")):[],N=O.map((F)=>{let M=z.join(L,F),A=U.statSync(M),w=F.replace(/\.jsonl$/,""),I=B.get(w),R=I?.summary;if(!R)try{let E=U.readFileSync(M,"utf8").split(/\r?\n/).filter((P)=>P.trim().length>0);for(let P of E){let T;try{T=JSON.parse(P)}catch{continue}if(T?.type==="ai-title"&&typeof T.aiTitle==="string"&&T.aiTitle.trim()){R=T.aiTitle.trim();break}if(!R&&T?.type==="user"){let h=T?.message?.content;if(Array.isArray(h)){let C=h.find((c)=>c?.type==="text"&&typeof c.text==="string"&&c.text.trim());if(C){R=C.text.trim(),R.length>70&&(R=R.slice(0,67)+"...")}}}}}catch{}return{id:w,lastModified:A.mtimeMs,fileSize:A.size,summary:R||w,gitBranch:I?.gitBranch,worktree:I?.worktree,isCurrentWorkspace:!0,...I}}),x=U.existsSync(L)?O.length:-1,G=U.existsSync(D)?U.readdirSync(D,{withFileTypes:!0}).filter((F)=>F.isDirectory()).map((F)=>F.name).slice(0,30):[];this.logger.warn(`listSessions debug cwd=${K} key=${Z} projectDir=${L} projectJsonl=${x} projectsRoot=${D} knownProjectDirs=${G.join(",")}`),N.length>0&&(this.logger.warn(`listSessions file fallback used: ${N.length} sessions from ${L}`),j=N)}catch(q){this.logger.warn(`listSessions debug failed: ${q}`)}ja(j);let Y=new Set(this.settings.getHiddenSessionIds()),X=Y.size>0?j.filter((H)=>!Y.has(H.id)):j;return X.length===0&&j.length>0&&(this.logger.warn(`listSessions fallback: hidden filter removed all sessions (cwd=${K}, total=${j.length}, hidden=${Y.size})`),X=j),this.logger.log(`listSessions cwd=${K} total=${j.length} hidden=${Y.size} returned=${X.length}`),{type:"list_sessions_response",sessions:X}}

Replace the entire getSession(K) method with:

async getSession(K){let V=this.cwd,B;try{B=await Ld(K,{dir:V})}catch(j){if(typeof V==="string"&&/^[a-z]:\\/.test(V)){let Y=V[0].toUpperCase()+V.slice(1);if(Y!==V)try{B=await Ld(K,{dir:Y}),this.logger.warn(`getSession path-case fallback: ${V} -> ${Y} (session=${K})`),V=Y}catch{}}if(!B)try{let Y=require("os"),X=require("path"),Q=require("fs"),G=(typeof V==="string"?V:String(V)).replace(/[\\/:]/g,"-"),q=X.join(Y.homedir(),".claude","projects",G,`${K}.jsonl`);if(Q.existsSync(q)){let z=Q.readFileSync(q,"utf8").split(/\r?\n/).filter((U)=>U.trim().length>0);B=[];for(let U of z)try{B.push(JSON.parse(U))}catch{}this.logger.warn(`getSession file fallback used: session=${K} file=${q} raw=${B.length}`)}}catch{}if(!B)throw j}if(!B||B.length===0)try{let Y=require("os"),X=require("path"),Q=require("fs"),G=(typeof V==="string"?V:String(V)).replace(/[\\/:]/g,"-"),q=X.join(Y.homedir(),".claude","projects",G,`${K}.jsonl`);if(Q.existsSync(q)){let z=Q.readFileSync(q,"utf8").split(/\r?\n/).filter((U)=>U.trim().length>0),U=[];for(let Z of z)try{U.push(JSON.parse(Z))}catch{}if(U.length>0)B=U,this.logger.warn(`getSession empty->file fallback used: session=${K} file=${q} raw=${B.length}`)}}catch{}let j;try{j=await(await g1.load(V,this.logger)).getSessionDiffs(K,V,B||[])}catch{j=void 0}let Y=(B||[]).filter((H)=>H?.type==="user"||H?.type==="assistant"||H?.type==="system"||H?.type==="meta"||H?.type==="compact");return this.logger.log(`getSession id=${K} raw=${(B||[]).length} filtered=${Y.length} cwd=${V}`),{type:"get_session_response",messages:Y,sessionDiffs:j}}

Then run:

  • Developer: Reload Window or restart VS Code
roughorange · 6 months ago

Same Problem. Windows 11 with WSL editing in Linux Ubuntu. Using the IDE, not the terminal.

defiled · 5 months ago

Been happening for ages. Very annoying.

FladioArmandika · 3 months ago

same problem after 5 months of this PR.

ginogagliardi · 2 months ago

still also happening for me

RobotPsychologist · 2 months ago

Hello, I'm wondering if there is any updates on this? This is a critical issue for me, please let me know if there is anything information I can provide to help diagnose the problem. Even on Developer: Reload Window all of my chats disappear. New chats don't produce output from models, and the chat sessions tab shows thousands of line changes even though no code change has occurred.

<img width="994" height="2003" alt="Image" src="https://github.com/user-attachments/assets/735d0721-d892-4178-bbc0-48faad3e0c4f" />

AntonR-github · 2 months ago

21 sessions on disk, only 2 shown in panel

BasedGPT · 2 months ago

Hey AntonR-github, 21 .jsonl sessions on disk with only two visible in the VS Code panel sounds like the extension's session-list cache has dropped entries, rather than the transcript files being missing.

I built BasedGPT/claude-code-session-recovery with a read-only diagnose.py route for this case. Run python tools/diagnose.py first and follow the exact command it prints. For the VS Code panel gap, the guarded path is recover_vscode_sessions.py in a dry run. Review what it proposes before applying it, and keep VS Code fully closed for any write step.

Hope this helps, if my tools are able to help you, would appreciate a ⭐ :)

aynewsd · 1 month ago

It’s still going on, which is really frustrating.

ginogagliardi · 1 month ago

Please please, can we have someone fix this? This is super annoying!

RobotPsychologist · 1 month ago

This issue seems to be fixed for me now tied to a VSCode update:

https://github.com/microsoft/vscode/issues/328736#issuecomment-5430874462

Not sure if it's still affecting others.