Shabash
Blog · Claude Code guides

Where did my Claude Code chat history go in VS Code?

Short answer

After 14 days without use, the VS Code extension moves a chat to Archived sessions, at the bottom of the Session history list. Once its file is 30 days old, Claude Code deletes it. Add "cleanupPeriodDays": 3650 to ~/.claude/settings.json to keep chats for years.

By Robin Mehta · September 27, 2026

The Claude Code extension in VS Code hides chats you haven't used in 14 days. It moves them to Archived sessions, a group at the very bottom of the history list, where it's easy to think they're gone.

They're still on your disk, but not for long. Once a chat's file is more than 30 days old, Claude Code deletes it in a cleanup that runs in the background after you start a session. After that, neither VS Code nor the terminal can open it.

Anthropic's docs only say a file goes once it's older than 30 days. On my Mac, that seems to count from the last time the chat's file changed, which is usually the last time you used it. Every chat I started more than 30 days ago that's still there has a file that changed in the last 30 days. So a chat that was just archived probably has about two weeks left.

When I counted my own history on September 27, that cleanup had already deleted the conversations from 820 of my 920 sessions (what I found).

Archived sessions, at the bottom of Session history

  1. Click the Session history button at the top of the Claude Code panel.
  2. Scroll to the bottom and expand Archived sessions.
  3. Click Unarchive session.

To bring every archived chat back at once (Claude Code v2.1.277 or later):

  1. Click the Spark icon in the Activity Bar, the strip of icons down the far left of VS Code.
  2. Hover over the Archived sessions header in that list.
  3. Click its unarchive icon.

The extension doesn't archive a chat that's open, unread, or in a group you made. Automatic archiving started in v2.1.265 (Anthropic's VS Code guide).

If you ran the chat on claude.ai/code instead, it's under the Web tab in the same Session history window. That tab needs a Claude.ai subscription sign-in, and in a GitHub repo it only shows that repo's sessions.

Chats deleted before v2.1.257 come back if under 30 days old

Before v2.1.257, Delete session didn't delete anything. It only hid the chat, with no way to undo it. After you upgrade, those chats show up under Archived sessions. Nice!

That only works while the chat's file is still on disk. The 30-day cleanup doesn't care that a chat was hidden, so if you haven't used it in more than 30 days, its file is most likely gone already.

Renamed folders and worktrees hide chats too

Claude Code saves each chat in a folder named after the project folder it ran in, with every /, dot, space or other character that isn't a letter or number turned into a hyphen. A chat in /Users/me/my-app is saved here:

~/.claude/projects/-Users-me-my-app/<session-id>.jsonl

A bug report on extension v2.1.259 says the extension's list only looks in the one folder that matches the project you have open (#91780). So a chat can vanish from the list while its file sits right there on disk. Two ways this happens:

claude --resume with Ctrl+A searches every project

The terminal's picker looks further than the extension does.

  1. Open a terminal and run:

    claude --resume

    If it says command not found, that's because the extension brings its own private copy of Claude Code and doesn't add claude to your terminal. Install it once, open a new terminal, and run claude --resume again:

    curl -fsSL https://claude.ai/install.sh | bash
  2. Type to search.
  3. Press Ctrl+A to see chats from every project on your computer. In a repo with more than one worktree, Ctrl+W shows chats from all of them.
  4. Pick a chat. If it's from another project, Claude Code copies a cd and resume command to your clipboard for you to paste. If that project's folder no longer exists because you renamed or moved it, Claude Code resumes the chat in your current folder instead (how the picker works).

cleanupPeriodDays keeps chats for years

Archiving only hides chats. The 30-day cleanup is what actually deletes them, so that's the one to change.

  1. Paste this into Claude Code:

    Add "cleanupPeriodDays": 3650 to ~/.claude/settings.json. Keep everything else in the file as it is, and show me the file afterwards.

    Or add the line yourself, inside the outer { } of that file, with a comma between it and the line before:

    "cleanupPeriodDays": 3650

    That keeps chats for about ten years, for the extension and the terminal alike. The files take more disk space as they pile up.

    A value your company sets wins everywhere. The same key in a project's .claude/settings.json or .claude/settings.local.json wins over yours when you start a session in that project. But the cleanup that session runs covers every project on your computer. So a smaller value in one repo can delete chats from all of them.

  2. If you'd rather have one long list, turn archiving off. In VS Code settings, search for "Archive Inactive Sessions" and pick Never. For just a few chats you care about, right-click one in the Activity Bar list and create a group. Grouped chats aren't archived.

None of this brings back a chat whose file is already gone. More on the 30-day cleanup.

Shabash, the Mac app I'm building, keeps its own copy of the sessions you typed in, VS Code included, so the 30-day cleanup can't take them, and reopening one from Shabash brings it back.

Questions

Where is Claude Code chat history in VS Code?

Click the Session history button at the top of the Claude Code panel, then search or scroll. Chats you haven't touched in 14 days sit in the Archived sessions group at the bottom of the list.

Why did my Claude Code chats disappear in VS Code?

Usually the extension archived them after 14 days with no activity, which it does from v2.1.265. Expand Archived sessions and click Unarchive session. To stop it, set claudeCode.archiveInactiveSessions to 0.

Does the VS Code extension share history with the Claude Code CLI?

A bug report says yes: a user found the extension's chats saved in ~/.claude/projects, and claude --resume in a terminal listed them. The same report says the extension's own list shows fewer, because it only looks at chats filed under the folder you have open.

How long does Claude Code keep chat history?

30 days by default. Once a chat's file is older than that, Claude Code deletes it in a cleanup that runs after you start a session, and neither VS Code nor the terminal can open it. Set cleanupPeriodDays in ~/.claude/settings.json to keep chats longer.

Can I get back chats I deleted in VS Code?

Yes, if you deleted them before v2.1.257, when Delete session only hid a chat. After you upgrade they show up under Archived sessions, as long as the 30-day cleanup hasn't removed their files yet. Since v2.1.257 the list offers Archive instead, which you can undo.