Skip to content

Support cursor-agent CLI sessions (~/.cursor/projects/*/agent-transcripts) #55

@AgentSeal

Description

@AgentSeal

What's missing

The cursor provider only reads the Cursor IDE's SQLite db at ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb. It does not parse sessions from cursor-agent, Cursor's headless CLI agent, which stores data separately under ~/.cursor.

Reported on HN by halostatue on the Show HN thread: https://news.ycombinator.com/item?id=47759035

Where the data lives

On macOS, cursor-agent writes to two locations under ~/.cursor:

  1. Transcripts (plain text)
    ~/.cursor/projects/<project-id>/agent-transcripts/<uuid>.txt

    <project-id> is either a timestamp (e.g. 1771021702762) or a slugified absolute path (e.g. Users-foo-Documents-MyProject).

  2. Code-attribution SQLite DB
    ~/.cursor/ai-tracking/ai-code-tracking.db

Linux/Windows paths need verification.

Transcript format

Plain text, one conversation per file. Observed markers:

  • user: with <user_query>...</user_query>
  • A: for assistant turns
  • [Thinking] ... for reasoning blocks
  • [Tool call] ToolName followed by indented args
  • [Tool result] ToolName

No token counts or model names inside the transcript text.

ai-code-tracking.db schema (relevant tables)

  • conversation_summaries (conversationId, title, tldr, model, mode, updatedAt)
  • ai_code_hashes (hash, source, fileName, conversationId, model, timestamp)
  • scored_commits (lines added/deleted split by tab/composer/human, v1AiPercentage, v2AiPercentage, commitDate)
  • tracked_file_content (gitPath, content, conversationId, model)

Good news: model is present, so conversations can be attributed. Bad news: no token counts anywhere in this DB.

Open questions

  1. Where do cursor-agent token counts live? Possibly server-side only. Worth checking ~/.cursor/extensions/, ~/.cursor/argv.json, and any VS Code-style log dirs before giving up.
  2. If tokens are not available locally, fall back to character-length estimation per model, clearly marked as estimated in the report.
  3. Confirm Linux (~/.cursor) and Windows paths.

Proposed approach

  1. Add a cursor-agent source (either a sibling file src/providers/cursor-agent.ts or extend cursor.ts with a second reader).
  2. Walk ~/.cursor/projects/*/agent-transcripts/*.txt.
  3. Join against ai-code-tracking.db on conversationId (extracted from the transcript filename if it matches, or from summaries) to pick up the model.
  4. Estimate tokens from transcript text length if no exact source is found. Mark clearly as estimated.
  5. Expose via codeburn report --provider cursor-agent. Decide whether to merge cursor-agent into the existing --provider cursor or keep them split.

Acceptance

  • codeburn today --provider cursor-agent lists today's cursor-agent sessions with project, model, tokens (exact or estimated), and cost.
  • The main report view includes cursor-agent sessions.
  • Tests cover: empty ~/.cursor/projects/, a single transcript, a project with many transcripts, missing ai-code-tracking.db, mixed IDE and CLI usage on the same machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions