token-tracker

token-tracker is a command for Claude Code from JoasASantos/ClaudeAdvancedPlugins. It costs 0 tokens per session (1,570 once invoked), scanned A, original, MIT.

A usage-reporting guide that estimates how many tokens an agent interaction uses. Tokens are the small pieces of text that language models process.

In plain words
What is it for?
Use it to track input, output, tool-result, and conversation-context usage, then summarize estimated consumption and pricing.
Why use it?
It helps users understand where usage comes from, keep a running total, and estimate costs.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions subagents; positional $N argument.

Good fit Use it to track input, output, tool-result, and conversation-context usage, then summarize estimated consumption and pricing.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/joasasantos/claudeadvancedplugins/token-tracker
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.

Clone the repo
git clone --depth 1 https://github.com/JoasASantos/ClaudeAdvancedPlugins

Made for: Claude Code.

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 token-tracker

README.md
[![agentmods](https://agentmods.dev/badge/commands/joasasantos/claudeadvancedplugins/token-tracker/github.svg)](https://agentmods.dev/commands/joasasantos/claudeadvancedplugins/token-tracker)
Your own site
<a href="https://agentmods.dev/commands/joasasantos/claudeadvancedplugins/token-tracker"><img src="https://agentmods.dev/badge/commands/joasasantos/claudeadvancedplugins/token-tracker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for token-tracker

Your own site · 80×15
<a href="https://agentmods.dev/commands/joasasantos/claudeadvancedplugins/token-tracker"><img src="https://agentmods.dev/badge/commands/joasasantos/claudeadvancedplugins/token-tracker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,570 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01570
Opus 5.5 $0.00000 $0.00628
Sonnet 5.5 $0.00000 $0.00314
Haiku 4.5 $0.00000 $0.00157

Measured 3mo ago against content hash 4468dee2238a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

token-tracker scanned grade A with 0 findings 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 3mo ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/token-tracker/commands/token-tracker.md · 180 lines

How it starts

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

Token Tracker Plugin

You are a token usage tracking and reporting system. Your purpose is to monitor, estimate, and display token consumption at the end of each task, agent interaction, or prompt response — helping the user understand their usage and optimize costs.

Core Purpose

Track and report token usage by:

  1. Estimating input/output tokens for every interaction
  2. Maintaining a running total across the session
  3. Displaying a clear summary after each task completes
  4. Providing cost estimates based on current model pricing

Token Estimation Method

How to Count Tokens

Use these reliable approximations:

  • English text: ~1 token per 4 characters, or ~1.3 tokens per word
  • Code: ~1 token per 3.5 characters (code has more symbols)
  • Structured data (JSON/YAML): ~1 token per 3 characters
  • System prompts: Count once per conversation turn they appear in

What to Track Per Interaction

Input Tokens:
  - System prompt tokens (if first turn or refreshed)
  - User message tokens
  - Tool results tokens (file reads, search results, command output)
  - Context from previous turns

Output Tokens:
  - Assistant response text tokens
  - Tool call arguments tokens
  - Reasoning/thinking tokens (if applicable)

Session Tracking Structure

Maintain a mental ledger for the session:

Session Token Ledger
├── Turn 1: { input: N, output: N, cumulative: N }
├── Turn 2: { input: N, output: N, cumulative: N }
├── ...
├── Task 1 Total: { input: N, output: N, total: N }
├── Task 2 Total: { input: N, output: N, total: N }
└── Session Total: { input: N, output: N, grand_total: N }

Model Pricing Reference (2025-2026)

Claude Models

Model Input (per 1M tokens) Output (per 1M tokens)
Claude Opus 4 $15.00 $75.00
Claude Sonnet 4 $3.00 $15.00
Claude Haiku 3.5 $0.80 $4.00

Cost Calculation

Cost = (input_tokens × input_price / 1,000,000) + (output_tokens × output_price / 1,000,000)

Read the full file on GitHub · 180 lines

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. 3mo ago First seen · 180 lines · 0 tokens per session scan A 4468dee2238a

Subscribe to this mod's changes

token-tracker is a command published in the GitHub repository JoasASantos/ClaudeAdvancedPlugins (162 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,570 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

token-tracker compared with commands from other repositories

token-tracker next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
token-trackerJoasASantos/ClaudeAdvancedPluginsCommand1629mo agoMITA0Claude Code
checklistgithub/spec-kitCommand153ktodayMITA13Claude Code
clarifygithub/spec-kitCommand153ktodayMITA27Claude Code
specifygithub/spec-kitCommand153ktodayMITA13Claude Code
analyzegithub/spec-kitCommand153ktodayMITA26Claude Code
convergegithub/spec-kitCommand153ktodayMITA35Claude Code
implementgithub/spec-kitCommand153ktodayMITA14Claude Code