Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (agents-lens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Lens
Lens is a local-first CLI for understanding how you work with coding agents. The first version reads Cursor agent transcripts from your own machine, computes local metrics, optionally adds an AI-written profile with your own API key, and writes private Markdown plus HTML reports.
It is inspired by tools that analyze AI coding sessions, but it is designed as an open-source project with local ownership and explicit privacy boundaries.
Current Status
Implemented:
- Cursor transcript discovery from
~/.cursor/projects/*/agent-transcripts - Parent-session parsing for JSONL transcripts
- Optional subagent inclusion
- Workspace summaries
- Local metrics
- Best-effort redaction for displayed excerpts
- Local Markdown and static HTML report generation
- Optional AI-written profile with user-supplied OpenAI or Anthropic API keys
- Interactive first-run wizard
- Sensitive-topic exclusion before safe examples and AI payloads
Not implemented yet:
- Claude Code and Codex CLI transcript adapters
Privacy Model
By default, the tool does not call any AI API and does not upload anything.
It reads local transcript files and writes reports to reports/. Generated reports are gitignored by default.
AI profiles are opt-in with npm run lens -- ai <workspace>. If no key is configured, the CLI can ask for either an OpenAI or Anthropic API key and use it for that run only. Before sending anything, the CLI shows a plain review of what will be sent: destination, model, workspace, selected safe examples, masked secrets, private messages skipped, and estimated size. It will not send the request unless you pass --yes.
When an AI profile is enabled, the provider receives local metrics plus selected safe examples. Raw transcript files are not sent wholesale.
Before examples are shown or sent to AI, the tool excludes messages matching sensitive-topic policy categories such as secrets, trading/finance, personal identity, admissions/applications, medical/legal, auth credentials, and private credential files. Aggregate local counts may still reflect overall activity, but sensitive text is not used for safe examples or AI payloads.
Redaction is best-effort. Do not treat it as a formal security boundary.
Use With npx
The npm package is prepared as agents-lens:
npx agents-lens
npx agents-lens eXperiments
npx agents-lens ai eXperiments --yesAfter a global install, both agents-lens and the shorter lens binary are available:
npm install -g agents-lens
lens eXperimentsLocal Setup
npm install
npm run buildFor AI profiles, copy the env example and add your own key:
cp .env.example .envThen set one or both keys in .env:
OPENAI_API_KEY=...
ANTHROPIC_API_KEY=...You can also skip .env and paste either key when the CLI asks for it.
Easiest Start
For local development, run the guided flow:
npm run lensThe wizard will:
- Find Cursor transcript workspaces.
- Ask which workspace to analyze, or all workspaces.
- Generate a local report by default.
- Ask before adding an AI-written profile.
- Generate Markdown and static HTML reports.
- Open the HTML report in your browser.
Generate a local report for one workspace:
npm run lens -- eXperimentsSame command, with the explicit word report if you prefer:
npm run lens -- report eXperimentsGenerate an AI-written profile:
npm run lens -- ai eXperiments --yesLens still shows what will be sent before the AI call:
- Raw transcript files are never sent wholesale.
- Only local metrics and selected safe example prompts are used.
- Secrets are masked inside examples.
- Private messages are skipped from examples and AI payloads.
Analyze all workspaces locally:
npm run lens -- allGenerate local reports for all workspaces with the explicit word report:
npm run lens -- report allClean generated reports:
npm run lens -- cleanActually delete generated reports:
npm run lens -- clean --yesAdvanced Commands
Scan available Cursor transcript workspaces:
npm run scanInspect one workspace:
npm run inspect -- --workspace eXperimentsGenerate local Markdown and HTML reports:
npm run analyze -- --workspace eXperimentsGenerate and open the HTML report:
npm run analyze -- --workspace eXperiments --openGenerate an AI profile with OpenAI using the advanced command:
npm run analyze -- --workspace eXperiments --llm --provider openai --yesGenerate an AI profile with Anthropic:
npm run analyze -- --workspace eXperiments --llm --provider anthropic --yesOverride the model:
npm run analyze -- --workspace eXperiments --llm --provider anthropic --model claude-3-5-sonnet-latest --yesInclude subagent sessions:
npm run scan -- --include-subagentsUse a custom Cursor projects directory:
npm run scan -- --cursor-projects-dir /path/to/cursor/projectsHow Transcript Discovery Works
Cursor stores agent transcripts outside the repo, under local Cursor project folders. This tool scans:
~/.cursor/projects/*/agent-transcripts/**/*.jsonlBy default, it skips subagents/ so the first report reflects user-facing conversations. Pass --include-subagents to include those sessions.
Cursor workspaces may not map one-to-one with a repo subfolder. If Cursor was opened at a parent directory, the transcript workspace will be that parent directory.
Development
npm run check
npm run build