arkheiaai

Agent Token Audit — Security skill for Claude Code

Security community

Zero-dependency read-only script to audit Claude Code & Codex token burn, latency, and context bloat.

How to install Agent Token Audit

This entry records only its repository, not the path inside it, so there is no exact command to give. Open arkheiaai/agent-token-audit and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agent Token Audit does

Zero-dependency read-only script to audit Claude Code & Codex token burn, latency, and context bloat.

Alternatives in Security

  • SEO Audit Skill — English · 中文 可复用的单页面 SEO 审计 Agent Skill 235 ★
  • Loongsuite Pilot — Local-first telemetry collector for AI coding agents — unified OpenTelemetry events for Claude Code, Codex, Cu 150 ★
  • Senior Engineering Partner — A stack-agnostic Claude Code skill: strict code reviewer, pair programmer, debugger, and mentor (Python/Bash/A 148 ★

README

agent-token-audit

A tiny, zero-dependency, read-only Python script to audit where your **Claude Code** and **Codex** weekly token quotas are actually going.

Why I built this

I run 20x subscriptions on both Claude Code and Codex (plus local open-weight models) and started hitting my weekly cap in **about a single day**. Before blaming silent rate-limit nerfs, I audited my local `~/.claude` and `~/.codex` session logs over a 7-day window.

I guessed I was burning 2–3 billion tokens/week. The actual number on one laptop alone was **12.7 billion tokens in 7 days**:

  • Codex: 8.97B tokens across 46,377 turns (193k avg tokens/turn)
  • Claude Code: 3.73B tokens across 13,813 turns (270k avg tokens/turn)

Almost none of it was "thinking harder." It was **four silent context multipliers** I had accidentally built into my own workflow:

  1. Immortal multi-week threads: One Codex session had been alive for 28 days (1.34 GB JSONL log, still burning 379M tokens/day). Two Claude threads had been alive 2+ weeks (288 MB and 205 MB) averaging 270k tokens/turn.
  2. A 5.13 MB shared task board markdown file (~1.28M tokens, including a single 1.17 MB line!) that my startup instructions told every new session to read.
  3. A 391 KB / 5,023-line engineering contract (DONE.md) (~98k tokens) read whole before builds, plus 3.0 MB of append-only memory.md files across scheduled automations.
  4. Raw tool dumps & repeated screenshots: Hundreds of >10 KB Read and shell outputs (250 MB+ in 48h) and 1 MB+ PNGs read repeatedly inside long-lived threads, then re-billed on every subsequent turn.

Even with >97% prompt-cache hit rates, carrying 200k–270k tokens per turn across thousands of tool calls hits you three ways at once:

  • Quota burn: evaporates a weekly 20x allowance in a day.
  • Speed: slows every tool turn down (and causes brutal prefill stalls whenever a >5 min pause evicts the KV cache).
  • Signal quality: stale logs, repe