audit-session-metrics
БесплатноЗапускает вложенные скриптыНе проверенAudit a session-metrics JSON export for token-usage waste and produce a plain-English findings report. Trigger when the user runs /audit-session-metrics, when…
от centminmod★ 2 752 звезды на GitHubОб этом скилле
Audit Session-Metrics
Reads a session-metrics JSON export and produces a prioritised, plain-English
audit of token-usage waste. It runs on the session's current model (it no
longer pins one — a hard model pin capped the usable context at that model's
window and broke invocation on long sessions). The work is mostly
summarisation over a small disk-read export, so for a much cheaper run
/model haiku before invoking. On the Anthropic API haiku is Haiku 5.5
(1M window, so long sessions fit; prompts over 100K tokens bill at its higher
rate). On Bedrock, Google Cloud, Microsoft Foundry, and Claude Platform on AWS
it is still Haiku 4.5 with a 200k window — short/early sessions only there.
Supports three JSON scopes auto-detected from digest.scope:
- session — single session (
session_*.json) — per-turn analysis - project — all sessions for one project (
project_*.json) — per-session analysis - instance — all projects (
instance/*/index.json) — per-project analysis
Dispatch — how to route this invocation
First positional argument received: $ARGUMENTS[0]
Second positional argument received: $ARGUMENTS[1]
Read $ARGUMENTS[0] and match by literal equality:
$ARGUMENTS[0] |
Route | Then read (session scope) | Then read (project/instance scope) |
|---|---|---|---|
quick |
Quick audit | references/quick-audit.md |
see Scope routing below |
detailed |
Detailed audit | references/detailed-audit.md |
see Scope routing below |
| (empty / other) | Print usage and stop | this file's "Usage" block below | — |
$ARGUMENTS[1] must be the path to a JSON export written by session-metrics.
Accepted patterns:
exports/session-metrics/session_<id8>_<ts>.json— session scopeexports/session-metrics/project_<ts>.json— project scopeexports/session-metrics/instance/<datedir>/index.json— instance scope
If $ARGUMENTS[1] is missing, empty, or the file does not exist, print:
Usage: /audit-session-metrics {quick|detailed} <path-to-session-metrics.json>
Accepted JSON types: session: exports/session-metrics/session_*.json project: exports/session-metrics/project_*.json instance: exports/session-metrics/instance/*/index.json
…and stop without further work.
Steps
Run the extract helper once with the input path:
python3 scripts/audit-extract.py $ARGUMENTS[1] --mode $ARGUMENTS[0]The helper emits a single JSON digest to stdout. Read
digest.scopefrom the output — it will be"session","project", or"instance". Do not read the raw.jsonl, and do not re-derive numbers the digest already carries.Scope routing — read the matching reference file:
digest.scope$ARGUMENTS[0]Reference file sessionquickreferences/quick-audit.mdsessiondetailedreferences/detailed-audit.mdprojectquickreferences/project-quick-audit.mdprojectdetailedreferences/project-detailed-audit.mdinstancequickordetailedreferences/instance-quick-audit.mdFollow the playbook step-by-step. Do not improvise additional phases.
For
detailedmode on session scope only, the playbook also asks you to read the user's config files (~/.claude/CLAUDE.md,./CLAUDE.md,~/.claude/settings.json,./.claude/settings.json,./.claudeignore). Each is capped at ≤500 lines — if a file is bigger, that itself is a finding.Output contract — three artefacts. All playbooks specify the same three-artefact contract:
- JSON sidecar at
<project>/exports/session-metrics/audit_<id8>_<ts>_<mode>.json— structured findings (versioned schema, enum'd metrics). - Markdown copy at
<project>/exports/session-metrics/audit_<id8>_<ts>_<mode>.md— same content rendered for humans. - Inline chat output — the markdown content printed in your reply.
<id8>and<ts>come fromdigest.session_id_shortanddigest.ts_str(the helper parses the input filename and normalises all three filename patterns).- JSON sidecar at
Write order. Populate the JSON object first using the digest values, write the JSON sidecar, render the markdown using the template in the playbook, write the markdown copy, then print the markdown inline (without the H1 heading — the chat client already shows context above the audit). Finish with two stderr-style lines on their own: `[audit] saved → <json-pat
Установить audit-session-metrics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл audit-session-metrics?
Audit a session-metrics JSON export for token-usage waste and produce a plain-English findings report. Trigger when the user runs /audit-session-metrics, when session-metrics suggests an audit after an HTML export, or when the user asks to audit / review / find waste in a saved session-metrics JSON. Two modes: "quick" (ratios + cache health + top expensive turns/sessions) and "detailed" (adds CLAUDE.md / settings / re-read scan). Supports session, project, and instance JSON scopes. Args: $ARGUMENTS[0] = quick|detailed, $ARGUMENTS[1] = path to a session-metrics JSON export.
Как установить скилл audit-session-metrics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл audit-session-metrics запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic