Skip to content

Cursor loses your chat history if you move the project folder or move to a new hard drive. This script will help you get it back :)

License

Notifications You must be signed in to change notification settings

SunnyOd/cursor-chat-history-lost-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cursor Chat History Restore

A simple Python script to restore your chat history in Cursor Editor after moving projects or upgrading your hard drive.

Why?

Cursor ties your chat history (and other workspace state) to the absolute path of your project folder. If you:

  • Move a project folder
  • Rename a project folder
  • Migrate to a new hard drive with a different mount point

...Cursor sees it as a brand new project, and your chat history disappears. This script helps you map the "old" history to the "new" project location.

Features

  • Cross-Platform: Works on Linux, macOS, and Windows.
  • Automatic Matching: Scans for moved projects based on path prefixes (e.g., moving from /mnt/old/ to /home/new/).
  • Manual Migration: Restore history for specifically renamed projects (e.g., project-v1 -> project-v2).
  • Safe: Performs a "dry run" by default and backs up existing data before overwriting.

Installation

  1. Clone this repository or download cursor_chat_history_fix.py.
  2. Ensure you have Python 3 installed.

Configuration

The script uses a .env file for personal defaults so you don't have to keep re-typing them.

  1. Create a .env file (see .env.example):
    CURSOR_OLD_PREFIX=file:///your/old/path
    CURSOR_NEW_PREFIX=file:///your/new/path

Usage

1. The "Automatic" Method (Path Prefix Change)

If your .env is set up, just run:

# Preview changes (Dry Run)
python3 cursor_chat_history_fix.py

# Apply changes
python3 cursor_chat_history_fix.py --apply

You can still override the .env values using command-line arguments:

python3 cursor_chat_history_fix.py --apply --old-prefix "file:///mnt/old/path" --new-prefix "file:///home/new/path"

2. The "Manual" Method (Renamed Projects)

Use this if you renamed a single project folder and want your history back.

  1. List all workspaces to find your IDs:

    python3 cursor_chat_history_fix.py --list

    Look for the old folder (large size) and new folder (small size).

  2. Migrate manually:

    python3 cursor_chat_history_fix.py --manual OLD_ID:NEW_ID

Requirements

  • Open the project in its new location at least once so Cursor creates the destination folder.
  • Close Cursor before running the migration (the script will warn you if it detects it running).

License

MIT

About

Cursor loses your chat history if you move the project folder or move to a new hard drive. This script will help you get it back :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages