feat: Cursor support — live agent transcripts + legacy state.vscdb import#113
Open
vicnaum wants to merge 5 commits into
Open
feat: Cursor support — live agent transcripts + legacy state.vscdb import#113vicnaum wants to merge 5 commits into
vicnaum wants to merge 5 commits into
Conversation
…b import - Detect and parse Cursor agent transcripts from ~/.cursor/projects (role/message JSONL): tool_use extraction, <user_query> unwrapping, sessionId from filename, cwd recovered from tool-call inputs with path-slug fallback - Add import-cursor-history command: exports pre-agent-transcript conversations from Cursor's state.vscdb (read-only) as parser-compatible JSONL with embedded per-message timestamps, deduped against live transcripts, project resolved to the enclosing git root - Scan ~/.cursor/projects and the legacy export dir as conversation sources (CURSOR_HOME override supported) - Preserve source mtime in sync's copyIfNewer so harnesses without per-message timestamps index with real conversation times
|
For the Cursor importer, I would keep provenance visible on every normalized conversation row. Useful fields: source kind ( Generated with ax - https://github.com/Necmttn/ax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Cursor as a third supported harness alongside Claude Code and Codex — search, index, summarize, and
showall work for Cursor conversations.What's included
Live transcripts. Cursor writes per-session agent transcripts to
~/.cursor/projects/<slug>/agent-transcripts/<uuid>/<uuid>.jsonlas{role, message:{content:[text|tool_use]}}lines. Added harness detection(role+message with no top-level
type;status/errornoise lines skipped sothey can't misdetect as Claude) and a parser:
<user_query>unwrapping,tool_use extraction, sessionId from the filename UUID. Transcripts carry no
timestamps or cwd, so timestamps fall back to file mtime (now preserved by
sync's
copyIfNewer) and cwd is recovered from tool-call inputs with the pathslug as fallback.
Legacy backfill. Conversations older than the agent-transcripts era exist
only in Cursor's global
state.vscdb. Newimport-cursor-historycommand opensit read-only (better-sqlite3, already a dep), exports each conversation as
parser-compatible JSONL with real per-message timestamps, skips composers that
already have a live transcript, and attributes projects to the enclosing git
root. Output goes to a staging dir scanned as a conversation source; idempotent,
with
--forceto re-export.showrendering. Added a Cursor branch to the markdown/HTML renderers(they previously knew only Claude/Codex, so Cursor transcripts rendered empty).
Also fixed along the way
claude --resumeon every non-Claude session; gated iton harness so Cursor/Codex sessions don't fail a resume before falling back.
(feedback loop); message-less transcripts are now skipped.
agent-<hex>.jsonl, no UUID in the filename) wereindexed but never summarized; they're now queued (summarized from text).
Testing
229 tests pass (added Cursor parser, legacy-import, sync, and show coverage).
Validated on a real archive: 1,911 composers → 629 legacy exported, 270 deduped
against live transcripts, ~1,000 empty drafts skipped, 0 errors; full
Claude+Codex+Cursor index searchable end-to-end.
dist/rebuilt per repoconvention (
npm ci && npm run build).