New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@jawcode-dev/stats

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jawcode-dev/stats

Local observability dashboard for pi AI usage statistics

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@jawcode-dev/stats

Local observability dashboard for AI usage statistics.

Features

  • Session log parsing: Reads JSONL session logs from ~/.jwc/agent/sessions/
  • SQLite aggregation: Efficient stats storage and querying using bun:sqlite
  • Web dashboard: Real-time metrics visualization with Chart.js
  • Incremental sync: Only processes new/modified log entries

Metrics Tracked

MetricCalculation
Tokens/soutput_tokens / (duration / 1000)
Cache Ratecache_read / (input + cache_read) * 100
Error Ratecount(stopReason=error) / total_calls * 100
Total CostSum of usage.cost.total
Avg LatencyMean of duration
TTFTMean of ttft (time to first token)

Usage

Via CLI

# Start dashboard server (default: http://localhost:3847)
gjc stats

# Custom port
gjc stats --port 8080

# Print summary to console
gjc stats --summary

# Output as JSON (for scripting)
gjc stats --json

Programmatic

import { getDashboardStats, syncAllSessions } from "@jawcode-dev/stats";

// Sync session logs to database
const { processed, files } = await syncAllSessions();

// Get aggregated stats
const stats = await getDashboardStats();
console.log(stats.overall.totalCost);
console.log(stats.byModel[0].avgTokensPerSecond);

API Endpoints

EndpointDescription
GET /api/statsOverall stats with all breakdowns
GET /api/stats/modelsPer-model statistics
GET /api/stats/foldersPer-folder/project statistics
GET /api/stats/timeseriesHourly time series data
GET /api/syncTrigger sync and return counts

Data Storage

  • Session logs: ~/.jwc/agent/sessions/ (JSONL files)
  • Stats database: ~/.jwc/stats.db (SQLite)

Dashboard

The web dashboard provides:

  • Overall metrics cards (requests, cost, cache rate, error rate, duration, tokens/s)
  • Time series chart showing requests and errors over time
  • Per-model breakdown table
  • Per-folder breakdown table
  • Auto-refresh every 30 seconds

License

MIT

Keywords

ai

FAQs

Package last updated on 29 Jun 2026

Related posts