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-code-tracker

v1.2.4

Published

Automatic token, cost, and prompt tracking for Claude Code sessions

Readme

claude-code-tracker

Automatic token usage, cost estimation, and prompt quality tracking for Claude Code sessions.

After every session, it parses the transcript, updates a tokens.json ledger, regenerates a Chart.js dashboard (charts.html), and rebuilds the key-prompts index. Zero external dependencies — pure bash and Python stdlib.


What it tracks

  • Token usage per session: input, cache write, cache read, output
  • Estimated API cost (list-price equivalent — not a subscription charge)
  • Per-model breakdown: Opus vs Sonnet cost split
  • Key prompts: high-signal prompts you log manually, with category and context
  • Prompt efficiency: ratio of key prompts to total human messages

All data lives in <project>/.claude/tracking/ alongside your code.


Install

Option 1 — npm (global)

npm install -g claude-code-tracker

The postinstall script copies the tracking scripts to ~/.claude/tracking/ and registers the Stop hook in ~/.claude/settings.json.

Option 2 — Homebrew

Homebrew only knows about packages in its default registry. brew tap adds a third-party repository so Homebrew can find this package.

brew tap kelsi-andrewss/claude-code-tracker
brew install claude-code-tracker
claude-tracker-setup

The claude-tracker-setup command registers the Stop hook in ~/.claude/settings.json. This must be run separately because Homebrew's install sandbox blocks writes to user directories.

Option 3 — git clone

git clone https://github.com/kelsi-andrewss/claude-code-tracker.git
cd claude-code-tracker
./install.sh

Restart Claude Code after any install method.

Backfilling historical sessions

The installer automatically backfills all pre-existing sessions for the current project. If you run install.sh from inside a git repo, any transcripts that exist in ~/.claude/projects/ for that project will be parsed and added to tokens.json with their original dates. Re-running install won't create duplicates.

To backfill manually (e.g. for a different project):

python3 ~/.claude/tracking/backfill.py /path/to/your/project

What gets created

On first use in a project, the Stop hook auto-initializes <project>/.claude/tracking/:

.claude/tracking/
  tokens.json          # session data (auto-updated)
  charts.html          # Chart.js dashboard (auto-updated)
  key-prompts.md       # index of logged prompts
  key-prompts/         # one .md per day
    2026-02-18.md
  cost-analysis.md     # template for manual notes
  ai-dev-log.md        # template for dev log
  sessions.md          # session log template

View the dashboard

Open charts.html in a browser:

open .claude/tracking/charts.html       # macOS
xdg-open .claude/tracking/charts.html  # Linux

The dashboard shows cumulative cost, cost per day, sessions, output tokens, model breakdown, and prompt analytics — all updated automatically after each session.


Cost CLI

claude-tracker-cost
# or
python3 ~/.claude/tracking/cost-summary.py

Prints a cost summary table for the current project.


Logging key prompts

Add entries to <project>/.claude/tracking/key-prompts/YYYY-MM-DD.md (today's date). The index and charts update automatically on the next session end.

Entry format:

## 2026-02-18 — Short title

**Category**: breakthrough | bug-resolution | architecture | feature
**Context**: What problem was being solved?
**The Prompt**: (exact or close paraphrase)
**Why It Worked**: (what made the phrasing/framing effective)
**Prior Attempts That Failed**: (for bugs: what didn't work; otherwise: N/A)

Auto-logging with CLAUDE.md

Add the following to your project's CLAUDE.md to have Claude log prompts automatically:

## Tracking
After completing significant work (bug fix, feature, refactor, plan approval), append a prompt
assessment entry to `<project>/.claude/tracking/key-prompts/YYYY-MM-DD.md` (today's date).
Create the file if it doesn't exist, using the same header format as existing files.

Use this format:
  ## [date] — [short title]
  **Category**: breakthrough | bug-resolution | architecture | feature
  **Context**: What problem was being solved?
  **The Prompt**: (exact or close paraphrase)
  **Why It Worked**: (what made the phrasing/framing effective)
  **Prior Attempts That Failed**: (for bugs: what didn't work; otherwise: N/A)

Only write entries for genuinely high-signal prompts. Skip routine exchanges.
Do not ask permission — just append after significant work.

Uninstall

npm

npm uninstall -g claude-code-tracker
~/.claude/tracking/uninstall.sh

Homebrew

brew uninstall claude-code-tracker

Manual

./uninstall.sh

The uninstaller removes the scripts from ~/.claude/tracking/ and removes the Stop hook from ~/.claude/settings.json. Your project tracking data (tokens.json, charts.html, key-prompts/) is left intact.


Skills

install.sh copies bundled Claude Code skills into ~/.claude/skills/ automatically. Skills are slash commands available in any Claude Code session.

/view-tracking

Opens the tracking dashboard and today's key-prompts file for the current project.

/view-tracking
  • macOS: opens files with open
  • Linux / WSL: opens files with xdg-open (falls back to printing the path if unavailable)

Cost note

Figures shown are API list-price equivalents — what pay-as-you-go API customers would be charged at current Anthropic pricing. If you are on a Max subscription, these are not amounts billed to you.

Current rates used: | Model | Input | Cache write | Cache read | Output | |-------|-------|-------------|------------|--------| | Sonnet | $3/M | $3.75/M | $0.30/M | $15/M | | Opus | $15/M | $18.75/M | $1.50/M | $75/M |


License

MIT