Skip to content

Instantly share code, notes, and snippets.

@legel
legel / export_cursor_chat_history_to_md.py
Last active May 8, 2025 07:18
Did Cursor crash? Did you lose your Cursor chat history? Need to export your data? This script was generated by Cursor to export your chat history in .md format from its potential location on a local SQL server. This can be fed back into a new Cursor chat as Context. Happy vibe coding.
#!/usr/bin/env python3
import sqlite3
import json
from pathlib import Path
from datetime import datetime
import os
import base64
def extract_conversations_from_db(db_path):
"""Extract all conversations from the database with detailed error handling."""