Skip to content
Back to skills

Fleet Stats

ASecurity

Show per-subagent invocation counts and token/cost spread by model tier from the current Claude Code transcript — proves whether the model-tiered fleet (haiku/sonnet/fable) actually spreads token cost. Use to see who was invoked, how often, tokens per agent/model, and escalation rate. Local and read-only (no Grafana/OTEL needed).

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 16, 2026
ai-agentspythonbashapi

Works with

  • claude code
  • api

Security analysis

A100/100

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

Scanned November 23, 2026

npx -y skills add chipi/agentic-ai-homelab --skill fleet-stats --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fleet Stats?

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

Security grade badge for Fleet Stats
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chipi-fleet-stats/badge)](https://www.skillsdirectory.com/skills/chipi-fleet-stats)

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: fleet-stats
description: Show per-subagent invocation counts and token/cost spread by model tier from the current Claude Code transcript — proves whether the model-tiered fleet (haiku/sonnet/fable) actually spreads token cost. Use to see who was invoked, how often, tokens per agent/model, and escalation rate. Local and read-only (no Grafana/OTEL needed).
---

# fleet-stats

Read the current session's transcript and report how the subagent fleet behaved —
who ran, how often, tokens per agent and per model tier, and how often executors
escalated to the advisor. Answers "does the cost-spread work" from real data.
Local + read-only.

## Run

```bash
python3 ~/.claude/skills/fleet-stats/scripts/fleet_stats.py   # latest transcript for this cwd
# or a specific transcript:
python3 ~/.claude/skills/fleet-stats/scripts/fleet_stats.py <path-to-session>.jsonl
```

It parses each `toolUseResult` with an `agentType` (a top-level subagent
invocation) for `totalTokens` + `resolvedModel`, then walks
`<session>/subagents/` for nested escalations (see "How nesting is counted").

## Read the report

- **invocations per agent** — who ran, how many times, on which model, tokens.
- **token + cost spread by model tier** — the money shot: `haiku`/`sonnet` should
  carry the volume; `fable` should be a small slice (advisor escalations only). If
  `fable` dominates, the tiering isn't paying off.
- **escalation** — nested executor→advisor calls.
- **delegation diagram** — mermaid; who called whom.

Cost rates in the script are approximate — update to current pricing (see the
`claude-api` skill); tokens-per-model is the real signal.

## How nesting is counted

Only **top-level** subagent calls (those the orchestrator spawned) appear in the
main transcript. A **nested** call — an executor consulting the `advisor` — runs
as a separate sub-agent, recorded in `<session>/subagents/agent-<id>.jsonl`; its
tokens do *not* roll into the parent (a parent's `totalTokens` is its own
final-context, disjoint from the child's). So the script reads both:

- **Top-level** rows use the authoritative `totalTokens` from the main transcript.
- **Nested** rows read the sub-agent's own final-context (input + cache + output
  of its last turn — exactly what `totalTokens` measures) from its transcript, and
  link back to the parent that spawned it via `meta.toolUseId`. Some escalations
  (e.g. a reviewer's advisor consult) are never persisted as a result in the
  parent, so the sub-transcript is the only source.

No subtraction is needed — a parent's tokens and its children's are disjoint, so
they simply add. The nested final-context reproduces the authoritative number
exactly where both exist (cross-checked), and within ~1% for a parent that itself
has children (a small returned-summary delta).

Files in this skill

  • SKILL.md3 KB
  • scripts/fleet_stats.py7.4 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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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