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-roi

v0.8.2

Published

Correlate Claude Code token usage with git output to measure AI coding agent ROI

Readme

Codelens AI

codelensai-dev.vercel.app

Agent Productivity-to-Cost Correlator — Is your AI coding agent actually shipping code?

Codelens AI ties Claude Code token usage to actual git output. It reads your local Claude Code session files, correlates them with git commits by timestamp, and serves a dashboard answering: "Am I getting ROI from my AI coding agent?"

  • One command, zero config
  • All data stays local
  • Works with any git repo where you've used Claude Code

Installation

Option 1: Run directly (no install)

npx claude-roi

Option 2: Install globally

# npm
npm install -g claude-roi

# pnpm
pnpm add -g claude-roi

# yarn
yarn global add claude-roi

Then run anywhere:

claude-roi

Option 3: Clone and run from source

git clone https://github.com/Akshat2634/Codelens-AI.git
cd Codelens-AI

# Install dependencies (pick one)
npm install
# or
pnpm install
# or
yarn install

# Run it
node src/index.js

Prerequisites

  • Node.js >= 18Download
  • Git — installed and configured with user.name and user.email
  • Claude Code — you must have used Claude Code at least once so session data exists at ~/.claude/projects/

Quick Start

npx claude-roi

This parses your ~/.claude/projects/ session data, analyzes your git repos, and opens a dashboard at http://localhost:3457.

What It Measures

| Metric | Description | | --------------------- | --------------------------------------------------------------- | | Cost per Commit | How much each AI-assisted commit costs in tokens | | Line Survival Rate| % of AI-written lines that survive 24h without being rewritten | | Orphaned Sessions | Sessions with 10+ messages that produced zero commits | | ROI Grade (A-F) | Composite score based on tokens-per-commit and survival rate | | Model Comparison | Efficiency breakdown across Opus, Sonnet, and Haiku | | Branch Awareness | What % of AI commits landed on production | | Peak Hours | Hour-of-day x day-of-week productivity heatmap | | Autonomy Score | Composite A-F grade measuring how independently the agent works | | Autopilot Ratio | Assistant messages per user prompt (higher = more autonomous) | | Self-Heal Score | % of bash calls that are test/lint commands (self-verification) | | Toolbelt Coverage | % of available tools used per session (workflow breadth) | | Commit Velocity | Tool calls per commit (lower = more efficient) |

CLI Options

claude-roi                        # default: last 30 days, port 3457
claude-roi --days 90              # look back 90 days
claude-roi --port 8080            # custom port
claude-roi --no-open              # don't auto-open browser
claude-roi --json                 # dump all metrics as JSON to stdout
claude-roi --project techops      # filter to a specific project
claude-roi --refresh              # force full re-parse (ignore cache)
claude-roi --autonomy             # print autonomy score to terminal and exit

Dashboard

The dashboard includes:

  • Hero stats — total cost, commits shipped, cost per commit, ROI grade
  • Smart insights — auto-generated observations about your usage patterns
  • Cost vs Output timeline — dual-axis chart of daily cost and lines added
  • Model comparison — cost breakdown by Claude model
  • Session length analysis — which session sizes have the best ROI
  • Productivity heatmap — GitHub-style grid showing when you're most productive
  • Agent Autonomy — autonomy score badge, autopilot ratio, self-heal score, toolbelt coverage, commit velocity, and top verification commands
  • Sessions table — sortable, expandable table with per-session metrics, matched commits, and autopilot ratio

How It Works

  1. Parses JSONL session files from ~/.claude/projects/
  2. Analyzes git history from each repo you've worked in with Claude
  3. Correlates sessions to commits by timestamp (during session + 30min buffer)
  4. Calculates cost using Anthropic token pricing (input, output, cache read/write)
  5. Serves an interactive dashboard on localhost

Caching

Parsed session data is cached at ~/.cache/claude-roi/parsed-sessions.json. On subsequent runs, only new or modified JSONL files are re-parsed, making startup near-instant. Use --refresh to force a full re-parse.

Cost Calculation

Token costs are version-aware and calculated per model (see Anthropic pricing):

| Model | Input | Output | Cache Read | Cache Write | | --- | --- | --- | --- | --- | | Opus 4.6 | $5/M | $25/M | $0.50/M | $6.25/M | | Opus 4.5 | $5/M | $25/M | $0.50/M | $6.25/M | | Opus 4.0/4.1 (legacy) | $15/M | $75/M | $1.50/M | $18.75/M | | Sonnet 3.7/4.0/4.5/4.6 | $3/M | $15/M | $0.30/M | $3.75/M | | Haiku 4.5 | $1/M | $5/M | $0.10/M | $1.25/M | | Haiku 3.5 | $0.80/M | $4/M | $0.08/M | $1.00/M | | Haiku 3 | $0.25/M | $1.25/M | $0.03/M | $0.30/M |

Line Survival

Line survival uses an approximate heuristic: if lines added in commit A are deleted by a subsequent commit on the same file within 24 hours, they're counted as "churned." This is not git-blame-based tracking and survival rates are rounded to the nearest 5%.

Project Structure

Codelens-AI/
├── package.json
├── README.md
├── .gitignore
└── src/
    ├── index.js          # CLI entry point
    ├── claude-parser.js  # Parse Claude Code JSONL session files
    ├── cache.js          # Parsed data caching layer
    ├── git-analyzer.js   # Parse git log with branch awareness
    ├── correlator.js     # Match sessions to commits by timestamp
    ├── metrics.js        # Calculate ROI metrics and insights
    ├── server.js         # Express server + API routes
    └── dashboard.html    # Single-file dashboard (inline CSS/JS)

Releasing

Releases are automated via GitHub Actions. To publish a new version:

npm version patch   # or minor / major
git push --follow-tags

This automatically publishes to npm and creates a GitHub Release with auto-generated notes.

Setup (one-time): Configure trusted publishing on npm for the claude-roi package, linking it to the GitHub Actions workflow. No tokens or secrets needed.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for development setup, guidelines, and ideas for contributions.

Privacy

All data stays on your machine. The only network requests are for Chart.js and Inter font from CDNs. No telemetry, no data collection.

License

MIT