- Home
- Skills
- Agents & Orchestration
- Agent Foreman Token Meter - Where Your Tokens Went
Works with the AI Agents you already use
Agent Foreman Token Meter - Where Your Tokens Went
- Counts each API call exactly once - transcripts write one line per content block, so naive counting roughly doubles the numbers; the meter de-duplicates by message id.
$5
Agent Foreman Token Meter - Where Your Tokens Went
Example session with this skill installed
Use foreman-token-meter and show me where my tokens went over the last 3 days.
- Read your context and instructions
- Compiled the agent foreman token
## Summary I ran `python token_meter.py 3` in this project folder. The last three days cost about **$3,200 in API-equivalent terms** across nearly **50,000 calls** - and only about $450 of it was your main sessions. **Subagents accounted for about $2,800.** ## Where it went | Share | API-equivalent spend | |---|---| | Main sessions | ~$450 | | Subagents (attributed to the session that spawned them) | ~$2,800 | | Total, 3 days | ~$3,200 | ## Cost by context size Main-session calls cost a few cents each under 200k context and noticeably more above it. **95% of main-session spend happened in sessions that grew past 200k context.** ## Costliest sessions The sessions table lists each session's day, id, call count, number of agents spawned, peak context and top tools. The expensive day was the one where **a single session spawned thirty agents and ran to 370k context**. ## ADVICE Hand off to a fresh session around **350k** context and stop starting new work around **400k**. Every call re-reads the whole context, so a session's cost grows with the square of its length. ## Next steps 1. Want the live budget hook? I can write `.claude/hooks/token_meter.py` and one `UserPromptSubmit` entry into `.claude/settings.local.json` - only after you say yes. 2. With the hook installed, when a session crosses the handoff threshold I get a one-line note, write a handoff note and tell you to continue in a new session - before the expensive part, not after. 3. Run with `--all` to compare every local project, or `--prices prices.json` to re-price history after a pricing change. _Figures are a list-price equivalent, not your real bill._
Connects securely to your tools. The creator never sees your data.
About this skill
Hit your usage limit by Wednesday and have no idea why? Foreman Token Meter reads the transcript files Claude Code already keeps on your machine and turns them into a clear spending report. - Finds the right project automatically from your current folder (or `--project`, or `--all`). - Counts each API call exactly once - transcripts write one line per content block, so naive counting roughly doubles the numbers; the meter de-duplicates by message id. - Includes **subagent** transcripts and charges them to the session that spawned them - often the largest and least visible share. - Breaks spend down by day, by model, by **context-size band**, and by session (with the top tools used). - Shows what share of spend happened in sessions that grew past 200k context, and prints an **ADVICE** line with the context size to hand off at. - Embedded list-price table, dated and clearly labelled for verification, overridable with a JSON file. - Optional `UserPromptSubmit` hook: the agent itself gets a one-line note when its context passes warn, handoff and stop thresholds. Standard library only, Python 3.8+, reads local files, sends nothing anywhere. ## Key capabilities - Automatic project detection from the working directory, or any project, or all projects - Per-call de-duplication by message id; skips locally synthesized error turns - Subagent transcripts counted and attributed to their parent session - Spend by day, model, context band and session, with top tools and agent counts - Hand-off recommendation based on your observed context sizes - Dated, overridable price table; unknown models flagged as UNPRICED - Optional live context-budget hook with automatic 200k / 1M window thresholds - Single file, no dependencies, no network, read-only ## Who it is for Heavy Claude Code users on usage-limited plans, teams running multi-agent workflows, and anyone who wants evidence before changing how long sessions run. ## Install / usage Ask your agent: "Use foreman-token-meter and show me where my tokens went this week." Or save the script and run: ``` python token_meter.py [DAYS] [--all] [--project PATH] [--prices prices.json] [--top N] ``` For the live hook, the agent writes `.claude/hooks/token_meter.py` and one `UserPromptSubmit` entry into `.claude/settings.local.json` - only after you agree. ## Limitations Figures are an API list-price equivalent, not your real bill. The Claude Code transcript format is not a public contract and may change. ## Changelog - 1.0.0 - First release: report mode, per-call de-duplication, subagent attribution, context bands, hand-off advice, price override, optional budget hook.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Figures are an API list-price equivalent (a proportion meter), not your real bill; subscription plans are billed differently. The embedded price table is dated 2026-09-23 - verify and override with --prices. The Claude Code transcript format is not a public contract and may change. Only reads transcripts on the current machine.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
- Software
Python 3.8+Claude Code