DEV Community

Cover image for I Built a CLI Because Cursor Keeps Losing My Chat History
Gabriel Wu
Gabriel Wu

Posted on

I Built a CLI Because Cursor Keeps Losing My Chat History

You know that feeling when you rename a project folder and suddenly weeks of AI conversations just... vanish?

I do. It happened to me three times before I decided to fix it.

The Problem Nobody Talks About

Cursor IDE is incredible. But it has a dirty secret: your chat history is tied to your folder path.

Rename my-project to my-awesome-project? Gone.
Move it from ~/dev/ to ~/projects/? Gone.
Clone it to a new location? Gone.

The data isn't deleted β€” it's still sitting in ~/Library/Application Support/Cursor/User/workspaceStorage/(for MacOS). But Cursor can't find it anymore because the path changed.

I searched for solutions. Found forum posts with manual workarounds:

  1. Find the old workspace folder by hash
  2. Copy contents to the new folder
  3. Edit workspace.json to update the path
  4. Pray it works

That's insane. So I built a tool.

The Fix: One Command

cargo install cursor-helper
cursor-helper rename /old/path /new/path

# Or copy if you want to keep the old folder
cursor-helper rename -c /old/path /new/path
Enter fullscreen mode Exit fullscreen mode

That's it. Your chat history, workspace settings, MCP cache β€” everything stays intact.

What Else It Does

Export Chats (With the Good Stuff)

Cursor's built-in export strips out thinking blocks and tool calls. Mine doesn't.

# Full export with AI reasoning, tool calls, and token counts
cursor-helper export-chat /path/to/project -v > full-chat-history.md
Enter fullscreen mode Exit fullscreen mode

Output includes:

### πŸ’­ **Thinking** _12.3s_

<details>
<summary>Click to expand thinking...</summary>

The user wants me to refactor the authentication module...
</details>

### πŸ”§ **Tool: edit_file** [completed]

<details>
<summary>Parameters</summary>

{"path": "src/auth.rs", "old_string": "...", "new_string": "..."}
</details>
Enter fullscreen mode Exit fullscreen mode

This is useful for:

  • Documenting how you solved complex problems
  • Training yourself (or others) on AI-assisted workflows
  • Keeping receipts when the AI does something clever (or dumb)

List All Your Projects

cursor-helper list --sort chats --limit 10
Enter fullscreen mode Exit fullscreen mode
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Remote   β”‚ Path                           β”‚ Chats β”‚ Modified         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ -        β”‚ /Users/me/projects/cursor-help β”‚ 47    β”‚ 2026-01-19 16:04 β”‚
β”‚ tunnel   β”‚ /home/user/big-project         β”‚ 23    β”‚ 2026-01-18 09:30 β”‚
β”‚ ssh      β”‚ /workspace/client-work         β”‚ 12    β”‚ 2026-01-15 14:22 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Clean Up Orphaned Data

Deleted some projects? Cursor keeps the workspace data forever.

cursor-helper clean --dry-run
Enter fullscreen mode Exit fullscreen mode
Found 8 orphaned workspace(s):

  /Users/me/.../abc123def456 (234.5 MB)
    Original: file:///Users/me/deleted-project

Total: 1.2 GB in 8 item(s)
Enter fullscreen mode Exit fullscreen mode

Reclaim that disk space.

How It Works

Cursor stores workspace data in two places:

  1. workspaceStorage/<hash>/ β€” Chat history, settings, state
  2. ~/.cursor/projects/<folder-id>/ β€” MCP cache, terminal info

The hash is computed as MD5(absolutePath + birthtimeMs). When you rename a folder, the path changes, the hash changes, and Cursor creates a new empty workspace.

cursor-helper:

  1. Finds the old workspace by scanning for matching folder URIs
  2. Moves/copies the project folder
  3. Moves/copies the workspace data to the new hash location
  4. Updates workspace.json with the new path
  5. Updates globalStorage/storage.json with the new workspace reference

All in one command.

Installation

# From crates.io
cargo install cursor-helper

# Or grab a binary from GitHub Releases
Enter fullscreen mode Exit fullscreen mode

Works on macOS, Linux (experimental), and Windows.

The Catch

Cursor must be closed when running write operations (rename, clone, backup, restore, clean).

Why? Cursor uses SQLite with WAL mode and keeps databases locked while running. If you modify files while it's open, you risk corruption or Cursor overwriting your changes on exit.

Read-only commands (list, stats, export-chat) work fine while Cursor is running.

Compared to Alternatives

Tool What it does Rename support?
cursor-helper Workspace management + export βœ… Yes
SpecStory Auto-save chats to Markdown ❌ No
cursor-chat-transfer Copy chats between workspaces ❌ No
cursor-chat-browser Browse/export chat history ❌ No

cursor-helper is the only tool that solves the rename/move problem.

Links

MIT licensed. Contributions welcome.


This tool is not affiliated with Anysphere/Cursor. It reads your local data files for backup and portability β€” no servers, no APIs, no telemetry.


Have you lost chat history to a rename? Let me know in the comments.

Top comments (0)