Skip to content
Back to skills

Ak Token Audit

ASecurity

Report where Claude Code tokens and usage are going from the local session transcripts, by day, model, project, tool, MCP server and subagent, with cache efficiency and a runaway-daemon cross-reference. Use when the maintainer says "where are my tokens going", "usage breakdown", "burning through my plan", or "hitting limits".

  • 58 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 4, 2026
ai-agentspythongobash

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 4, 2026

npx -y skills add pacphi/agentic-kit --skill ak-token-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ak Token Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ak Token Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pacphi-ak-token-audit/badge)](https://www.skillsdirectory.com/skills/pacphi-ak-token-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ak-token-audit
description: Report where Claude Code tokens and usage are going from the local session transcripts, by day, model, project, tool, MCP server and subagent, with cache efficiency and a runaway-daemon cross-reference. Use when the maintainer says "where are my tokens going", "usage breakdown", "burning through my plan", or "hitting limits".
---

# Token audit

A standalone, offline picture of Claude Code usage, built from the local session transcripts in
`~/.claude/projects/**/*.jsonl` (each assistant message records its tokens, tool calls and model).
It is the maintainer's second opinion beside `ak usage` and the dashboard's Usage view, and it
answers two questions: where is the usage going, and is any of it runaway automation.

## When to use

The maintainer asks where tokens or usage are going, why usage is so high, what a week of Claude
Code activity looked like, or says the plan is being burned or limits are being hit.

## Steps

1. From the repository root, run the engine (stdlib-only Python 3; if `python3` is missing, say
   so and stop):

   ```bash
   python3 .claude/skills/ak-token-audit/scripts/ruflo-token-audit.py --days 7
   ```

   Use the window the maintainer gives ("past month" is `--days 30`). `--top N` widens each
   section, `--json` prints machine-readable output and `--no-daemons` skips the process list.
2. Read the whole report, then lead with the headline. Synthesize; do not echo the sections:

   | Section | Read it for |
   | ------- | ----------- |
   | BY MODEL | The model mix; a model name alone does not show whether work is interactive or automated |
   | SESSIONS PER DAY | Volume and bursts to investigate; counts alone do not prove automation |
   | ACTIVITY BY HOUR | Timing patterns to line up with the maintainer's own activity and with processes |
   | TOOL USAGE | What the work is (Bash, Read and Edit against Task and MCP calls) |
   | MCP USAGE | Calls per MCP server; the cost of loaded tool definitions depends on the host |
   | SUBAGENT FAN-OUT | Task spawns and the sidechain share: how much is delegated |
   | BUSIEST SESSIONS | A single runaway conversation shows up here by its token total |
   | CACHE EFFICIENCY | A high cache-read share is normal and cheap; flag it only with huge automated volume |
   | STARTUP CONTEXT TAX | The fixed per-session cost (`CLAUDE.md`, tool and skill manifests) times the session count |
   | RUNNING DAEMONS | Live `ruflo daemon start` processes mapped to the top-burn projects |

3. Check the daemon cross-reference, the most common automation leak. A daemon process alone does
   not prove model spend: Ruflo's daemon runs local-only workers by default, and AI workers are
   enabled and budgeted separately. Run `ruflo daemon status --all` and `ruflo daemon budget show`,
   then match the process and transcript evidence by project.
4. Report like a diagnosis, not a data dump: the verdict first (where the usage goes, interactive
   or automation, the single biggest driver), then a small supporting table, then ranked fixes with
   exact commands. The levers: stop a runaway daemon, trim an oversized global or project
   `CLAUDE.md`, gate a heavy always-on MCP server (its tool definitions are a per-session tax),
   cut hook or loop fan-out.

## Caveats

- The cost weight is an Opus-equivalent reference for comparing line items, not the plan's
  billing: never present it as dollars owed.
- A few hundred sessions or Task spawns from parallel subagent work is not a leak. Treat timing
  and naming as leads, and call something automation only when explicit session metadata, a known
  worker schedule or a running process backs it.

## Gates

- The engine reads only the `~/.claude/projects/**/*.jsonl` transcripts and, for the daemon
  cross-reference, the process list from `ps` (`--no-daemons` skips it). It writes nothing
  anywhere and posts nothing. Step 3 additionally runs the two read-only Ruflo reports named
  there.
- The output names projects and sessions: show it to the maintainer and never paste it into an
  issue, a pull request or any shared place without redacting the project names and paths first.
- Never stop a daemon or any other process from this skill: name the PIDs and their projects and
  leave the stop to the maintainer.

## Done

End with the verdict, the window it covers and the figures it rests on, the ranked fixes, and any
section that was empty or skipped (`--no-daemons`, no transcripts in the window).

Files in this skill

  • SKILL.md4.4 KB
  • scripts/ruflo-token-audit.py18 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.