token-tracker

token-tracker is a skill for Claude Code, Codex from automateyournetwork/netclaw. It costs 22 tokens per session (2,227 once invoked), scanned A, original, Apache-2.0.

A session budget tracker that counts tokens, estimates API cost, limits tool-call chains, and reports spending for each NetClaw interaction. Tokens are the text units used to measure model usage.

In plain words
What is it for?
Use it to enforce spending ceilings, stop runaway tool chains, calculate model-aware costs, and reduce the size of tabular network data sent in responses.
Why use it?
It prevents long automated conversations from consuming more tokens or money than intended and makes the remaining budget visible.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: positional $N argument; built for openclaw.

Good fit Use it to enforce spending ceilings, stop runaway tool chains, calculate model-aware…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/automateyournetwork/netclaw/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.

Any agent
npx skills add automateyournetwork/netclaw --skill token-tracker
Clone the repo
git clone --depth 1 https://github.com/automateyournetwork/netclaw

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/automateyournetwork/netclaw/token-tracker.svg)](https://agentmods.dev/skills/automateyournetwork/netclaw/token-tracker)
Your own site
<a href="https://agentmods.dev/skills/automateyournetwork/netclaw/token-tracker"><img src="https://agentmods.dev/badge/skills/automateyournetwork/netclaw/token-tracker.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,227 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.00022 $0.02227
Opus 5 $0.00011 $0.01113
Sonnet 5 $0.00004 $0.00445
Haiku 4.5 $0.00002 $0.00223

Measured 3d ago against content hash 432279ce7a63, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 3d 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.

workspace/skills/token-tracker/SKILL.md · 222 lines

How it starts

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

Skill: Token Tracker + Budget Enforcement

Purpose

Track and display token consumption and cost for every NetClaw interaction. Enforce per-session spending caps and tool-call depth limits to prevent runaway API costs. Serialize MCP server responses in GCF format to reduce token usage by 40-60% on tabular network data.

What This Prevents

Without this skill, a single casual phone question can trigger unbounded agentic tool chains that silently burn $10+ in API costs. This skill ensures:

  • Sessions halt at a configurable cost ceiling (default: $5)
  • Tool-call chains pause after N calls per question (default: 20)
  • The operator sees what was accomplished and can choose to continue
  • Budget status is visible in every response footer

Tools Used

This skill uses the netclaw_tokens shared library (src/netclaw_tokens/):

Module Function Purpose
counter.py count_tokens() Count tokens via Anthropic API (fallback: len/4 estimate)
counter.py count_message_tokens() Count tokens for full message arrays
cost_calculator.py calculate_cost() Calculate USD cost with model-aware pricing
cost_calculator.py get_pricing() Look up model pricing (with env var override)
budget_policy.py BudgetPolicy Per-session budget configuration
budget_policy.py resolve_session_config() Load policy from config + interface detection
session_ledger.py SessionLedger Cumulative tracking + enforcement
footer.py format_footer() Format mandatory token/cost footer
gcf_serializer.py serialize_response() Serialize data to GCF with JSON fallback
gcf_wrapper.py wrap_json_response() Convert JSON responses to GCF

Workflow Steps

On session start

  1. Resolve budget policy: Call resolve_session_config(config, session_key) to get the BudgetPolicy for this session — accounts for interface type (mobile/desktop/discord), per-agent overrides, and environment variable overrides.
  2. Initialize ledger: Create SessionLedger(budget=policy) — enforcement is now active.

Read the full file on GitHub · 222 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. 3d ago First seen · 222 lines · 22 tokens per session scan A 432279ce7a63

Subscribe to this mod's changes

token-tracker is a skill published in the GitHub repository automateyournetwork/netclaw (650 stars, last pushed yesterday), licensed Apache-2.0. It adds 22 tokens to every session and 2,227 once invoked, about $0.0001 per session on Opus 5. 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-09-03.

Related

Other skills, from other repositories