sessions · localixai — скилл для Claude Code: что делает и как установить
Скилл sessions для Claude Code анализирует локальные логи сессий и показывает распределение расхода токенов и затрат. Отчёт формируется за выбранное количество дней.
MIT ★ 171 обновлён 2026-11-17
/plugin marketplace add localixai/tokendoctor
/plugin install tokendoctor@tokendoctorЧто делает sessions
Скилл считывает данные из локальных логов Claude Code за последние 30 дней или выбранный период через утилиты tokendoctor-sessions и tokendoctor-replay. Процесс безопасен для конфиденциальных данных: парсер извлекает только объёмы токенов, временные метки, названия инструментов и пути к файлам. Текст сообщений остаётся нетронутым.
Стоимость пересчитывается по официальным тарифам Claude API. Анализ показывает соотношение трат основного потока и субагентов, частые вызовы Bash, забивающие контекст, и потенциальную экономию от уменьшения окна сжатия контекста (autoCompactWindow). Для применения правок скилл предлагает команды /tokendoctor:audit и /tokendoctor:optimize, не меняя файлы проекта самостоятельно.
Инструмент не видит сессии на других устройствах и логи, которые Claude Code уже удалил при плановой очистке.
Какие задачи решает
- выяснить, какие инструменты и субагенты тратят больше всего токенов
- оценить потенциальную экономию от изменения окна сжатия контекста
- найти неэффективные вызовы Bash вроде циклов ожидания или чтения файлов
- сравнить динамику расхода токенов по дням или неделям
Примеры запросов агенту
- Покажи расход токенов за последние 14 дней
- Проанализируй сессии Claude Code и траты на субагентов
- Запусти sessions для оценки экономии от сжатия контекста
Как установить sessions
1Через маркетплейс плагинов
/plugin marketplace add localixai/tokendoctor/plugin install tokendoctor@tokendoctorКоманда ставит плагин tokendoctor целиком, со всеми его скиллами
2Через Skills CLI (Vercel)
npx skills add localixai/tokendoctor --skill sessions -a claude-code3Вручную: положить файлы
~/.claude/skills/sessions/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/sessions/
1Через Skills CLI (Vercel)
npx skills add localixai/tokendoctor --skill sessions -a codex2Вручную: положить файлы
.agents/skills/sessions/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add localixai/tokendoctor --skill sessions -a cursor2Вручную: положить файлы
.cursor/skills/sessions/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install localixai/tokendoctor skills/sessions2Вручную: положить файлы
.github/skills/sessions/SKILL.md1Через Skills CLI (Vercel)
npx skills add localixai/tokendoctor --skill sessions -a gemini-cli2Командой платформы
gemini skills install https://github.com/localixai/tokendoctor --path skills/sessionsВручную: положить файлы
.devin/skills/sessions/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о sessions
Как установить sessions в Claude Code?
В интерфейсе Claude Code выполните /plugin marketplace add localixai/tokendoctor, затем /plugin install tokendoctor@tokendoctor. Либо выполните в терминале npx skills add localixai/tokendoctor --skill sessions -a claude-code.
Что делает скилл sessions?
Он читает локальные транскрипты сессий и рассчитывает распределение токенов между основным потоком и субагентами, оценивая перерасход по тарифам Claude API.
Что нужно для работы sessions?
Нужны доступные в среде утилиты tokendoctor-sessions и tokendoctor-replay. Скилл анализирует только локальные логи сессий на текущем компьютере.
Исходный текст
SKILL.md · MIT
---
name: sessions
description: Measure where tokens actually went in recent Claude Code sessions, from the local transcripts.
disable-model-invocation: true
allowed-tools: Bash(tokendoctor-sessions *), Bash(tokendoctor-replay *)
argument-hint: [days]
---
Measure token spend from this machine's session transcripts over the last `$ARGUMENTS` days (30 if
none given).
1. Run `tokendoctor-sessions --json --days <n>` and `tokendoctor-replay --json --days <n>`. Both
are read-only and read only usage figures, timestamps, tool names and file paths from the
transcripts, never message text.
2. Costs are dollars at each model's Claude API list price (lib/prices.mjs). What Claude Code bills
but does not write into transcripts (summary compactions' own requests, titles, WebFetch page
reads) comes from its own session totals where they hold, else an estimate. On a Pro or Max plan
these are what the same work would cost on the API, not what it took from the plan's limits: lead
with shares (percent), and say "at API list prices" with any dollar figure.
3. Open with the person's own number: what share of the period's cost a smaller compaction window
would have saved, from the replay (the 400K row, and 200K or 300K where they save much more).
Call it an upper bound: the replay cannot see the work a model does again after a summary. If
the window is already at or under 400K, or almost no session passed it, say the window would
change little for them, rather than leading with a small number.
Then lead with the two or three largest shares: main thread against subagents, the share spent with
more than 400K tokens in context, and the subagent types that cost the most. Then present each
finding in one or two plain sentences with its doc link.
4. Connect findings to settings where they apply: `late-compaction` to `autoCompactWindow`,
`subagents-on-top-model` to `CLAUDE_CODE_SUBAGENT_MODEL` and the Explore override. Offer
`/tokendoctor:audit` to check and fix them. Never edit files from this skill.
5. Then read `usage` and draw your own conclusions from it: which tools fill the context (calls and
characters of output, main thread and subagents apart), Bash calls that only printed a file
(`fileReads`) or slept in a loop (`waits`), the files read most often, and how large subagent
runs grow (requests, how many passed 200K context). Recommend what would cut the spend you see,
in plain words with the number behind it. A recommendation is either a setting or an instruction:
- a setting: give the exact `/tokendoctor <name> <value>` line, which applies it as typed
(`/tokendoctor` alone lists them). Among them: `bash-output <n>` caps what one Bash call puts
in context, `slide on`, `window <n>`, `subagents <model>`;
- an instruction for Claude (how subagents are briefed and sized, what they report back, when to
read docs, how to wait on a process): draft the few lines and say where they would go (the
project's memory or `CLAUDE.md`).
Offer `/tokendoctor:optimize` to apply several at once: it shows each change and applies only
what the person approves. Leave choices the person made on purpose (in memory or settings) to
them, with what they cost.
6. When asked about a trend or whether a change helped, run `tokendoctor-sessions --by day` (or
`--by week`, with `--days <n>`) and compare the periods before and after. Days older than the
transcripts come from the history the plugin's SessionStart hook records.
7. Say what this cannot see: per-model prices, sessions on other machines, and transcripts Claude
Code has already cleaned up.
© rsaryev · MIT · localixai/tokendoctor
Похожие скиллы
Все скиллы по теме «Настройка агента: память, контекст, субагенты» →Сначала — sessions от других авторов.