Codelens-AI
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Fail
- os.homedir — User home directory access in src/cache.js
- execSync — Synchronous shell command execution in src/git-analyzer.js
- os.homedir — User home directory access in src/index.js
Permissions Pass
- Permissions — No dangerous permissions requested
This tool correlates local Claude Code session data with git commit history to measure the ROI and productivity of your AI coding agent, displaying the results on a local web dashboard.
Security Assessment
The overall risk is Medium. The application accesses the user's home directory (`~/.claude/projects/`) to read local session files, which is explicitly stated in its documentation. However, the automated scan flagged the use of synchronous shell command execution (`execSync`) within the codebase. While running git commands locally is expected for this type of analysis, the implementation relies on potentially unsafe execution methods. No dangerous permissions are requested, and no hardcoded secrets were detected. Users should be aware that all data analysis happens locally and no network requests are made to external servers.
Quality Assessment
The project is very new and has low community visibility, currently sitting at only 6 GitHub stars. However, it is actively maintained, with repository updates pushed as recently as today. It uses the standard and permissive MIT license. The documentation is clear, well-structured, and accurately explains the prerequisites and installation steps.
Verdict
Use with caution: the tool is actively maintained and locally contained, but its low community trust, newness, and reliance on synchronous shell execution warrant a careful review before running it on your machine.
Agent Productivity-to-Cost Correlatorcodelens-ai
Codelens AI
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
Previously published as
claude-roi. That package is deprecated — usenpx codelens-aigoing forward. Theclaude-roicommand still works as a backward-compatible alias.
Option 1: Run directly (no install)
npx codelens-ai
Option 2: Install globally
# npm
npm install -g codelens-ai
# pnpm
pnpm add -g codelens-ai
# yarn
yarn global add codelens-ai
Then run anywhere:
codelens-ai
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 >= 18 — Download
- Git — installed and configured with
user.nameanduser.email - Claude Code — you must have used Claude Code at least once so session data exists at
~/.claude/projects/
Quick Start
npx codelens-ai
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
codelens-ai # default: last 30 days, port 3457
codelens-ai --days 90 # look back 90 days
codelens-ai --port 8080 # custom port
codelens-ai --no-open # don't auto-open browser
codelens-ai --json # dump all metrics as JSON to stdout
codelens-ai --project techops # filter to a specific project
codelens-ai --refresh # force full re-parse (ignore cache)
codelens-ai --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
- Parses JSONL session files from
~/.claude/projects/ - Analyzes git history from each repo you've worked in with Claude
- Correlates sessions to commits by timestamp (during session + 30min buffer)
- Calculates cost using Anthropic token pricing (input, output, cache read/write)
- Serves an interactive dashboard on localhost
Caching
Parsed session data is cached at ~/.cache/agent-analytics/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 codelens-ai 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
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found