About this project
cc-grass is a small Node.js command-line tool that turns local Claude Code activity into a GitHub-style contribution graph rendered as a standalone SVG, with the cells coloured orange instead of green. It reads the session transcripts stored under ~/.claude/projects as JSONL files and, when ~/.codex exists, session rollouts from ~/.codex/sessions produced by the OpenAI Codex CLI.
The README states the motivation plainly: Claude Code already draws a usage graph inside the terminal under /usage Stats, but that view stays local. cc-grass re-renders the same underlying data as a file you can commit and embed in a GitHub profile README, a portfolio page or anywhere else.
Implementation and design notes taken from the README:
- Zero runtime dependencies: only Node's fs, path and os modules. No ccusage, no API calls. Node 18 or newer, on macOS, Linux and Windows.
- An incremental cache means repeat runs re-parse only new or changed session files. It can be disabled with --no-cache, and the cache directory defaults to ~/.cache/cc-grass.
- The SVG mirrors GitHub's layout: 10 by 10 cells, 3px gaps, rounded corners, Mon/Wed/Fri row labels, monthly headers and a Less/More legend.
- Output is a single SVG, or a minimal HTML page via the --html flag. The project deliberately ships no daemon, scheduler or bundled GitHub Actions workflow; scheduling is left to the user, and the README shows a crontab example that regenerates the file and commits only when it actually changed.
Options include choosing the metric (prompts, sessions or tokens, default tokens), a date range through --since and --until, a dark or light theme, an overriding header string, alternative Claude and Codex data directories, excluding Codex data, excluding subagent transcripts, and overriding the cache location.
Token accounting: daily token counts sum input, output, cache creation and cache read tokens per entry, i.e. everything the API would bill for. Subagent files are included by default; excluding them matches the figure Claude Code shows in /usage. Codex sessions are counted from cumulative total_token_usage values in token_count events using deltas, so duplicated events are not double counted. The HTML output also shows an estimated API cost per model based on published per-million-token rates stored per price period; models without a known rate display a not-available price marker, and the README notes that subscription users do not actually pay these amounts.
Two caveats are documented honestly. First, per-cell hover tooltips use SVG title elements; they work in standalone SVG viewers and in the HTML output, but not when the SVG is embedded in a GitHub README, because GitHub serves it as an image and browsers ignore titles there. Second, the sample SVG and the linked interactive page show the author's real activity, so the README advises being intentional about where you publish your own graph.
A programmatic API is exposed as well: parseClaudeProjects and renderSvg can be imported to build the same chart in your own code. The project is MIT licensed.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.