Skip to content

fix(cursor-agent): ingest workspace-less CLI transcript layout#542

Merged
iamtoruk merged 2 commits into
getagentseal:mainfrom
ozymandiashh:pr/cursor-agent-workspaceless
Jun 21, 2026
Merged

fix(cursor-agent): ingest workspace-less CLI transcript layout#542
iamtoruk merged 2 commits into
getagentseal:mainfrom
ozymandiashh:pr/cursor-agent-workspaceless

Conversation

@ozymandiashh

@ozymandiashh ozymandiashh commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The Cursor Agent source reported $0.00 for sessions that were really run through cursor-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-agent invoked outside of a workspace does not write its transcript under a per project folder. It writes to a shared location:

projects/agent-transcripts/<uuid>/<uuid>.jsonl

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

  • Recognizes the workspace-less layout: when a project entry is itself the agent-transcripts directory, its transcripts are ingested directly.
  • Preserves the normal per project layout: any other project entry still requires its own <projectDir>/agent-transcripts/, and discovery skips the entry when that folder is absent.

Correctness notes

  • Discovery never scans a workspace storage root. Only an entry that is literally agent-transcripts, or a project that contains an agent-transcripts subfolder, 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.
  • Within a session's UUID directory, both a .jsonl and a .txt can exist for the same conversation. The reader groups files by stem and selects the .jsonl when present, skipping the sibling .txt, so a single conversation is not counted twice.

Tests

  • Regression 1: a workspace root that contains a top level .txt but no agent-transcripts directory yields no sources (no accidental ingestion).
  • Regression 2: a UUID transcript directory containing both .jsonl and .txt for the same session yields exactly one entry, the .jsonl.
  • Both fail before the change and pass after.
  • npm test: full suite green. npm run build: ok. tsc --noEmit: clean.

Scope

Touches only src/providers/cursor-agent.ts and tests/providers/cursor-agent.test.ts. The Cursor IDE provider, the two-source design, and the dashboard are untouched.

@iamtoruk iamtoruk merged commit 10d911d into getagentseal:main Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants