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

@j___avi/tokentrace

v0.5.0

Published

Token tracing and session recording for coding agents.

Readme

Install

npm install -g @j___avi/tokentrace
tt install

That's it. Restart your shell once after install. Every session is now recorded automatically.

✓ Claude Code hook installed → ~/.claude/settings.json
✓ Codex CLI shim installed  → ~/.zshrc
✓ Codex Desktop watcher installed → ~/Library/LaunchAgents/io.tokentrace.codex-watcher.plist

What gets recorded automatically

| Surface | Status | |---|---| | Claude Code CLI | ✅ Automatic | | Claude Code Desktop | ✅ Automatic — same hook file | | Claude Code VS Code extension | ✅ Automatic — same hook file | | Codex CLI | ✅ Automatic — transparent shell shim after tt install | | Codex Desktop app | ✅ Automatic — background watcher every 30 s (macOS) | | VS Code / IDE plugins | 🔜 Planned |

See your sessions

tt summarize
2026-05-25   ok   tokens=223K   cost=$1.43    changed=7    claude-sonnet-4-6   Refactor auth middleware to use JWT
2026-05-24   ok   tokens=104K   cost=$0.71    changed=4    claude-sonnet-4-6   Add dark mode to settings page
2026-05-24   ok   tokens=44K    cost=$0.23    changed=2    gpt-5.5             Fix race condition in queue processor
2026-05-23   ok   tokens=84K    cost=$0.43    changed=17   gpt-5.5   DESKTOP   Write unit tests for billing module
2026-05-22   ok   tokens=531K   cost=$11.24   changed=12   claude-opus-4-7     Migrate Postgres schema to multi-tenancy

Open the dashboard

tt serve        # start server + open browser
tt stop         # stop the server

Browse sessions, compare cost over time, inspect transcripts and diffs, set a VAT rate. The dashboard shows each session's surface — CLI, Desktop app, or IDE extension.

What's inside each recorded session

~/.tokentrace/runs/<session-id>/
  run.json        # agent, model, tokens, cost, git state, duration
  transcript.txt  # full conversation — user prompts and agent replies
  diff.patch      # every file the agent touched, as a unified patch
  summary.md      # human-readable one-page summary
  report.html     # standalone HTML report, openable offline

Example tt summarize output for a single session:

2026-05-25T09:12Z   ok   tokens=223K   cost=$1.43   changed=7   claude

Why it exists

Agent sessions disappear into terminal scrollback. You either trust the result or you don't, with nothing in between. tokentrace gives you the evidence:

  • Cost visibility — token spend per session, cost per day, running total
  • Trust — full transcript + git diff attached to every session
  • Debugging — when an agent does something unexpected, the log tells you exactly what happened
  • PR evidence — attach summary.md or diff.patch to pull requests so reviewers see what the agent actually did

MCP server — query your sessions from inside Claude Code

tokentrace ships an MCP server that gives Claude Code direct access to your local session data. Once configured, you can ask questions about your sessions in plain English — mid-conversation, no dashboard needed.

Setup: add this to ~/.claude/mcp.json (create the file if it doesn't exist):

{
  "mcpServers": {
    "tokentrace": {
      "command": "npx",
      "args": ["-y", "-p", "@j___avi/tokentrace", "tokentrace-mcp"]
    }
  }
}

Restart Claude Code, then ask inside any session:

"how much have I spent on tokens this week?" "what did I change in my last session?" "show me the diff from yesterday"

Claude will query your ~/.tokentrace/runs/ folder directly — nothing leaves your machine. Works in Claude Code CLI, Desktop app, and VS Code extension.

Honest limitations

tokentrace reads what's available from each surface. Some data isn't logged by the agents themselves:

| Surface | Token count | Cost | Transcript | |---|---|---|---| | Claude Code CLI / Desktop / VS Code | ✅ input + output | ✅ exact | ✅ full | | Codex CLI (via shim) | ✅ input + output | ✅ exact | ✅ full | | Codex Desktop | ✅ input + output (per-turn) | ✅ exact | ✅ full |

Development

git clone https://github.com/12122J/tokentrace
cd tokentrace
npm install
npm test         # 48 tests

# Run with demo data
node scripts/gen-demo-data.mjs
TOKENTRACE_RUNS_DIR=~/.tokentrace-demo/runs tt serve

Contributing

Contributions are welcome. See CONTRIBUTING.md. Keep new features grounded in portable, local-first traces.

License

MIT — 12122J