# How to Recover Chat History from Cursor Files?

**URL:** <https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272>\
**Category:** Help\
**Created:** [May 11, 2025, 7:47am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272 "2025-05-11T07:47:07Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![chen334](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/chen334/32/54096_2.png) [@chen334](https://forum.cursor.com/u/chen334)\
**Post date:** [May 11, 2025, 7:47am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/1 "2025-05-11T07:47:07Z")

</div>

Hi team,  
I accidentally deleted the entire project folder while Cursor was still open. Interestingly, all files disappeared except for the chat, which remained visible. I used the chat’s checkpoint feature to recover the code, and most file timelines were successfully restored.

However, after closing and reopening Cursor, the recovered files and timelines were still there—but the chat history itself was completely blank. I believe the chat data may still exist somewhere locally on my computer. Is there any way to recover the original chat history?

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [May 11, 2025, 9:20am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/2 "2025-05-11T09:20:25Z")

</div>

Hey, this might have happened because the project name changed, or you moved it to a different location on your disk, all of which breaks the connection with the chat history. You can also try to restore the chat history using this extension:

> **[SpecStory - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=SpecStory.specstory-vscode)**
>
> Extension for Visual Studio Code - Save, export, search and share AI chat history from GitHub Copilot and Cursor

---

<div class="post-metadata">

**Author:** ![stanlrt](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@stanlrt](https://forum.cursor.com/u/stanlrt)\
**Post date:** [May 11, 2025, 9:34am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/3 "2025-05-11T09:34:22Z")

</div>

Just revert the Git commit?

---

<div class="post-metadata">

**Author:** ![chen334](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/chen334/32/54096_2.png) [@chen334](https://forum.cursor.com/u/chen334)\
**Post date:** [May 11, 2025, 2:25pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/4 "2025-05-11T14:25:52Z")

</div>

Looks like this is my only option now. The version I backed up with Git is from a month ago, so thankfully the checkpoint feature helped me recover most of the lost work. I’m just curious—when the entire project folder was deleted, the chat was still functioning normally. I could view old conversations and even switch between multiple threads without any issues.  
But after restarting Cursor, the chat became completely blank with no conversations at all. I suspect the chat history might still be stored somewhere in the `.cursor` folder on my computer.

---

<div class="post-metadata">

**Author:** ![wearywas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wearywas/32/43297_2.png) [@wearywas](https://forum.cursor.com/u/wearywas)\
**Post date:** [May 11, 2025, 5:59pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/6 "2025-05-11T17:59:25Z")

</div>

Good morning! I’m down the rabbit hole trying to restore my chat history for ~5 months of work in Cursor across different projects after it randomly decided to stop loading for me following an auto-log out after restart this morning (🫠): [Can't load past chat after updating to a newer version - #6 by wearywas](https://forum.cursor.com/t/cant-load-past-chat-after-updating-to-a-newer-version/82573/6)

I’ve tried installing that extension but it seems like it would only be able to restore new chat sessions moving forward from what I can tell – is there something I’m missing for how it would restore past chats that are no longer loading? To recap, I can see the titles of the Past chats in the chat panel history, but clicking them (as I normally would to load any prior chat) just spins the icon and loads a blank state after – but I seem to be able to load chat history for new chats since the issue started, which… does not bode well for this being a random history corruption/wipe that’s unrecoverable (💀).

---

<div class="post-metadata">

**Author:** ![stanlrt](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@stanlrt](https://forum.cursor.com/u/stanlrt)\
**Post date:** [May 11, 2025, 7:45pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/7 "2025-05-11T19:45:13Z")

</div>

Why would you setup Git if it’s only to use it once a month? That completely defeats the purpose

---

<div class="post-metadata">

**Author:** ![jessicagertig](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jessicagertig/32/54310_2.png) [@jessicagertig](https://forum.cursor.com/u/jessicagertig)\
**Post date:** [May 12, 2025, 2:38am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/8 "2025-05-12T02:38:13Z")

</div>

DITTO

To be clear (since DITTO caused an error) I am in almost the identical position right this second.

---

<div class="post-metadata">

**Author:** ![adsantos](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/adsantos/32/55742_2.png) [@adsantos](https://forum.cursor.com/u/adsantos)\
**Post date:** [May 16, 2025, 6:31pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/9 "2025-05-16T18:31:36Z")

</div>

I’m glad to hear I’m not the only one facing a problem with my chat history.  
I changed my the name of my route folder, losy all the chat. Changed the the name back, the chats reappeared but can’t access them smh

---

<div class="post-metadata">

**Author:** ![larhou](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/larhou/32/7409_2.png) [@larhou](https://forum.cursor.com/u/larhou)\
**Post date:** [May 20, 2025, 9:20am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/10 "2025-05-20T09:20:42Z")

</div>

I am in a similar situation.

I updated to the latest version of Cursor and all my chat history is completely 100 % gone.

Did anyone solve this issue - please comment here.

---

<div class="post-metadata">

**Author:** ![condor](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/condor/32/73148_2.png) [@condor](https://forum.cursor.com/u/condor)\
**Post date:** [May 20, 2025, 2:17pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/11 "2025-05-20T14:17:57Z")

</div>

I recommend using SpecStory extension, it automatically exports each chat as MD file. This works great.

Now in Cursor 0.50 you can also manually export a chat you want to keep as MD file.

For old chats, depending what caused the chats to be deleted, it may not be recoverable.  
Perhaps if you have backups of your computer you could restore the old database.

Its recommended to have backups of your computer.

---

<div class="post-metadata">

**Author:** ![SUNLAND](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@SUNLAND](https://forum.cursor.com/u/SUNLAND)\
**Post date:** [June 22, 2025, 11:00am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/12 "2025-06-22T11:00:23Z")

</div>

SOLUTION:  
Cursor used 2 scripts to help search through the vscdb files and read them. I would tell Cursor what im looking for. key words, times, dates, and Cursor found everything one by one and compiled all the lost code and chat to a .md file. In conclusion ask Cursor to find it for you. I helped guide Cursor (EXAMPLE): " I remember asking to reduce the animation width by 50% and height by 50%." Cursor will find that point in the chat history and give all details and code involved.

- I asked Cursor to create a COPY and PASTE instruction message that you can give to your Cursor agent to help you recover lost chat history. here it is:  
"Please help me recover lost chat history from Cursor’s workspace storage. This is a two-step process:

1. First, create a Python script called `export_chats.py` that can search through SQLite databases in the workspace storage directory (on Mac: `~/Library/Application Support/Cursor/User/workspaceStorage`, each containing a `state.vscdb` file). The script should search through chat data for specific time periods and keywords related to the lost content.
2. Then, create a Node.js script called `clean_history.js` that processes the exported chat history. This script should:

- Filter conversations based on project-specific keywords
- Clean up markdown formatting
- Remove irrelevant content
- Output cleaned history files for each team  
We’ll need to make multiple search passes with `export_chats.py`, refining the parameters each time to filter out noise and focus on relevant conversations. Once we have the raw chat data, we’ll use `clean_history.js` to organize and clean it. When we find matching content, help me reconstruct the code and implementation details from the chat fragments. Please guide me through this process step by step, starting with creating both scripts and then helping me search effectively by suggesting relevant search terms and filtering strategies based on what I’m trying to recover. Remember that chat history might contain code snippets, implementation discussions, and debugging sessions that can help piece together the lost work."  
Youre good to go -  
I hope you get your code back like I just got mine. EASY CODING !

---

<div class="post-metadata">

**Author:** ![isimmons](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/isimmons/32/3799_2.png) [@isimmons](https://forum.cursor.com/u/isimmons)\
**Post date:** [July 16, 2025, 8:17am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/13 "2025-07-16T08:17:57Z")

</div>

I used your prompt with the Ubuntu location for workspaceStorage and have been working for 4 hours with Cursor to get the scripts right. It is now outputing md files but the only content is my inputs. It can’t seem to find any content from the AI responses in history, instead showing ‘—’ where there should be output from the AI. Nice work though and glad it works for you. It almost works for me. I’ll get AI to keep trying.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Kiefer](https://avatars.discourse-cdn.com/v4/letter/b/9f8e36/32.png) [@Benjamin\_Kiefer](https://forum.cursor.com/u/Benjamin_Kiefer)\
**Post date:** [October 1, 2025, 1:06am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/14 "2025-10-01T01:06:29Z")

</div>

Same for me on my Ubuntu. Only my prompts, but no responses..

---

<div class="post-metadata">

**Author:** ![Kyars](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/kyars/32/32502_2.png) [@Kyars](https://forum.cursor.com/u/Kyars)\
**Post date:** [November 20, 2025, 6:00pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/15 "2025-11-20T18:00:26Z")

</div>

That’s interesting. I changed the name back and I can’t access them nor see them. Can you please provide some extra context about what you mean that you can see them but can’t access them?

---

<div class="post-metadata">

**Author:** ![Zach.Stefan](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@Zach.Stefan](https://forum.cursor.com/u/Zach.Stefan)\
**Post date:** [January 11, 2026, 7:28am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/16 "2026-01-11T07:28:25Z")

</div>

> [@SUNLAND](#):
>
> Please help me recover lost chat history from Cursor’s workspace storage

I hope this helps someone like me, after an update I lost my most recent and most important porject I’ve been working on, Agent Chat History No where to be found, I asked the new agent “Please help me recover lost chat history from Cursor’s workspace storage“ making sure I was in the project workspace. IT WORKED

---

<div class="post-metadata">

**Author:** ![Artemonim](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/artemonim/32/56113_2.png) [@Artemonim](https://forum.cursor.com/u/Artemonim)\
**Post date:** [January 11, 2026, 8:33am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/17 "2026-01-11T08:33:41Z")

</div>

Or you can avoid wasting your quota and try Doctor in [Cursor Mover: Copy the workspace without losing the chats](https://forum.cursor.com/t/cursor-mover-copy-the-workspace-without-losing-the-chats/147874)

---

<div class="post-metadata">

**Author:** ![Anjay\_Sahoo](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Anjay\_Sahoo](https://forum.cursor.com/u/Anjay_Sahoo)\
**Post date:** [January 14, 2026, 3:35pm UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/18 "2026-01-14T15:35:03Z")

</div>

Thanks a lot! You saved my day, I was supposed to give demo showcasing something through chat history and without this I won’t be able take the session

---

<div class="post-metadata">

**Author:** ![Troy\_Heidtmann](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Troy\_Heidtmann](https://forum.cursor.com/u/Troy_Heidtmann)\
**Post date:** [January 27, 2026, 4:34am UTC](https://forum.cursor.com/t/how-to-recover-chat-history-from-cursor-files/90272/19 "2026-01-27T04:34:35Z")

</div>

here is a script. put it in a fresh cursor file with your storage.vcsdb file. ~/Library/Application Support/Cursor/User/globalStorage/ \<on Mac

the script will pull out all your chats with code changes and chat names into a folder. just have chat run it for you.

````auto
#!/usr/bin/env python3
import sqlite3
import json
import os
import re
from datetime import datetime

# Database path
db_path = "/Users/passes/Library/Application Support/Cursor/User/globalStorage/state.vscdb"
output_dir = "/Users/passes/Desktop/Passes CRM/cursor-chats-complete"

# Ensure output directory exists
os.makedirs(output_dir, exist_ok=True)

# Connect to database
conn = sqlite3.connect(db_path)
cursor = conn.cursor()

def sanitize_filename(name):
    name = re.sub(r'[<>:"/\\|?*]', '', name)
    name = name.replace(' ', '_')
    return name[:100]

print("=" * 70)
print("EXTRACTING COMPLETE CURSOR CONVERSATIONS")
print("=" * 70)

# Step 1: Get all composer data with names and conversation info
print("\nStep 1: Loading composer metadata...")
cursor.execute("SELECT key, value FROM cursorDiskKV WHERE key LIKE 'composerData:%'")
composer_data_rows = cursor.fetchall()

composers = {}
for key, value in composer_data_rows:
    try:
        data = json.loads(value)
        composer_id = data.get('composerId')
        name = data.get('name', 'Untitled Chat')
        created_at = data.get('createdAt')
        conversation_headers = data.get('fullConversationHeadersOnly', [])
        
        composers[composer_id] = {
            'name': name,
            'created_at': created_at,
            'bubble_ids': [h.get('bubbleId') for h in conversation_headers if 'bubbleId' in h],
            'data': data
        }
    except Exception as e:
        pass

print(f" Found {len(composers)} composer conversations")

# Step 2: Get all bubbles (messages)
print("\nStep 2: Loading all message bubbles...")
cursor.execute("SELECT key, value FROM cursorDiskKV WHERE key LIKE 'bubbleId:%'")
bubble_rows = cursor.fetchall()

# Organize bubbles by composer
bubbles_by_composer = {}
for key, value in bubble_rows:
    try:
        # Key format: bubbleId:<composer-id>:<bubble-id>
        parts = key.split(':')
        if len(parts) >= 3:
            composer_id = parts[1]
            bubble_id = parts[2]
            
            if composer_id not in bubbles_by_composer:
                bubbles_by_composer[composer_id] = {}
            
            bubble_data = json.loads(value)
            bubbles_by_composer[composer_id][bubble_id] = bubble_data
    except Exception as e:
        pass

print(f" Found {len(bubble_rows)} message bubbles across {len(bubbles_by_composer)} composers")

# Step 3: Export each conversation
print("\nStep 3: Exporting complete conversations...\n")

exported_count = 0
for idx, (composer_id, composer_info) in enumerate(sorted(composers.items(), key=lambda x: x[1].get('created_at', 0), reverse=True), 1):
    name = composer_info['name']
    created_at = composer_info['created_at']
    bubble_ids = composer_info['bubble_ids']
    
    # Skip if no bubbles
    if not bubble_ids or composer_id not in bubbles_by_composer:
        continue
    
    # Get all bubbles for this conversation
    composer_bubbles = bubbles_by_composer.get(composer_id, {})
    
    # Create filename
    safe_name = sanitize_filename(name) if name and name not in ['New Chat', 'Chat'] else f"chat_{composer_id[:16]}"
    filename = f"{idx:03d}_{safe_name}.md"
    filepath = os.path.join(output_dir, filename)
    
    # Build the conversation
    with open(filepath, 'w', encoding='utf-8') as f:
        f.write(f"# {name}\n\n")
        f.write(f" **Composer ID:** `{composer_id}`\n")
        if created_at:
            dt = datetime.fromtimestamp(created_at / 1000)
            f.write(f" **Created:** {dt.strftime('%Y-%m-%d %H:%M:%S')}\n")
        f.write(f" **Messages:** {len(bubble_ids)}\n\n")
        f.write("---\n\n")
        
        # Write each message
        message_count = 0
        for bubble_id in bubble_ids:
            if bubble_id not in composer_bubbles:
                continue
            
            bubble = composer_bubbles[bubble_id]
            msg_type = bubble.get('type')
            text = bubble.get('text', '')
            rich_text = bubble.get('richText', '')
            
            # Type 1 = User, Type 2 = Assistant
            if msg_type == 1:
                f.write(f"## 👤 User\n\n")
            elif msg_type == 2:
                f.write(f"## 🤖 Assistant\n\n")
            else:
                f.write(f"## Message (type {msg_type})\n\n")
            
            # Write the message content
            if text:
                f.write(f"{text}\n\n")
                message_count += 1
            elif rich_text:
                # Rich text might be JSON, try to extract readable content
                try:
                    if isinstance(rich_text, str):
                        rich_data = json.loads(rich_text)
                    else:
                        rich_data = rich_text
                    f.write(f"```json\n{json.dumps(rich_data, indent=2)[:1000]}...\n```\n\n")
                except:
                    f.write(f"{str(rich_text)[:500]}...\n\n")
            
            f.write("---\n\n")
        
        if message_count > 0:
            exported_count += 1
            print(f" ✓ {idx:03d}. {name[:60]:<60} ({message_count} messages)")

print(f"\n✅ Exported {exported_count} complete conversations")

# Step 4: Create an index
print("\nStep 4: Creating index...")

index_path = os.path.join(output_dir, "00_INDEX.md")
with open(index_path, 'w', encoding='utf-8') as f:
    f.write("# Cursor Conversations Index\n\n")
    f.write(f" **Exported:** {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
    f.write(f" **Total Conversations:** {exported_count}\n\n")
    f.write("---\n\n")
    
    for idx, (composer_id, composer_info) in enumerate(sorted(composers.items(), key=lambda x: x[1].get('created_at', 0), reverse=True), 1):
        name = composer_info['name']
        created_at = composer_info['created_at']
        bubble_ids = composer_info['bubble_ids']
        
        if not bubble_ids or composer_id not in bubbles_by_composer:
            continue
        
        composer_bubbles = bubbles_by_composer.get(composer_id, {})
        message_count = sum(1 for bid in bubble_ids if bid in composer_bubbles and composer_bubbles[bid].get('text'))
        
        if message_count > 0:
            safe_name = sanitize_filename(name) if name and name not in ['New Chat', 'Chat'] else f"chat_{composer_id[:16]}"
            filename = f"{idx:03d}_{safe_name}.md"
            
            f.write(f"## {idx}. {name}\n\n")
            f.write(f"- **File:** `{filename}`\n")
            f.write(f"- **Messages:** {message_count}\n")
            if created_at:
                dt = datetime.fromtimestamp(created_at / 1000)
                f.write(f"- **Created:** {dt.strftime('%Y-%m-%d %H:%M:%S')}\n")
            f.write("\n")

print(f"✅ Created index: 00_INDEX.md")

conn.close()

print("\n" + "=" * 70)
print("EXPORT COMPLETE!")
print("=" * 70)
print(f"\n📁 Location: {output_dir}")
print(f"📝 {exported_count} conversations exported with full message history")
print(f"📋 Index file: 00_INDEX.md")

````
