npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-sessions

v0.1.0

Published

Read Claude Code session data (sessions, projects, tasks, teams, costs) without running lm-assist

Readme

claude-sessions

Read Claude Code session data (sessions, projects, tasks, teams, costs) without running lm-assist.

Install

npm install claude-sessions

Quick Start

import {
  createSessionReader,
  createSessionParser,
  createSessionCache,
  createProjectsService,
  createTasksService,
  createAgentTeamsService,
  createCostCalculator,
} from 'claude-sessions';

// List all projects and sessions
const reader = createSessionReader();
const projects = reader.listProjects();
const sessions = reader.listSessions('/path/to/project');

// Parse a session with full detail
const parser = createSessionParser();
const session = await parser.parseSession('session-uuid', '/path/to/project');
console.log(session.userPrompts);
console.log(session.toolUses);
console.log(session.totalCostUsd);

// Get conversation in simplified format
const convo = await parser.getConversation({
  sessionId: 'session-uuid',
  toolDetail: 'summary',
  includeThinking: true,
});

// LMDB-backed cache for fast repeated reads
const cache = createSessionCache();
const data = await cache.getSessionData('/path/to/session.jsonl');
const allSessions = cache.getAllSessionsFromCache();
cache.close();

// Projects with git info and cost
const projService = createProjectsService({ sessionCache: cache });
const projs = projService.listProjects();

// Tasks
const tasks = createTasksService();
const lists = await tasks.listTaskLists();
const taskList = await tasks.getTaskList('list-id');

// Teams
const teams = createAgentTeamsService();
const teamList = teams.listTeams();

// Cost calculation
const calc = createCostCalculator();
const cost = calc.calculateCost(
  { inputTokens: 100000, outputTokens: 5000, cacheCreationInputTokens: 50000, cacheReadInputTokens: 200000 },
  'claude-sonnet-4'
);
console.log(calc.formatCost(cost.totalCost));

API Overview

SessionReader

Low-level JSONL file discovery and reading from ~/.claude/projects/.

  • listProjects() — List all projects
  • listSessions(cwd?) — List sessions for a project
  • listSessionsWithDetails(cwd?) — Sessions with model/cost/status
  • readSessionLines(sessionId, cwd?) — Raw JSONL lines
  • listSubagentFiles(sessionId?, cwd?) — Subagent file metadata

SessionParser

Parse JSONL sessions into structured data. No server dependencies.

  • parseSession(sessionId, cwd?) — Full session parse
  • getConversation(options) — Simplified conversation format

SessionCache

LMDB-backed cache for fast repeated reads with incremental parsing.

  • getSessionData(filePath) — Cached session data (async)
  • getSessionDataSync(filePath) — Synchronous variant
  • getRawMessages(filePath) — Raw parsed messages
  • getAllSessionsFromCache() — All cached sessions
  • getProjectSessionsFromCache(projectPath) — Project sessions from cache
  • getPerProjectCosts() — Per-project cost totals
  • startWatching() — File watcher (requires chokidar)
  • close() — Shut down LMDB

ProjectsService

Project discovery with git info and cost metadata.

  • listProjects(options?) — All projects with metadata
  • listProjectSessions(projectPath, options?) — Sessions with enriched data
  • getGitInfo(projectPath) — Git branch, remotes, commit

TasksService

Read Claude Code task files from ~/.claude/tasks/.

  • listTaskLists() — All task lists
  • getTaskList(listId) — Tasks in a list
  • getReadyTasks(listId) — Unblocked tasks
  • getAllTasksFlat() — All tasks across all lists

AgentTeamsService

Read team configs from ~/.claude/teams/.

  • listTeams() — All teams
  • getTeam(teamName) — Team config

CostCalculator

Token cost calculation with tiered pricing.

  • calculateCost(usage, model?) — Calculate cost from token usage
  • getPricing(model) — Get pricing for a model
  • formatCost(cost) — Format as $X.XX

Path Utilities

  • legacyEncodeProjectPath(path) — Dash-encoded path
  • encodePath(path) / decodePath(encoded) — Base64 path encoding
  • getProjectsDir()~/.claude/projects/
  • extractProjectPath(storagePath) — Extract project path from storage path

Optional Dependencies

  • chokidar — File watching for live cache updates. Install with npm install chokidar if you need SessionCache.startWatching().

License

MIT