Agentic coding metric monitor — multi-agent, TUI, CLI
Project description
Agentic Metric
A local-only monitoring tool for AI coding agents. Track token usage and costs across Claude Code, Codex, Cursor, OpenCode, VS Code (Copilot Chat), and more — with a TUI dashboard and CLI.
All data stays on your machine. No network requests, no telemetry, no data leaves your computer. The tool only reads local agent data files (e.g. ~/.claude/) and process info.
Features
- Live monitoring — Detect running agent processes, incremental JSONL session parsing
- Cost estimation — Per-model pricing table, calculates API-equivalent costs
- Today overview — Sessions, token usage, and cost summary for the current day
- Historical trends — 30-day daily token/cost trends
- TUI dashboard — Terminal UI with 1-second live refresh, stacked token charts, and trend lines
- Multi-agent — Plugin architecture, supports Claude Code and Cursor, extensible
Data Sources
| Agent | Path | Data |
|---|---|---|
| Claude Code | ~/.claude/projects/ |
JSONL sessions, token usage, model, branch |
| Claude Code | ~/.claude/stats-cache.json |
Daily activity stats |
| Cursor | ~/.config/Cursor/User/globalStorage/state.vscdb |
Composer sessions, token usage, model |
| Cursor | Process detection | Running status, working directory |
| Codex | ~/.codex/sessions/ |
JSONL sessions, token usage, model |
| VS Code | ~/.config/Code/User/workspaceStorage/*/chatSessions/ |
Chat sessions (JSON + JSONL), token usage (JSONL only), model |
| VS Code | ~/.config/Code/User/globalStorage/emptyWindowChatSessions/ |
Empty-window chat sessions |
| VS Code | Process detection | Running status, working directory |
| OpenCode | ~/.local/share/opencode/opencode.db |
SQLite sessions, messages, token usage, model |
| OpenCode | Process detection | Running status, active session matching |
All aggregated data is stored locally in ~/.local/share/agentic_metric/data.db (SQLite).
Installation
pip install agentic-metric
Usage
agentic-metric status # Show currently active agents
agentic-metric today # Today's usage overview
agentic-metric history # Historical trends (default 30 days)
agentic-metric history -d 7 # Last 7 days
agentic-metric sync # Force sync data to local database
agentic-metric tui # Launch TUI dashboard
agentic-metric bar # One-line summary for status bars
Status Bar Integration
agentic-metric bar outputs a compact one-line summary (e.g. AM: $1.23 | 4.5M) for embedding into status bars like i3blocks, waybar, tmux, vim statusline, etc.
i3blocks / waybar:
[agentic-metric]
command=agentic-metric bar
interval=60
tmux:
set -g status-right '#(agentic-metric bar | head -1)'
set -g status-interval 60 # refresh every 60 seconds (default 15)
vim / neovim statusline:
set statusline+=%{system('agentic-metric\ bar\ \|\ head\ -1')}
" statusline refreshes on cursor move, mode change, etc.
" to force a periodic refresh, add a timer:
autocmd CursorHold * redrawstatus
set updatetime=60000 " trigger CursorHold after 60s idle
TUI Keybindings
| Key | Action |
|---|---|
q |
Quit |
r |
Refresh data |
Tab |
Switch Dashboard / History tab |
Agent Data Coverage
Different agents expose different levels of local data. Here's what's available for each:
| Field | Claude Code | Codex | Cursor | VS Code (Copilot) | OpenCode |
|---|---|---|---|---|---|
| Session ID | ✓ JSONL | ✓ JSONL | ✓ composerId | ✓ sessionId | ✓ session table |
| Project path | ✓ JSONL | ✓ JSONL | ◐ partial (from bubble or conversationState) | ✓ workspace.json URI | ✓ session.directory (launch cwd) |
| Git branch | ✓ JSONL | ✓ JSONL | ✗ not stored | ✗ not stored | ✗ not stored |
| Model | ✓ JSONL | ✓ JSONL | ✓ modelConfig / bubble modelInfo | ✓ result.details (e.g. "Claude Haiku 4.5 • 1x") | ✓ message.modelID |
| Input tokens | ✓ per-message | ✓ cumulative | ◐ older versions only | ◐ JSONL format only | ✓ per-message |
| Output tokens | ✓ per-message | ✓ cumulative | ◐ older versions only | ◐ JSONL format only | ✓ per-message (includes reasoning) |
| Cache tokens | ✓ read + write | ✓ read only | ✗ not exposed | ✗ not exposed | ◐ read only (write always 0) |
| User turns | ✓ | ✓ | ✓ | ✓ | ✓ |
| Message count | ✓ user + assistant (excl. tool_result) | ✓ user + assistant | ✓ conversation headers | ✓ turns × 2 | ✓ user + assistant |
| First/last prompt | ✓ | ✓ | ✓ from bubble text | ✓ message.text | ✓ from part table |
| Cost estimation | ✓ | ✓ | ◐ only when tokens available | ◐ only when tokens available | ◐ estimated only (reported cost always 0) |
| Live active status | ✓ PID + session file match | ✓ PID + session file match | ◐ process-level only (latest session marked active) | ◐ process-level only | ✓ PID + DB session match |
Key differences:
- Claude Code & Codex — Each running process maps to a JSONL session file with a unique session ID. This allows precise matching between live processes and DB sessions for accurate active status.
- Cursor — Live detection only sees the process PID, while historical sessions use composer UUIDs from
state.vscdb. There is no way to link a running Cursor process to a specific composer session, so the most recent session is marked active when the process is running. - Token coverage — Cursor stored per-bubble
tokenCount(input/output) instate.vscdbin earlier versions (~2025-05 to ~2025-12), but newer versions no longer populate this field — all values are zero. Cursor appears to have moved usage tracking to a server-side system, so local token data is unavailable for recent sessions. Cache token breakdown (read/write) has never been available. - Model name — Cursor's "default" model setting doesn't record which model was actually used on the backend. These sessions show
defaultin the model column. - VS Code (Copilot Chat) — Has two storage formats: legacy JSON (older sessions, no token data) and newer incremental JSONL (with
result.usagecontainingpromptTokens/completionTokens). Token usage is only available for sessions stored in JSONL format. Model names are extracted from Copilot's display strings (e.g. "GPT-4o • 1x") and normalized to pricing keys. Workspace paths support local (file://), SSH remote (vscode-remote://ssh-remote+host), and container (attached-container+...) URIs. - OpenCode — Stores all data in a local SQLite database (
opencode.db). Token data is per-message withinput,output,reasoning, andcache.read/cache.writefields. Reasoning tokens are counted as output tokens (billed at output rate). Thecostfield in messages is always 0, so all costs are estimated using the pricing table.cache.writeis also always 0.
Privacy
- Fully offline — no network requests, no data sent anywhere
- Read-only — never modifies agent config or data files
- All stats stored in a local SQLite database
- Delete
~/.local/share/agentic_metric/at any time to remove all data
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentic_metric-0.1.1.tar.gz.
File metadata
- Download URL: agentic_metric-0.1.1.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcd55280810119a387c0af3a5d93b14c2a0540f4a1a5e0f9e0fc7e0065e5fb5c
|
|
| MD5 |
d74b6d4f72f53d4f65cc12f0edc90852
|
|
| BLAKE2b-256 |
4a075466d5dffbe19d04ec1f92533b2860c47260b932e855e5b8b567d88e4487
|
File details
Details for the file agentic_metric-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentic_metric-0.1.1-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f519906e014f0943e3f7be36f31022cc08af934c927b7c9286ba1021d9f0ef
|
|
| MD5 |
84db163f2c77a2556554fb69423ff88a
|
|
| BLAKE2b-256 |
14d4e1e53770145b5ebe41e0dc3e3f9a1baa78a7e7437b97ff0a5cab3053a7d5
|