gitmyhub

codestrain-cli

Python ★ 16 updated 5d ago

Your AI coding recovery score, from the terminal. Parses Claude Code JSONL sessions → cost, tokens, DRS estimate, per-project breakdown. Zero deps, Python 3.9+.

A terminal tool that parses Claude Code session logs to show your coding time, token costs, and a burnout risk score called the Developer Recovery Score.

Pythonsetup: easycomplexity 1/5

CodeStrain CLI is a terminal tool that reads the session log files Claude Code stores on your computer and reports how much you have been coding, what it cost, and a rough estimate of how rested or strained you are. It works entirely offline, requires no account, and sends nothing to any server.

When you run Claude Code (an AI coding assistant), it writes detailed logs of every session to a folder on your local disk. CodeStrain parses those log files to calculate your total session count, time spent, number of conversation turns, token usage, estimated API cost broken down by project, and which AI models were used. You can view just today's numbers or aggregate everything across all time.

The main distinctive feature is the Developer Recovery Score, abbreviated DRS. It estimates how much cognitive strain your recent coding sessions have created and how much you have recovered. Strain is calculated by looking at the gaps between turns in a session: gaps of five minutes or less count as active coding, and each hour of that adds to the strain score. Late-night sessions and weekend work apply a small additional penalty. Recovery is estimated from how long it has been since your last session, used as a rough proxy for sleep. The result is a traffic-light readiness label: green, yellow, or red. The README is explicit that this is a behavioral heuristic from log data, not medical advice.

CodeStrain has no external dependencies beyond Python's standard library, which means it installs quickly and works on Python 3.9 and later. You can install it through Homebrew, pipx, or uv. The CLI is MIT-licensed and free to use without any hosted service.

A fuller version of the DRS model, incorporating wearable data from Apple Health, WHOOP, or Oura, is described as a separate paid product on the codestrain.dev website. The CLI does not require or connect to that service.

Where it fits