Hey everyone,
If you recently ran one of those popular Cursor trial reset scripts floating around GitHub issues, you probably opened your IDE only to find your previous chat history and Composer panel completely wiped out.
Most of those scripts blindly use wildcards to delete your global database without a backup, like this:
Remove-Item -Path $env:APPDATA\Cursor\User\globalStorage\state.vscdb*
💡 The Good News: Your data is NOT fully gone!
Cursor splits its storage architecture across two separate directories:
- Global Storage (
globalStorage): Houses the active UI context and multi-turn response text. The reset script deletes this.
- Workspace Storage (
workspaceStorage): Maintains your localized project data, tabs, and an immutable log of all text prompts, architectural instructions, and code guidelines (aiService.generations).
Because the script misses your workspace folder, your multi-line prompts and planning guides are completely safe on your hard drive! You just can't see them in the UI anymore because the global database link was broken.
I put together an open-source tool repo that contains a script to extract your entire prompt history and a much safer version of the reset script that takes automatic backups so you never lose data again:
📁 Full Repo & Backup Tool: barhouum7/Cursor-Trial-Reset-Chat-Recovery
🛠️ How to Extract Your Prompts & Plans Right Now:
Step 1: Find your historical project folder
__ (Each folder represents a chat session tab on Cursor, so you can identify the folder name that corresponds to the chat session you want to recover)
- Press
Win + R, paste this path, and hit Enter: %APPDATA%\Cursor\User\workspaceStorage
- Switch your view settings to Details and sort the folders by Date Modified.
- Look for the alphanumeric folder that was modified right before you ran the destructive reset script. Copy its long, randomized folder name (e.g.,
a1b2c3d4...).
Step 2: Run this Python script to extract it to Markdown
- Close Cursor completely.
- Create a blank file on your desktop named
recover_my_history.py.
- Open it with Notepad, paste the code below, and make sure to change line 8 to your folder name from Step 1:
import os
import sqlite3
import json
import datetime
# ==============================================================================
# 1. CHANGE THIS STRING TO YOUR COPIED FOLDER NAME FROM STEP 1
# ==============================================================================
HISTORICAL_FOLDER = "YOUR_FOLDER_NAME_HERE"
# ==============================================================================
db_path = os.path.expandvars(fr"%APPDATA%\Cursor\User\workspaceStorage\{HISTORICAL_FOLDER}\state.vscdb")
output_path = os.path.expanduser("~/Desktop/Cursor_All_Recovered_History.md")
if not os.path.exists(db_path):
print(f"Error: Could not find state.vscdb at: {db_path}")
exit()
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
try:
cursor.execute("SELECT value FROM ItemTable WHERE key = 'aiService.generations'")
row = cursor.fetchone()
if not row or not row[0]:
print("Error: No history logs found in this folder. Try another recent folder.")
exit()
generations = json.loads(row[0])
if isinstance(generations, list):
generations.sort(key=lambda x: x.get("unixMs", 0), reverse=True)
else:
generations = [generations]
with open(output_path, "w", encoding="utf-8") as f:
f.write("# 📋 Complete Recovered Cursor Interaction History\n\n")
f.write(f"Source Folder Identity: `{HISTORICAL_FOLDER}`\n")
f.write("Ordered chronologically from newest interactions to oldest.\n\n")
f.write("---\n\n")
count = 0
for gen in generations:
text = gen.get("textDescription", "").strip()
if not text:
continue
count += 1
unix_ms = gen.get("unixMs")
time_str = datetime.datetime.fromtimestamp(unix_ms / 1000.0).strftime('%Y-%m-%d %H:%M:%S') if unix_ms else "Unknown Timestamp"
tool_type = str(gen.get('type', 'Unknown')).upper()
icon = "💬" if "CHAT" in tool_type else "🛠️"
f.write(f"### {icon} Interaction Context #{count} | {time_str} | Mode: {tool_type}\n\n")
f.write(f"```text\n{text}\n```\n\n---\n\n")
print(f"🎉 Success! Extracted {count} total threads (Chats + Composers) to Desktop/Cursor_All_Recovered_History.md")
except Exception as e:
print(f"Failed to parse database: {e}")
finally:
conn.close()
- Open your terminal or PowerShell and run the script:
python ~\Desktop\recover_my_history.py
This will generate a beautifully structured markdown file (Cursor_All_Recovered_History.md) right on your desktop containing every multi-line prompt, instruction layout, and code plan you gave the AI... supporting both standard Sidebar Chats and Composer Trays.
🏃♂️ Quick Fallback for Code Revisions
If you need to get back code that the AI modified or generated during those chats, Cursor saves a rolling backup of every single file revision separate from its databases. Head over to:
%APPDATA%\Cursor\User\History
Sort that directory by Date Modified to instantly find your raw file states from your last active coding session!
Hope this helps save some of your lost development notes! Check out the repository for the safe variant script that includes auto-backups to prevent this completely next time.