session-metrics

session-metrics is a skill for Claude Code, Codex from centminmod/my-claude-code-setup. It costs 182 tokens per session (7,827 once invoked), scanned B, original, MIT.

A tool for calculating token usage and estimated costs from Claude Code session logs, which are raw records of conversations with the coding agent. It can summarize one session, compare sessions, or aggregate projects.

In plain words
What is it for?
Use it to inspect a session’s spending, compare two model runs, create an all-projects usage dashboard, or prepare and run a comparison test suite.
Why use it?
It turns hard-to-read JSONL conversation records into totals and timelines for usage, cost, cache hits, and input and output tokens.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/centminmod/my-claude-code-setup/session-metrics
Any agent
npx skills add centminmod/my-claude-code-setup --skill session-metrics
Clone the repo
git clone --depth 1 https://github.com/centminmod/my-claude-code-setup

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for session-metrics

README.md
[![agentmods](https://agentmods.dev/badge/skills/centminmod/my-claude-code-setup/session-metrics.svg)](https://agentmods.dev/skills/centminmod/my-claude-code-setup/session-metrics)
Your own site
<a href="https://agentmods.dev/skills/centminmod/my-claude-code-setup/session-metrics"><img src="https://agentmods.dev/badge/skills/centminmod/my-claude-code-setup/session-metrics.svg" alt="Measured on agentmods" height="20"></a>
Per session 182 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,827 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00182 $0.07827
Opus 5 $0.00091 $0.03914
Sonnet 5 $0.00036 $0.01565
Haiku 4.5 $0.00018 $0.00783

Measured 4d ago against content hash 554b182dd0b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

session-metrics scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 26 executable files (scripts/_analytics.py, scripts/_charts.py, scripts/_cli.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks the agent to reveal its instructionsmediumSystem prompt leakage

Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.

assistant text are truncated to ~240 characters with a **Show full prompt** / **Show full response** toggle that reveals the full text (up
.claude/skills/session-metrics/SKILL.md · 474 lines

How it starts

The opening of the file, as written. The whole thing — 474 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Session Metrics

Runs scripts/session-metrics.py against the Claude Code JSONL log to produce a timeline-ordered cost summary with per-turn and cumulative totals.

Dispatch — how to route this invocation

First positional argument received: $ARGUMENTS[0] Full argument string: $ARGUMENTS

Read $ARGUMENTS[0] above and match it by literal equality against the table below. Claude Code already tokenized the arguments shell-style, so no parsing is required — just compare strings.

$ARGUMENTS[0] Route Then read
all-projects Instance-wide dashboard aggregating every project under ~/.claude/projects ## Instance dashboard (all projects) below
compare Two-session compare on JSONLs that already exist ## Model comparison below, then references/model-compare.md before running
compare-run Fully automated capture: spawns two claude -p sessions, feeds the suite, then runs --compare ## Model comparison below, then references/model-compare.md "Workflow A — automated"
compare-prep Print manual capture protocol + 10-prompt suite (fallback when headless is unavailable) ## Model comparison below
count-tokens API-key-only tokenizer check ## Model comparison below
export Natural-language export shortcut — scan full arg string to determine session vs project scope ## Export shortcuts below
project All sessions for the current project — timeline + per-session subtotals + grand total ## Quick usage below (--project-cost); also scan remaining args for --output format flags
project-cost Alias for project ## Quick usage below (--project-cost); also scan remaining args for --output format flags
(empty, or any other value) Default single-session report ## Quick usage below

Read the full file on GitHub · 474 lines

Files

What ships with it

54 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 474 lines · 182 tokens per session scan B 554b182dd0b8

Subscribe to this mod's changes

session-metrics is a skill published in the GitHub repository centminmod/my-claude-code-setup (2,614 stars, last pushed 1mo ago), licensed MIT. It adds 182 tokens to every session and 7,827 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it B with 1 finding (asks the agent to reveal its instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

memory-bank

Token-efficient persistent memory system for Claude Code that saves 67% tokens on session warm-up (verified with tiktoken). Layered architecture with progressive loading, compact encoding, branch-aware context, smart compression, session diffing, conflict detection, session continuation protocol, and recovery mode.…

josiahcrackle9631/memory-bank · 199 tokens

building-chatgpt-apps

Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode…

mjunaidca/mjs-agent-skills · 87 tokens

memory-systems

Design and implement memory architectures for agent systems. Use when building agents that need to persist state across sessions, maintain entity consistency, or reason over structured knowledge.

mjunaidca/mjs-agent-skills · 35 tokens

multi-agent-patterns

Design multi-agent architectures for complex tasks. Use when single-agent context limits are exceeded, when tasks decompose naturally into subtasks, or when specializing agents improves quality.

mjunaidca/mjs-agent-skills · 38 tokens

scaffolding-openai-agents

Builds AI agents using OpenAI Agents SDK with async/await patterns and multi-agent orchestration. Use when creating tutoring agents, building agent handoffs, implementing tool-calling agents, or orchestrating multiple specialists. Covers Agent class, Runner patterns, function tools, guardrails, and streaming…

mjunaidca/mjs-agent-skills · 86 tokens

tool-design

Design tools that agents can use effectively. Use when creating new tools for agents, debugging tool-related failures, or optimizing existing tool sets.

mjunaidca/mjs-agent-skills · 30 tokens