Skip to content

melloxyz/sessionlens

Repository files navigation


Sessionlens



Sessionlens

Local-first observability for AI Coding CLIs

Track costs, analyze sessions, and compare efficiency across 9 AI CLIs — fully offline, fully private.


CI i18n


Node pnpm TypeScript React Fastify


English · Português (BR)

Features · Quick Start · Stack · Integrations · Changelog · Contributing

See it in action

Sessionlens Dashboard

All the views

Sessions
Sessions
Analytics
Analytics
Budgets
Budgets
(Dashboard shown above)

Why Sessionlens

Most teams juggling multiple AI coding CLIs can't answer basic questions: which CLI is cheapest? which is most reliable? where is the money going? Sessionlens answers them by reading the on-disk artifacts each CLI already produces — no scraping, no proxies, no cloud. Your data never leaves your machine, every cost is tagged actual or estimated, and you can be productive in 60 seconds after pnpm install.


Features

Tracking

Feature Description
Multi-CLI 9 supported CLIs: Codex, Claude Code, OpenCode, Gemini CLI, Kimi, Aider, Qwen, Antigravity, and CommandCode
Cost tracking Real CLI cost, token-based estimation, and OpenRouter sync for up-to-date pricing. Confirmed vs. estimated spend shown separately
Smart sessions Tokens (input/output/cache/reasoning), tool calls, duration, project context, per-model usage breakdown
Auto-ingestion Filesystem watcher with debounce; incremental checkpoints skip unchanged files automatically

Analytics & Insights

Feature Description
Analytics Dashboard with contextual filters, spend trends, breakdowns by model/provider/project, and dedicated insight/anomaly pages
Data reliability Per-field quality, adapter drift counters, captured tools, touched files, and per-CLI coverage in Settings and Session Detail
Budgets Global, per-project, CLI, provider, or model limits with local alert history
Full-text search Search across session IDs, project paths, and full message content with result snippets
CSV export Export filtered sessions and analytics breakdowns to CSV directly from the UI
Project controls Hide/restore projects without deleting data; open folder; follow git timeline and related sessions
Premium UI Sessionlens design system — DataPanel, DataTable, FigurePanel, CompactStat, ControlField, skeleton states, and tooltips
Themes Dark and light mode with refined contrast, accessible chart palette, and localStorage persistence

Privacy & Control

Feature Description
Privacy & security Opt-in redaction of sensitive tool inputs; CORS restricted to localhost; no error details exposed to clients; git calls use execFileSync (no shell injection)
Local-first SQLite via sql.js WASM — zero data sent externally, zero telemetry, zero accounts
i18n English and Português (PT-BR) with localized dates, durations, currencies, and insight labels

What's New in v0.9.6

Full history in CHANGELOG.md.

  • Overview forecast: new dashboard tile projecting month-end spend via linear regression on the last 7 days
  • CLI comparison card: per-CLI cost/tool-call/token efficiency surfaced on the project detail page
  • Extended thinking metrics: dedicated analytics surface for reasoning/thinking token usage
  • Full-text search for messages: SQLite FTS5-backed search on the Sessions page with result snippets
  • README & CONTRIBUTING overhaul: restructured hero, 2-row shields.io badge block, grouped Features, new Contributing pointer
  • Removed tray feature: dropped the system tray and related Settings entries
  • CI order fix: test step now runs before coverage so failures stop the pipeline earlier

Quick Start

Prerequisites

Installation

git clone https://github.com/melloxyz/sessionlens.git
cd sessionlens
pnpm install
pnpm dev

Frontend: http://localhost:5173 — Backend API: http://127.0.0.1:3030

Commands

Command Description
pnpm dev Full stack (backend + frontend)
pnpm build Production build
pnpm typecheck Typecheck across all packages
pnpm lint Lint across all packages
pnpm -r test Run test suite
pnpm --filter @sessionlens/backend diagnose:adapters Local adapter diagnostic (capabilities, sources, quality)
pnpm --filter @sessionlens/backend backfill:quality Idempotent backfill of tools, files, and data quality

Tech Stack

Layer Technology Version
Runtime Node.js >= 20
Package manager pnpm >= 9
Language TypeScript 5.x
Backend Fastify 5.x
Database SQLite via sql.js WASM
Frontend React + Vite 18 / 6.x
Styling Tailwind CSS v4
Charts Recharts 2.x
Icons Lucide React latest
Pricing OpenRouter API sync

Architecture

Adapters write RawSession, the ingestion engine normalizes/dedups/costs, and the frontend queries through Fastify.

sessionlens/
├── assets/
│   ├── logo/              # Black and white logos (theme-aware)
│   └── screenshots/       # UI screenshots
├── packages/
│   ├── backend/           # Fastify + sql.js + adapters + costing
│   ├── frontend/          # React + Vite + Tailwind v4 + Recharts
│   └── shared/            # Shared TypeScript types
├── scripts/               # Dev orchestration (Windows-safe)
├── .github/workflows/     # CI + Release (git-cliff)
└── CHANGELOG.md

Backend

  • Fastify on 127.0.0.1:3030 with CORS restricted to the configured frontend URL
  • SQLite via sql.js WASM — in-memory, persisted via atomic write + rotated backups
  • Adapters (claude, codex, opencode, gemini, kimi, aider, qwen, commandcode, antigravity) each emit RawSession; the ingestion engine owns normalization, costing, dedup, and upsert
  • Costing engine: cost_source field with actual / estimated / unknown; OpenRouter pricing synced at startup
  • Incremental ingestion: file-level checkpoints skip unchanged sources; backfillEstimatedCosts scoped to touched sessions only
  • Privacy: opt-in redact flag strips sensitive input_json and message content before storage

Frontend

  • Vite dev server on port 5173 with /api proxy → backend
  • Components: DataPanel, DataTable, FigurePanel, FigureGrid, CompactStat, ControlField, MetricBlock, QueryBar, SectionHeader, AlertStrip, Skeleton
  • Themes: dark/light with CSS variables and refined contrast
  • Languages: EN / PT-BR via LanguageProvider with locale-aware formatting
  • Cache: TTL + size-limited response cache, invalidated after ingest

Shared

  • TypeScript types: Session, CliProvider, SourceConfidence, SessionFilters, PaginatedResponse, etc.
  • Shared between backend and frontend to keep the API contract consistent

Supported Integrations

CLI Status Data location Confidence
Codex CLI ✅ Supported ~/.codex/state_5.sqlite + rollout JSONL HIGH
Claude Code ✅ Supported ~/.claude/projects/**/*.jsonl MEDIUM
OpenCode ✅ Supported ~/.local/share/opencode/opencode.db HIGH
Gemini CLI ✅ Supported ~/.gemini/tmp/**/chats/*.jsonl HIGH
CommandCode ✅ Supported ~/.commandcode/projects/**/*.jsonl + .meta.json HIGH
Kimi CLI ⚠️ Experimental ~/.kimi/sessions/**/context.jsonl or KIMI_SHARE_DIR PARTIAL
Aider ⚠️ Experimental .aider.chat.history.md + .aider.llm.history PARTIAL
Qwen CLI ⚠️ Experimental ~/.qwen/sessions/**/*.json PARTIAL
Antigravity ⚠️ Experimental ~/.gemini/antigravity/ PARTIAL

Each adapter is isolated — a schema change in one CLI does not affect the others. Confidence reflects the quality and completeness of data exposed by each source. Where CLIs don't expose cost, tokens, or tools, Sessionlens preserves what's available and flags the gap.


Contributing

Contributions of any size are welcome — code, documentation, bug reports, new CLI adapters, and translations.


License

MIT


Made with


github.com/melloxyz/sessionlens · CHANGELOG · CONTRIBUTING · Português (BR)


Sessionlens — local-first observability for AI Coding CLIs.

About

Local-first observability for AI Coding CLIs, track costs, analyze sessions and compare efficiency across Claude Code, OpenCode, Codex, Gemini CLI and more. Zero telemetry, all offline.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Contributors

Languages