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

agent-session-core

v0.1.1

Published

Unified parser for ~/.codex and ~/.claude coding-session logs. One parse, many projections (token events, metrics, transcript).

Readme

agent-session-core

Unified parser for local AI-coding session logs (~/.codex and ~/.claude). One parse, many projections — so token boards, retrospectives, and transcript viewers stop each re-implementing (and drifting on) the same JSONL parsing.

Why this exists, the field-level ground truth, and the migration plan live in DESIGN.md. Zero runtime dependencies; ships JS + .d.ts.

Quick look

node bin/agent-sessions.mjs recent --days 2     # recent sessions w/ tokens + cost
node bin/agent-sessions.mjs totals --days 7     # aggregate usage
node scripts/parity-codex.mjs --days 30         # verify token math vs the naive method
node --test                                     # unit tests

API

import { loadSessions, parseSessionFile, toTokenEvents, sessionTokenTotals } from "agent-session-core";

const sessions = loadSessions({ sinceMs: 7 * 864e5 });        // NormalizedSession[]
for (const s of sessions) {
  const events = toTokenEvents(s, { userId: "me" });          // open-token-board's TokenUsageEvent[]
  const totals = sessionTokenTotals(s);                       // { totalTokens, costUsd, ... }
}

NormalizedSession

A session is { engine, id, cwd, model, startedAt, endedAt, title, events[] }. events is one ordered timeline of a discriminated union: message | tool_call | tool_result | token_usage | compaction | web_search | reasoning.

Token usage is normalized to the same meaning across engines (input is the full input incl. cache; cached is the discounted-read subset; total = input + output). Codex cumulative snapshots are turned into reset-aware per-turn deltas, so context compaction no longer silently drops a turn's tokens.

Status

  • Increment 1 — discovery + codex/claude parse + token-events projection. Verified: 508/508 parity on no-reset Codex sessions; reset-aware deltas recover tokens the naive method under-counts (up to 5.5× on compaction sessions).
  • Increment 2metrics projection (agent-retro's contract). Verified against agent-retro's own parser+analyzer on 200 real sessions: turns / toolCount / toolFails / cacheRate / failRate / durationMs / score / grade all match. Fixes at the source: codex webSearches (was always 0 → 265 recovered), duration inflation (raw end-start over-reports session time 17.5× → activeDurationMs), codex model (was always empty).

Note: agent-retro — the original retrospective consumer that motivated the metrics projection — was removed on 2026-06-28. The metrics projection remains as a tested, consumer-less capability (still useful for an efficiency view on token-board, or a future tool). Next consumer to wire: token-board, then the snapshot projection for codex-snapshots. See DESIGN.md §5.