explaingit

codestrain/codestrain-cli

15PythonAudience · developerComplexity · 1/5LicenseSetup · easy

TLDR

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.

Mindmap

mindmap
  root((codestrain-cli))
    What it does
      Reads Claude Code logs
      Tracks session time
      Estimates API costs
    Key Feature
      Developer Recovery Score
      Traffic-light readiness
      Strain from late nights
    Tech stack
      Python stdlib only
      No external deps
      Python 3.9+
    Install options
      Homebrew
      pipx
      uv
    Audience
      Claude Code users
      Solo developers
      Productivity trackers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Check how many hours and dollars you spent coding with Claude Code across all your projects this month.

USE CASE 2

Get a green/yellow/red burnout readiness score before starting a high-stakes coding session.

USE CASE 3

Break down your AI API costs by project to see which codebases are consuming the most tokens.

Tech stack

Python

Getting it running

Difficulty · easy Time to first run · 5min

Requires Claude Code to have been used previously so session log files exist on disk.

MIT license, use freely for any purpose, including commercial, as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
I just installed codestrain-cli. Walk me through the commands to see my total Claude Code usage and estimated cost for the past week.
Prompt 2
Explain what the Developer Recovery Score (DRS) measures and how I can use it to decide whether to take a break from coding.
Prompt 3
How does codestrain-cli calculate strain from session logs? Show me the logic behind the gap-between-turns heuristic.
Prompt 4
I use codestrain-cli and my DRS is red. What does that mean and what should I do?
Open on GitHub → Explain another repo

← codestrain on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.