npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-work-timer

v0.1.0

Published

Track actual working hours from Claude Code session logs with idle detection

Readme

claude-work-timer (ctt)

Track actual working hours from Claude Code session logs — not just tokens or costs, but real time spent coding.

The Problem

Claude Code tracks tokens and costs, but not your time. Session spans don't reflect actual work — you step away for lunch, get distracted, or context-switch between projects. A 4-hour session span might only contain 45 minutes of real work.

The Solution

ctt analyzes Claude Code's local session logs, detects idle gaps, and calculates net active working time per session, project, and day.

Claude Code Working Hours — 2026-02-24

  Project              │ Sessions │ Active  │ Span    │ Idle
  ─────────────────────┼──────────┼─────────┼─────────┼───────
  gmat-simulator-1     │        3 │  2h 15m │  3h 42m │ 1h 27m
  GMAT-skills          │        1 │    45m  │  1h 10m │   25m
  ─────────────────────┼──────────┼─────────┼─────────┼───────
  Total                │        4 │  3h 00m │  4h 52m │ 1h 52m

  (idle threshold: 5 min)

Install

npm install -g claude-work-timer

Or run directly without installing:

npx claude-work-timer daily

For local development:

git clone https://github.com/danyuchn/claude-work-timer.git
cd claude-work-timer
npm install
npm run build
npm link        # Makes "ctt" available globally from this local copy

Usage

ctt                                # Quick overview: today + this week
ctt daily                          # Today's working hours by project
ctt daily --since 2026-02-01       # Date range
ctt weekly                         # This week, day by day
ctt project                        # All projects, all time
ctt project my-project             # Single project breakdown
ctt session                        # Recent sessions list
ctt session abc12345               # Single session detail

# Options
--json                             # JSON output (pipe-friendly)
--idle-threshold <min>             # Override idle threshold (default: 5)
--since <YYYY-MM-DD>               # Filter start date
--until <YYYY-MM-DD>               # Filter end date

# Config
ctt config set idle-threshold 10   # Change default idle threshold
ctt config get                     # Show all config

How It Works

Data Source

ctt reads Claude Code's local session logs at ~/.claude/projects/. Each session is a JSONL file with timestamped messages. No data leaves your machine.

Idle Detection Algorithm

  1. Parse all user and assistant messages from a session
  2. Deduplicate streaming assistant updates (keep last per parentUuid)
  3. Sort events chronologically
  4. Walk adjacent pairs — if the gap exceeds the idle threshold (default: 5 min), split into a new work segment
  5. Add a tail buffer (default: 30s) after the last event in each segment
  6. Sum segment durations = active working time
Timeline:  |---work---|  (8 min idle)  |---work---|  (2 min gap)  |---work---|
Segments:  [segment 1 ]                [      segment 2          + tail     ]

Key Metrics

| Metric | Description | |--------|-------------| | Active | Net working time (sum of work segments) | | Span | Wall-clock time from first to last event | | Idle | Span minus Active (time you were away) |

Configuration

Config file: ~/.claude-time-tracker/config.json

| Key | Default | Description | |-----|---------|-------------| | idle-threshold | 5 | Minutes of inactivity before a gap is considered idle | | tail-buffer | 30 | Seconds added after the last event in each segment | | claude-dir | ~/.claude | Path to Claude Code data directory |

vs Other Tools

| Tool | Tracks | Idle Detection | |------|--------|----------------| | ccusage | Tokens, costs, models | No | | ccstat | Session timeline visualization | No | | WakaTime | General coding time | Yes (different scope) | | ctt | Net working hours per project | Yes (core feature) |

Development

git clone https://github.com/danyuchn/claude-work-timer.git
cd claude-work-timer
npm install
npm run build
npm test

# Test locally
node bin/ctt.js daily

License

MIT