/meta:measure-session-cost [session id | --repo <folder> --last <n>]from meta
Reports what a Claude Code session cost at API list prices, by phase, by model and by subagent, from its transcripts on disk, through a bundled script holding a dated price table. Prices each call's context, read from or written to the prompt cache, and its output; splits the session at each compaction and each idle gap over an hour; names every call that rewrote its context to the cache and why, whether the start, a compaction, an expired cache or a model switch; gives the context at the first call, before any work, and the tools called with the size of what they returned. Takes a session id or its start, the current session, or a repo's newest sessions, in every account's config directory. A model, speed or usage shape the table lacks is reported unpriced, never guessed. Reads only. Finding a session by what was said in it is find-session's. Typed only: measure-session-cost [id | --repo FOLDER --last N].
Ships in meta. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A session's bill is its context times its calls, not its output. Each API call re-reads everything before it from the prompt cache, and writes what is new, so a long session is dear because every call carries the whole conversation. Two work-issue sessions in a client repo cost about $23 and $11 at list prices, of which output was about $4, and resuming each after nine idle hours rewrote its whole context to the cache, about $5 between them (2026-11-05). The bundled script reads a session's transcripts and says where its cost went, so a change meant to lower it can be measured, not assumed.
Past this file, the live page: code.claude.com by the
claude-code-docs MCP server or
curl -s https://code.claude.com/docs/en/<page>.md, and the prices by
curl -s https://platform.claude.com/docs/en/about-claude/pricing.md.
A live page that contradicts a line here wins: say so, act on the page,
and route the fix by capture-learning, bar a dated measured line that
names the page it overrules and the call that measured it, which a page
changed since its date sends back to re-measure. An observed claim is cited
or marked pending a doc check, and stands, marked observed, only where no
page covers it.
uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/measure-session-cost.py" [<id> | --repo <folder> --last <n>] [--json]
find-session's claude --resume line, or the transcript's name.
Words after measure-session-cost are the arguments.--repo <folder> --last <n> measures the newest n sessions run in
that repo, by its folder name, its worktrees counted as it, the asking
session left out; --last is 1 by default.--json prints the same as JSON, for parsing; its stamps are UTC,
where the text's times are local.--no-project: without it, uv run in a repo with its own
Python project syncs that project first. The script needs no
dependencies.totalCostUSD from
the session's last cost-state record, which holds those calls too.
Each process writes one as it ends, holding the session's total so
far, so the last is the session's. The line names what any gap above
holds: the compactions and away summaries counted, any prompt
suggestions, which leave no record to count, and any unpriced calls.
A session still running has no record, or calls after its last, and
the line says there is none to compare.promptCacheTtl or
subagentPromptCacheTtl sets one (Claude Code docs,
prompt-caching#choose-the-ttl-yourself, 2026-11-05), so on five
minutes a shorter gap expires the cache with no split. A
compaction's own call writes no assistant record, so it is named with
the context it summarized and not priced, and neither is the recap
an away_summary record shows, nor a next-prompt suggestion, a
background call on the session's model that reuses its cache
(Claude Code docs, interactive-mode#prompt-suggestions): the total
is a floor. Claude Code's own holds a compaction's and an away
summary's calls, shown by the gap they leave, and a suggestion's, by
inference. Over this repo's 80 newest sessions (2026-11-05, 2.1.318),
it matched the script to half a cent in 49 of the 50 with neither a
compaction nor an away summary, and ran up to $0.94 above in 26 of
the 27 with either. The fiftieth, a CLI session, ran $0.02 above by
one call no record holds, which read the last turn's whole cached
prefix, wrote 84 tokens to the cache and output 148: a suggestion's
shape, inferred, not confirmed.the one-hour cache had expired), a model switch, since a cache serves only the model
that wrote it, or a miss mid-phase, which on the five-minute cache
may be an idle gap of minutes. A call after an idle hour may still read a
prefix other sessions share: of 32 on this machine, 19 read 33k to 36k
tokens and 13 read nothing (2026-11-05). So a cold call shows by what
it wrote, not by a read of nothing.no session <id>: find the id with find-session; a
transcript older than cleanupPeriodDays has been deleted.<n> sessions start <id>: give more of the id.name a session id: CLAUDE_CODE_SESSION_ID is unset,
which happens outside Claude Code: give an id or --repo.the transcript format may have changed: it read
assistant records with no usage in them. Report that, and do not parse
the transcripts by hand as a stand-in.warning: find-session.py did not load: the script reads only its
own config directory, not the other account's. It loads
find-session's reader of the account map from the sibling skill
folder, so a deploy without find-session drops the other accounts.capture-learning where it is installed, not
an edit here.find-session; a skill's listing and use across sessions is no part
of this one.cost-state's
total holds, so the report gives the gap, which holds their sum and
any unpriced calls, and no single one; a cloud session's transcript, a transcript cleanupPeriodDays
deleted, and a tool result's tokens.What SKILL.md sets; muted values are Claude Code's defaults
inherithigh8 skills in this plugin
/audit-agent-setupAudits a repo's Claude Code setup on this machine and reports what to fix and what to add: hooks, permission rules, skills, subagents, plugins and MCP servers. Edits, writes and connects nothing. Runs the checks a generic recommender cannot: plugins declared off and the payload's reason for it, .mcp.json placeholders, literal header values and tracking, servers at the wrong scope, tenant pins that MCP servers ignore, and CLAUDE.md rules nothing enforces. Reuses the deployed agents and skills and microsoft-learn-mcp before proposing anything new, names scope-instructions, /doctor and /fewer-permission-prompts where one owns the question, and places each item in the repo, the repo the user's own config is authored in (through capture-learning from another repo) or nowhere. Typed only: audit-agent-setup [category]./draw-architectureDraws a repo's architecture as one Mermaid diagram in ARCHITECTURE.md, and keeps it true. The diagram is processes and boundaries: what crosses between a project's halves, such as a frontend and its backend, and what it starts or reaches outside itself, each edge labelled with what carries it, found by greps across both sides. Declines where a table serves: no crossing, fan-in or fan-out means no diagram. Renders each diagram with mermaid-cli by a bundled script and Reads the PNG before calling it done, since a diagram can parse and still draw too tall to read. Ends the file with the code the diagram is drawn from, and points the repo's CLAUDE.md or AGENTS.md at it, since nothing else loads it. Run again, it audits: rereads that code, lists where the file disagrees, and corrects it in place on a yes, never regenerating. Written for Claude Code first, a person second. Not for a flowchart of one procedure, a data model or a sequence diagram.Other plugins' skills for the same job
npx claudepluginhub wardawgmalvicious/claude-plugins --plugin meta