cco — скилл для Claude Code: считает стоимость сессии и экономит токены
Показывает, сколько стоит текущая сессия и куда уходят токены, и даёт команды, чтобы тратить меньше. Полезен, когда счёт растёт, а причина непонятна.
npx skills add egorfedorov/claude-context-optimizer --skill cco -a claude-codeЧто делает cco
Скилл разбирает сессию по деньгам и токенам. Без аргументов открывается доска: бюджет, потрачено, сэкономлено, потери, активная задача и следующие шаги. Дальше — audit по реальным транскриптам, report с окупаемостью токенов, roi по моделям за месяц, tools с ценой каждого инструмента в токенах и overhead с фиксированным контекстом, который тянется в начале каждой сессии.
Экономия идёт через отдельные команды. pack <task> заранее собирает нужные файлы с диапазонами строк, anatomy рисует компактную карту проекта, claudemd ищет раздутость в CLAUDE.md, shield строит правила .contextignore из того, что ни разу не пригодилось. task ведёт стоимость задачи и сохраняет её состояние через /compact, orchestrate <task> отдаёт чтение и прогон тестов субагентам на Haiku.
Всё это локальные скрипты на Node, которые запускаются из ${CLAUDE_PLUGIN_ROOT}/src/. Поэтому скилл работает в Claude и Cowork на компьютере: если node или ${CLAUDE_PLUGIN_ROOT} недоступны, как в чате claude.ai, ничего не запустится — вместо этого скилл предложит fresh-start или token-check. Настройки порогов живут в config, бюджет и авто-компакт — в budget, а doctor проверяет установку целиком.
Какие задачи решает
- понять, куда ушли токены за сессию
- собрать файлы под задачу до того, как агент начнёт читать
- сохранить состояние задачи через
/compact - найти раздутость в
CLAUDE.md - посчитать экономию по моделям за месяц
Примеры запросов агенту
- Покажи доску: сколько стоит эта сессия и куда уходят токены
- Собери пакет файлов под задачу
рефакторинг APIс диапазонами строк - Заведи задачу и отслеживай её стоимость, чтобы состояние пережило
/compact
Как установить cco
1Через Skills CLI (Vercel)
npx skills add egorfedorov/claude-context-optimizer --skill cco -a claude-code2Вручную: положить файлы
~/.claude/skills/cco/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/cco/
1Через Skills CLI (Vercel)
npx skills add egorfedorov/claude-context-optimizer --skill cco -a codex2Вручную: положить файлы
.agents/skills/cco/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add egorfedorov/claude-context-optimizer --skill cco -a cursor2Вручную: положить файлы
.cursor/skills/cco/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install egorfedorov/claude-context-optimizer cco2Вручную: положить файлы
.github/skills/cco/SKILL.md1Через Skills CLI (Vercel)
npx skills add egorfedorov/claude-context-optimizer --skill cco -a gemini-cli2Командой платформы
gemini skills install https://github.com/egorfedorov/claude-context-optimizer --path skills/ccoВручную: положить файлы
.devin/skills/cco/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add egorfedorov/claude-context-optimizer --skill cco -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о cco
Как установить cco в Claude Code?
Выполните npx skills add egorfedorov/claude-context-optimizer --skill cco -a claude-code. Скилл встанет в ~/.claude/skills/cco/SKILL.md.
Что делает cco?
Считает стоимость сессии и распределение токенов, а затем помогает их сократить: собирает пакеты файлов, карту проекта, правила .contextignore и отслеживает задачи через /compact.
Почему cco не запускается в чате claude.ai?
Ему нужны локальные скрипты на Node и переменная ${CLAUDE_PLUGIN_ROOT}, которых в чате нет. В такой ситуации скилл предложит fresh-start или token-check.
Исходный текст
SKILL.md · MIT
---
name: cco
description: "In Claude Code: what this session costs and where the tokens go, plus the tools to cut it — /cco for the board, /cco audit, /cco task, /cco pack and more. Use when the user asks about session cost, context size, savings, or wants a task tracked across /compact."
argument-hint: "[command] [args] (empty for the board, 'help' for all)"
license: MIT
allowed-tools:
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/dashboard.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/audit.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/wrapped.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/tasks.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/smart-pack.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/anatomy.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/git-context.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/claudemd-analyzer.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/prompt-coach.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/context-shield.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/report.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/roi.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/digest.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/replay.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/tool-costs.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/overhead.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/config.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/export.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/patterns-share.js:*)"
- "Bash(node ${CLAUDE_PLUGIN_ROOT}/src/doctor.js:*)"
- Read
- Glob
---
# Context Optimizer
> **Needs Claude Code** (or Cowork on your computer): this runs the plugin's local scripts. If `node` or `${CLAUDE_PLUGIN_ROOT}` isn't available, as in claude.ai chat, don't try to run anything. Say so in one line and offer the `fresh-start` or `token-check` skill instead.
Arguments: `$ARGUMENTS`. The first word is the command; the rest are its
`<args>`. No command means `board`. `help`, or a command not in the table,
means: print the table below as a short menu and stop.
For a command, read its instructions in
`${CLAUDE_PLUGIN_ROOT}/skills/cco/commands/<command>.md` and follow them.
Those files write the plugin's path as `${CLAUDE_PLUGIN_ROOT}`: use
`${CLAUDE_PLUGIN_ROOT}` in its place, and the user's `<args>` where they say
`<args>`. When the user typed only a command that just runs its script, run
the script from the table directly and skip reading the file.
## See where the tokens go
| Command | What it shows | Script |
|---|---|---|
| *(none)* / `board` | This session: budget, $ spent, saved, waste, active task, next actions | `node ${CLAUDE_PLUGIN_ROOT}/src/dashboard.js board` |
| `audit` | Your real transcripts: where the money went and what CCO saved | `node ${CLAUDE_PLUGIN_ROOT}/src/audit.js <args>` |
| `wrapped` | A recap of your last week: spend, busiest day, priciest projects, one tip | `node ${CLAUDE_PLUGIN_ROOT}/src/wrapped.js <args>` |
| `report` | Token ROI across all tracked sessions | `node ${CLAUDE_PLUGIN_ROOT}/src/report.js full` |
| `roi` | Monthly savings by model | `node ${CLAUDE_PLUGIN_ROOT}/src/roi.js` |
| `digest` | Efficiency score and trend for the last N days | `node ${CLAUDE_PLUGIN_ROOT}/src/digest.js <args>` |
| `replay` | Recent session summaries | `node ${CLAUDE_PLUGIN_ROOT}/src/replay.js <args>` |
| `tools` | What each tool really costs in tokens | `node ${CLAUDE_PLUGIN_ROOT}/src/tool-costs.js` |
| `overhead` | The fixed context every session starts with | `node ${CLAUDE_PLUGIN_ROOT}/src/overhead.js` |
## Spend less
| Command | What it does |
|---|---|
| `orchestrate <task>` | Do a task with Haiku subagents doing the reading and test runs |
| `task` | Track a task's cost and keep its state across `/compact` |
| `pack <task>` | The files a task needs, with line ranges, before reading anything |
| `anatomy` | A compact map of the project |
| `git` | Context suggestions from the git working tree |
| `claudemd` | Find bloat in CLAUDE.md |
| `coach` | Grade the last prompt and sharpen it |
| `shield` | `.contextignore` rules from what was never used |
| `templates` | Saved context sets for recurring tasks |
## Settings and data
| Command | What it does |
|---|---|
| `config` | Tune thresholds (re-read warnings, cache staleness, coach) |
| `budget` | Context budget and auto-compact settings |
| `export` | Save a report as Markdown or an offline HTML page |
| `patterns` | Share learned file patterns with a team |
| `clean` | Prune or reset tracked data |
| `doctor` | Check the install end to end |
© egorfedorov · MIT · egorfedorov/claude-context-optimizer