Repository navigation
claude-roi: cost per merged PR for your Claude Code sessions, looking for people to run it against their own repo #2118
rohittrimale
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi — I built a small local CLI and I'm looking for people to run it against their own repo, because the only thing I can prove right now is that it works on my fixture.
The problem.
ccusagetells you what you spent on Claude Code. Anthropic's usage dashboard tells your team what it spent. Neither tells you what you got. You end up with a monthly bill on one side and a list of merged PRs on the other, and no way to join them.What I built.
claude-roi— MIT, zero dependencies, one file, Node 18+. It reads Claude Code's own session transcripts (~/.claude/projects/**/*.jsonl), prices every token at Anthropic's published API rates, and joins the sessions to your git history. It reports:What it does not do. It is not a token counter —
ccusageis better at that and I would not use it instead of it. It does not call the Anthropic API, sends nothing over the network, and never touches your code. The dollars are API-equivalent value (what your usage would have cost at API rates), which on a flat Pro/Max plan is not your bill — it is the only figure that lets you compare two months, two models or two workflows. If you are on pay-as-you-go keys it is close to your real bill.There is already a tool in this space, and this is deliberately narrower. After writing this up I went looking, and found
codelens-ai(npm, previously published asclaude-roi) — it correlates agent token usage with git output for Claude Code, Codex and Copilot, and it has a dashboard, an MCP server, a statusline and per-commit cost. It is more featureful than what I built, and if you want a dashboard you should use theirs.Three things are different here, and they are the reasons I kept going:
git branch --mergedcannot see squash merges at all, which makes that spend look like it never shipped in most tools;git log --left-right --cherry-markis what actually resolves it.jq.The number I have is from a fixture, not from real usage. This machine does not keep Claude Code CLI transcripts in the standard place, so the output below comes from the repo's own synthetic test repo — one merge-commit PR, one squash-merged PR, one branch that never shipped, one stale session:
The ask. If you have a repo with a few weeks of Claude Code history in it, please run it and reply with the one-line summary (
node claude-roi.js --share) plus anything it got wrong. I am looking for roughly 30 people to run it before I decide whether to build this properly or throw it away, so:--sharelineTwo things I had to get right that are easy to get wrong, in case they are useful to someone else: you cannot count lines in a JSONL transcript (one assistant response is written as several lines sharing a single
message.id, plus sidechain replays), andgit branch --mergedlies about squash merges —git log --left-right --cherry-mark base...branchis the fix, because the=marker means the patch is equivalent on both sides.All reactions