NPM · OPEN SOURCE · MIT

codesession-cli

Know exactly how long your sessions take, which files you touched, and what your AI calls cost.

Automatic. Local. No config.

~/projects/my-app — zsh
·cs start·cs log-ai·cs end·cs status·cs dashboard·cs stats·cs list·cs show·cs note·cs export·cs pricing·cs start·cs log-ai·cs end·cs status·cs dashboard·cs stats·cs list·cs show·cs note·cs export·cs pricing

WHAT IT TRACKS

FOUR
THINGS.

01

Time

Named sessions with start/stop timestamps. Duration, concurrent sessions, stale session recovery.

02

Files

Chokidar filesystem watcher. Detects add, change, unlink. Deduped within 1-second windows. Scoped to git root.

03

Commits

Git polling every 10 seconds. Backfills on session end via git log and git diff. Hash, message, author captured.

04

AI Cost

Log per-call with provider, model, and token counts. 17+ models built-in. Custom pricing support. Hard budget caps.

CS DASHBOARD

SEE THE
FULL PICTURE

One command launches a local analytics server. Real-time KPIs, 30-day projections, per-model breakdowns, and activity heatmaps.

Daily cost area charts
Per-model and per-provider analytics
Budget alert system with browser notifications
Binds to 127.0.0.1 by default — stays private
$ cs dashboard
cs dashboard
localhost:3737
codesession-cli dashboard — Overview

AGENT READY

BUILT FOR
AGENTS TOO

Full programmatic TypeScript API. Wrap your agent loop. Set hard budget caps. Ships as an OpenClaw skill on ClawHub.

BudgetExceededErrorhard caps via thrown exception
session.canAfford(n)check before expensive calls
--json flagmachine-readable, never prompts
clawhub install codesessionone-line OpenClaw setup
agent.ts
import { AgentSession, BudgetExceededError }
  from 'codesession-cli/agents'

const session = new AgentSession(
'Refactor auth',
{ budget: 5.00, git: true }
)

session.start()

// mid-session affordability check
if (!session.canAfford(2.00)) {
// switch to cheaper model
}

const summary = session.end()
// → { duration, cost, files, commits }
$0.00
tracked in a single month
example session data
17+
AI models with built-in pricing
Anthropic, OpenAI, Google…
100%
local — no cloud, no telemetry
SQLite at ~/.codesession/
v2.0
web dashboard release
charts, heatmaps, alerts

INSTALL.
TRACK.
KNOW.

Works in any git repo. No config file required.

codesession-cli — Free CLI to Track Coding Sessions and AI Costs

codesession-cli (also written as codesession cli or code session cli) is an open-source Node.js command-line tool published on npm. It tracks developer coding sessions including session duration, file changes, git commits, and AI API costs. Supported AI providers include Anthropic (Claude), OpenAI (GPT-4o, GPT-4), Google (Gemini), Azure OpenAI, and Cohere — with built-in pricing for 17+ models.

Install with: npm install -g codesession-cli. Use cs start to begin a session, cs log-ai to record AI usage costs, cs end to finish and summarize, and cs dashboard to open the real-time web analytics UI at localhost:3737.

All data is stored locally in a SQLite database at ~/.codesession/sessions.db. No cloud sync, no telemetry. codesession-cli also ships with a full programmatic TypeScript API for AI agent workflows, budget enforcement via BudgetExceededError, and an OpenClaw skill available on ClawHub.

Keywords

codesession-cli, codesession cli, coding session tracker, code session tracker, AI cost tracking CLI, AI API cost tracker, track AI costs developer, claude cost tracker, openai cost tracker cli, anthropic cost tracker, gpt4 cost tracking, llm cost tracker, developer session tracker, coding time tracker, terminal session tracker, npm session tracker, git commit session tracker, file change tracker cli, developer productivity cli, ai agent session manager, openclaw codesession, free developer time tracker cli, open source coding session tracker