一键导入
token-analyser
Analyse Claude Code session token costs inline
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyse Claude Code session token costs inline
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when updating documentation, README sections, CHANGELOG entries, docstrings, or CLAUDE.md conventions after a feature is complete.
Use when the task involves server-side API routes, middleware, business logic, authentication, database queries, or infrastructure configuration.
Task and document management with Backlog.md. Use this skill whenever working with tasks, tracking work, creating subtasks, searching or viewing existing tasks, or any time work should be preserved across sessions or handed off. Triggers include: "create a task", "track this", "add to backlog", "what tasks do I have", "mark as done", "continue on task", "break this into tasks", or any request where the outcome has a concrete deliverable worth tracking. Always use this skill when a project includes a Backlog.md setup and work needs to be logged. Prefer CLI commands unless MCP tools are confirmed working in the current environment.
Use when adversarial code review is needed — actively constructing failure scenarios, edge cases, and security violations to break the implementation.
Run code review via an external LLM API using external-review.sh. Outputs structured JSON with verdict, summary, and per-file concerns.
Use when the task involves UI components, HTML, CSS, styling, React, Vue, Svelte, client-side state, accessibility, or browser APIs.
| name | token-analyser |
| description | Analyse Claude Code session token costs inline |
Analyse Claude Code session token costs inline. All formatting is done by the CLI — no LLM work required for data crunching or display.
$CLAUDE_SESSION_ID)--today — sessions from 00:00 local time today to now--24h — sessions from exactly 24 hours ago to now (rolling window)--week — sessions from last 7 days--session <uuid> — specific session by UUID--models — add per-model usage breakdown (answers "did agents use different models?")Always include --breakdown --models to produce the richest output by default. Only omit them if the user explicitly asks for a minimal view.
python3 .claude/skills/token-analyser/token-analyser \
[--today | --24h | --week | --session <uuid>] \
--breakdown --models \
[--project-path <cwd>]
⚠️
--project-pathmust be the actual working directory Claude Code was invoked from (i.e.$PWD), not the git root. Defaults to$PWDautomatically.
Capture and print the full stdout output verbatim — it contains the complete Markdown dashboard.
Print the CLI stdout verbatim. The dashboard includes:
If the user wants to prevent the detected issues going forward:
python3 .claude/skills/token-analyser/token-analyser \
[--today | --24h | ...] \
--write-guidelines
Appends applicable token-efficiency guidelines to <project-path>/CLAUDE.md. Safe to re-run — uses a marker to avoid duplicates.
python3 .claude/skills/token-analyser/token-analyser \
[--today | --24h | ...] \
--report
Saves to .claude/reports/token-analyser-YYYY-MM-DD-HH-MM.md and opens the file on macOS.
Included by default (--models). Shows a MODEL BREAKDOWN table with calls/tokens/cost per model and warns if all calls used a single model — indicating that agent model: frontmatter overrides are not being applied (subagents inherit the parent session model).
Included by default (--breakdown). Shows a CALL BREAKDOWN table with each API call: raw (uncached) input, cache writes (new tokens written to cache), cache reads (tokens reused from cache), total context Claude saw, and output. Annotates the call with the largest cache write spike.
python3 .claude/skills/token-analyser/token-analyser --json
Outputs raw JSON from the underlying parse-logs.py parser.
parse-logs.py lives alongside this CLI in the same skill directory~/.claude/projects/<encoded>/subagents/*.jsonl