token-tracker
Skill2 starsChanged 4 months agoMITView on GitHub
Saves local token usage snapshots and reports token usage by feature with a daily heat map. Use when the user invokes /token-tracker, $token-tracker, /set-feature, or $set-feature; asks to save, record, dump, log, or track token usage/history; wants a usage breakdown or heat map; discusses token usage or cost; or wants to label the current project or feature.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- sunjingjun99/skill-token-trackertheir own version, first seen Jun 27, 2026
- thesaifalitai/claude-setuptheir own version, first seen Feb 27, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- thesaifalitai/claude-setup★ 9same name
- sunjingjun99/skill-token-tracker★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- token-trackerSkill
- token-trackerSkill
- token-trackerSkill
- token-trackerSkill
- token-trackerSkill
- token-trackerSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
When the user invokes /token-tracker or $token-tracker (with no other request), run the report and show the output:
- Distinctive: line 22
Default to not saving if they do not answer.
- Distinctive: line 24
If the invoke includes an explicit ask (e.g.
- Very specific: line 28
When the user invokes /set-feature or $set-feature (or asks to set/label the current feature):
- Very specific: line 31
If they said clear, none, or off, clear the feature.
- Distinctive: line 32
If no name was given, ask once.
- Distinctive: line 46
Do not run the full report unless they also ask for it.
- Distinctive: line 58
Default to not saving if the user does not answer.
- Very specific: line 80
If token counts are unavailable, save the summary with source: "manual" and omit the unknown fields.
- Very specific: line 83
If the user asks for project/feature history, run the report script or summarize ~/.token-tracker/history.jsonl.
- Very specific: line 107
Prefer node …/scripts/….js (or the installed token-tracker CLI on PATH) — do not run a bare token-tracker command unless ~/.local/bin is on …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Tracker
Works across Cursor, Claude Code, Gemini CLI, Codex, Continue, and other Agent Skills hosts. Shared history lives under ~/.token-tracker/.
Slash / skill invoke: token-tracker
When the user invokes /token-tracker or $token-tracker (with no other request), run the report and show the output:
node {{SKILL_BIN}}/report-token-usage.jsPresent the report as-is (feature breakdown + GitHub-style daily heat map). Then ask once:
Also save a usage snapshot for the current feature?
Default to not saving if they do not answer.
If the invoke includes an explicit ask (e.g. set feature, save, enable status line), do that instead of or in addition to the report.
Slash / skill invoke: set-feature
When the user invokes /set-feature or $set-feature (or asks to set/label the current feature):
- Resolve the feature name from text after the command.
- If they said
clear,none, oroff, clear the feature. - If no name was given, ask once. Suggest the current git branch as the default.
- If they said
- Run:
node {{SKILL_BIN}}/set-token-context.js --workspace "$PWD" --feature "<name>"Or to clear:
node {{SKILL_BIN}}/set-token-context.js --workspace "$PWD" --clear-feature- Show the JSON result. Mention that status-line
toksresets for this scope when the feature changes. - Do not run the full report unless they also ask for it.
On Cursor and Claude Code, install also writes a /set-feature slash command under ~/.cursor/commands/ or ~/.claude/commands/. Gemini gets ~/.gemini/commands/set-feature.toml.
When To Prompt (manual save)
Prompt the user before saving unless they explicitly asked to save.
Ask:
Save this token usage snapshot to local history?
Default to not saving if the user does not answer. Do not save secrets, raw prompts, or transcript contents.
Save Workflow
- Build a short snapshot:
project: workspace directory name or current project name.feature: configured feature name, current git branch, or omit if unknown.summary: one sentence describing the session or task.model: current model name if known.prompt_tokens,completion_tokens,total_tokens: include exact values only when available.metadata: optional small object for non-sensitive details.
- Run:
node {{SKILL_BIN}}/save-token-usage.js --json '<snapshot-json>'- Tell the user the snapshot was saved to
~/.token-tracker/history.jsonl.
Snapshot Rules
- Save summaries, not conversation content.
- If token counts are unavailable, save the summary with
source: "manual"and omit the unknown fields. - Status line tokens are feature-scoped: switching project/feature resets the token counter for that scope.
- Status line snapshots use
source: "statusline"and store the current feature token total (not full session total). - If the user asks for project/feature history, run the report script or summarize
~/.token-tracker/history.jsonl. For a feature total, prefer the report (epoch-aware) over naively summing rows.
Project And Feature Names
Project names resolve in this order:
TOKEN_TRACKER_PROJECTenvironment variable.- Exact workspace path in
~/.token-tracker/config.jsonunderprojects. default_projectin~/.token-tracker/config.json.- Current workspace folder name.
Feature names resolve in this order:
TOKEN_TRACKER_FEATUREenvironment variable.- Exact workspace path in
~/.token-tracker/config.jsonunderfeatures. default_featurein~/.token-tracker/config.json.- Current git branch (
git branch --show-current), or the host's worktree/branch name when available.
Set feature:
node {{SKILL_BIN}}/set-token-context.js --workspace "$PWD" --feature "maintenance"Prefer node …/scripts/….js (or the installed token-tracker CLI on PATH) — do not run a bare token-tracker command unless ~/.local/bin is on PATH after install.
Status Line (Cursor CLI)
node {{SKILL_BIN}}/statusline-token-usage.jsFields are controlled by ~/.token-tracker/config.json under statusline.
Cursor CLI can wire this via cli-config.json statusLine. Other hosts can still call the same script when they expose a status hook.
Estimated cost uses ~/.token-tracker/prices.json (USD per 1M input/output tokens, matched by model name substring). Feature cost in the report is epoch-aware: it prices token deltas between snapshots and resets when totals drop.
Refresh rates with:
npx @mbrundige/token-tracker prices pullBy default, prices refresh automatically: install starts a background pull, the report refreshes seed/stale rates before printing, and the status line schedules a background pull when prices.json is older than 1 hour (config.prices.auto_pull). Snapshot rows lock cost_delta_usd at save time so historical report totals do not drift when rates change.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

