fix(cursor-agent): ingest workspace-less CLI transcript layout#542
Merged
iamtoruk merged 2 commits intoJun 21, 2026
Merged
Conversation
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.
Summary
The Cursor Agent source reported
$0.00for sessions that were really run throughcursor-agent. The cause is a transcript layout that discovery did not recognize. This PR teaches the provider to ingest the workspace-less CLI layout while keeping the existing layouts intact.Problem
cursor-agentinvoked outside of a workspace does not write its transcript under a per project folder. It writes to a shared location:Discovery only looked for
projects/<projectId>/agent-transcripts/, so these workspace-less sessions were never picked up and their usage never counted.Note that the two Cursor entries in the dashboard are by design: the Cursor IDE provider (reads the IDE's
state.vscdb) and the Cursor Agent CLI provider (reads~/.cursor) are separate sources and stay separate. This PR only fixes the CLI reader.What this PR does
agent-transcriptsdirectory, its transcripts are ingested directly.<projectDir>/agent-transcripts/, and discovery skips the entry when that folder is absent.Correctness notes
agent-transcripts, or a project that contains anagent-transcriptssubfolder, is read. This is deliberate: scanning the storage root would sweep up unrelated top level files (extension state, crash logs, telemetry.txt) and misattribute them as transcripts..jsonland a.txtcan exist for the same conversation. The reader groups files by stem and selects the.jsonlwhen present, skipping the sibling.txt, so a single conversation is not counted twice.Tests
.txtbut noagent-transcriptsdirectory yields no sources (no accidental ingestion)..jsonland.txtfor the same session yields exactly one entry, the.jsonl.npm test: full suite green.npm run build: ok.tsc --noEmit: clean.Scope
Touches only
src/providers/cursor-agent.tsandtests/providers/cursor-agent.test.ts. The Cursor IDE provider, the two-source design, and the dashboard are untouched.