Skip to content

Add a Cursor session parser #4

Description

@royalpinto007

src/ctxlens/parsers/ has claude_code, codex and openai_chat. Cursor is the obvious gap: it is one of the three tools people most often want to know the context cost of, and it is named alongside the others across this org's tooling.

The seam for this is already clean. Parser is an ABC with two methods:

@classmethod
def sniff(cls, raw: str, path: Path | None = None) -> float: ...
def parse(self, raw: str, path: Path | None = None) -> Session: ...

detect_parser picks the highest sniff confidence, so a new parser is additive and cannot disturb the existing ones as long as its sniff is specific.

What is needed

  • A CursorParser mapping Cursor's session format onto Session
  • A sniff that is confident on Cursor transcripts and near zero on the other three formats, so detection stays unambiguous
  • A fixture session in the tests, redacted
  • A line in the README's supported-formats list

Good first issue: the interface is small, three existing parsers show the shape, and the tests make it obvious when detection starts overlapping.

If you use Cursor and can contribute a redacted session file, that alone is useful even without the parser: open a PR with just the fixture and say so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions