Skip to content

Instantly share code, notes, and snippets.

@loucadufault
Last active October 8, 2025 14:12
Show Gist options
  • Select an option

  • Save loucadufault/6e1d351e0654b529c97b625770475b93 to your computer and use it in GitHub Desktop.

Select an option

Save loucadufault/6e1d351e0654b529c97b625770475b93 to your computer and use it in GitHub Desktop.
Reconstruct Cursor chat

My installation of Cursor decides it likes to forget all our past conversations over the weekend (can't blame it, we all need some R&R 😌).

This gist is intended as a rough guide in case you want to manually recover some past chats.

Use the query in the bubble_texts.sql file to grab past chat text.

Data location

Chats are stored in .vscdb files which are SQLite databases. The location of these files is:

  • Windows: %APPDATA%\Cursor\User\workspaceStorage
  • macOS: ~/Library/Application Support/Cursor/User/workspaceStorage
  • Linux: ~/.config/Cursor/User/workspaceStorage

Additionally, (at least on macOS), there's a globalStorage folder in the same level which directly contains a single db file (unlike the workspaceStorage, where they are organized in subfolders). This is the storage for chats initiated directly from the launcher (not associated with any specific workspace).

Note

It seems that in a recent update Cursor migrated away from storing chat level data in workspaceStorage/[hash]/state.vscdb, and instead threads are now kept in globalStorage/state.vscdb.

Prior art

I did not have any luck with any of the recovery tools I tried:

So I decided to do some spelunking inside the data myself.

Tools

You will need to open the DB (.vscdb) file to inspect the data. I used DB Browser for SQLite.

DB structure

Each DB contains two tables. The chat data is contained in cursorDiskKV, with columns: key, value.

I didn't bother to attempt extracting more complex chat agentic data such as code edits or terminal usage, instead just looking at text content (both from the user and assistant). There are some UUIDs that are used to correlate text within the same conversation; the key includes a UUID that is shared across entries that are in the same chat.

For text content, the key format is like: bubbleId:<chat uuid>:<some other uuid>. The query above includes a condition to filter down to only include entries for a given chat UUID.

The value is a JSON with several fields, some interesting ones are listed below:

Field Description
text The human‑readable content of that chat bubble
type 1 for user message, 2 for assistant message
bubbleId Allows you to order / group messages in the UI context
usageUuid Links the message to a particular conversation session

There is no timestamp info for user messages, so we rely on default table ordering which seems to give the correct chronological ordering. Assistant messages have timingInfo, which is included as a column in the output.

Extracting conversation

Once you have the query result containing the conversation text, export it to a PDF or CSV file. You can then refer to that file, or pass it into a new LLM conversation as a primer.

SELECT
text_value,
json_extract(value, '$.type') AS message_type,
json_extract(value, '$.usageUuid') AS usage_uuid,
json_extract(value, '$.timingInfo.clientStartTime') as t,
key
FROM (
SELECT
json_extract(value, '$.text') AS text_value,
value,
key
FROM cursorDiskKV
)
WHERE text_value IS NOT NULL
AND text_value <> ''
AND key LIKE 'bubbleId:<your conversation uuid>:%'; -- optionally, leave this condition out to get all bubble texts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment