AGENT SKILL

auditing-agent-token-usage

Audits recent Claude Code and Codex session logs for token and context cost: model routing, inherited subagent models, long sessions, compactions, oversized tool results, and unused MCP servers. Use when the user says "audit token usage", or when asked about agent token usage, context costs, session length, model routing, or cost efficiency.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 2
Forks
0

01 前言 Front Matter

name
auditing-agent-token-usage
description
Audits recent Claude Code and Codex session logs for token and context cost: model routing, inherited subagent models, long sessions, compactions, oversized tool results, and unused MCP servers. Use when the user says "audit token usage", or when asked about agent token usage, context costs, session length, model routing, or cost efficiency.
argument-hint
[<days>]

02 资源文件 2

03 SKILL.md 正文

Auditing agent token usage

Run the deterministic audit, then explain its results. The script is the measurement; do not substitute your own log reading for it.

"<skill-dir>/scripts/audit-token-usage.sh" <days>

<days> is a positive integer, default seven unless the user names another window. The script needs jq and reads Claude Code transcripts and Codex rollouts under the home directory. On a nonzero exit, relay stderr and stop.

Analyze

  • State the window and which sources had data. Claude Code sections, [1] to [5], measure transcript proxies such as turn counts and character sizes. The Codex section, [6], uses recorded token counts.
  • Identify the largest evidenced costs: expensive model usage, inherited subagent routing, long sessions, compactions, context re-reading, oversized tool results, and configured MCP servers absent from section [5].
  • Recommend only changes the output supports: at most three, ranked by expected impact, each citing the count or percentage behind it.
  • Never present Claude Code proxy values as measured tokens.
  • When a source is absent or the script fails, report the missing data or prerequisite. Do not infer its usage.

04 同仓库更多 Skills

bostonaholic
bostonaholic/skills

writing-system-prompts

Writes and reviews system prompts for AI tools, agents, chatbots, and LLM products using a fixed section order and a quality checklist. Use when the user says "write a system prompt", or when drafting a system prompt or auditing one for missing stop criteria, tool rules, constraints, or examples. Not for compressing an existing prompt; use improving-prompts.

★ 2
bostonaholic
bostonaholic/skills

writing-prose

Writes and edits prose for people in a plain, conversational, short house style with no em dashes. Use when the user says "write this up", or when drafting or revising documentation, READMEs, explanations, blog posts, or other human-facing prose. Not for prompts written for agents; use writing-system-prompts or composing-agent-prompts.

★ 2
bostonaholic
bostonaholic/skills

writing-acceptance-criteria

Writes or rewrites acceptance criteria until each is provable: one observable outcome with a named check that can fail. Use when the user says "write acceptance criteria", or asks to write, rewrite, or tighten acceptance criteria or a definition of done. Not for proving work meets them; use proving-claims.

★ 2
bostonaholic
bostonaholic/skills

summarizing-shipped-work

Summarizes the user's merged GitHub PRs for a timeframe into a grouped, linked shipped-work report with highlights, and offers to update a brag document. Use when the user says "what shipped?", or when asked what the user shipped (this week, last month, a quarter, since a date), for a status update, or to update a brag doc.

★ 2
bostonaholic
bostonaholic/skills

running-retros

Mines a session transcript, past agent sessions, or named sources such as PR review comments for durable learnings, then proposes approval-gated edits to skills, AGENTS.md, or docs and tracker issues. Use when the user says "retro", or when the user explicitly asks for a retrospective. Never infer from session end or friction.

★ 2
bostonaholic
bostonaholic/skills

learning-from-mistakes

Codifies the latest correction or mistake in the conversation as a short imperative rule in the project or global CLAUDE.md or AGENTS.md, after the user approves it. Use when the user says "learn from this mistake", or when the user asks to learn from a mistake, remember a lesson for next time, add a rule to CLAUDE.md, or not repeat a behavior. Not for a whole session; use running-retros.

★ 2