@molecule/api-agent-transcript-cursor

Provider bond · agent-transcript · API (Node) · v1.0.1 · Apache-2.0

Reads Cursor's "Export Chat" Markdown into a normalized agent session

npm install @molecule/api-agent-transcript-cursor

npm · Source on GitHub · Implements @molecule/api-agent-transcript

How it works

@molecule/api-agent-transcript-cursor is a provider bond on the API (Node) side: it implements the agent-transcript core interface (@molecule/api-agent-transcript) with a concrete vendor or library behind it.

Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.

import { readFileSync } from 'node:fs'
import { readTranscript, setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-cursor'

setProvider(provider)
const file = 'cursor_debugging_session.md'
const session = readTranscript({ text: readFileSync(file, 'utf8'), fileName: file })
console.log(session.harnessVersion, session.turns.length)

Works with: @molecule/api-agent-transcript

Reference

Cursor transcript reader for @molecule/api-agent-transcript.

Reads the Markdown file Cursor's "Export Chat" writes (the chat panel's ⋯ menu) into a normalized AgentSession: each **User** block is what you typed, each **Cursor** block is the reply.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { readFileSync } from 'node:fs'
import { readTranscript, setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-cursor'

setProvider(provider)
const file = 'cursor_debugging_session.md'
const session = readTranscript({ text: readFileSync(file, 'utf8'), fileName: file })
console.log(session.harnessVersion, session.turns.length)

Type

provider

Installation

npm install @molecule/api-agent-transcript-cursor @molecule/api-agent-transcript

API

Functions

looksLikeCursorExport(text)

Whether a text is a Cursor chat export.

function looksLikeCursorExport(text: string): boolean
  • text — The file's text.

Returns: True when its header names Cursor and a speaker marker follows.

readCursorExport(text)

Read a Cursor chat export.

function readCursorExport(text: string): AgentSession
  • text — The export's text.

Returns: The normalized session.

Constants

provider

Reads Cursor's "Export Chat" Markdown.

const provider: AgentTranscriptReader

Core Interface

Implements @molecule/api-agent-transcript interface.

Bond Wiring

Setup function to register this provider with the core interface:

import { setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-cursor'

export function setupAgentTranscriptCursor(): void {
  setProvider(provider)
}

Injection Notes

Requirements

Peer dependencies:

  • @molecule/api-agent-transcript ^1.0.0

Runtime Dependencies

  • @molecule/api-agent-transcript

  • The export names no model and records no file writes — Cursor leaves tool calls out of it — so every turn's model is unset and files empty.

  • harnessVersion is the Cursor version in the _Exported on … from Cursor (x.y.z)_ line. The date on that line is in the exporting machine's locale and is not read.

  • Only a **User** or **Cursor** line on its own splits turns, and the --- rule before each is dropped; a reply's own --- rules stay.

  • Detection needs the # title line followed by the _Exported on … from Cursor_ line, so a hand-written chat with **User** headings is not taken for a Cursor export.

  • Format read off real exports from Cursor 1.1.7, 2.1.46 and 2.3.41 (2026-09-29); Cursor itself is closed source.