Add native garbage collection + rename-aware migration for ~/.cursor/projects/<namespace>/

Feature request for product/service

– Other –

Describe the request

Problem

Cursor creates a per-cwd namespace under ~/.cursor/projects// for every distinct working directory it has been launched from. Two failure modes accumulate over time:

  1. Junk slugs. Every cd /tmp/something or cd /var/folders/…/T/… spawns a tmp-, private-tmp-, or var-folders-* namespace with zero useful chat history. After a few months I had ~30 of these
    out of 83 total namespaces, all empty.

  2. Lost history on rename. If I rename or move a project directory, Cursor creates a brand-new namespace at the new path and the old agent-transcripts/ is silently orphaned. The transcripts
    still exist on disk, but cursor-sessions-style indexers and the in-app history don’t connect them to the renamed project.

Workaround I’m using today

I wrote a classifier + reversible quarantine script (slug-pattern + empty-transcripts + 7-day settle → mv to an archive with a manifest). It works but operators shouldn’t have to write this.

Requested behavior

  1. Background GC pass that on Cursor startup (or on a timer) moves namespaces matching all of:
    • slug starts with var-folders-, private-tmp, tmp-, or is empty-window / pure-numeric
    • agent-transcripts/ is missing or all-zero-byte
    • mtime older than N days (configurable, default 7)

    into ~/.cursor/_archive/projects/ (reversible — never rm -rf).

  2. Rename-aware migration: when Cursor opens a project whose realpath matches an existing namespace’s recorded realpath, migrate transcripts to the new slug instead of starting fresh.
    (Equivalent: key namespaces by inode or stored project-id, not by cwd-slug.)

Why now

This silently breaks “find that conversation from last month” workflows and is the most common complaint I hear from teammates trying out the agent CLI. The fix is straightforward and entirely
client-side.

Happy to share the classifier script as a reference implementation.

This is a well-documented request and matches something we’ve heard from others as well. The slugifyPath-based keying is indeed the root cause of the orphaning behavior you’ve identified, and the junk namespace accumulation is a real pain point.

We’ll be tracking this post to gauge interest from the community. If others are hitting the same issues, replies here help our product team prioritize accordingly.

Your classifier script sounds useful — feel free to share it in the thread for anyone dealing with this in the meantime.