goal-token-budgeting
Track running token usage against goal's `token_budget`, surface at 50/80/100% thresholds, stop at 100%. USE WHEN: `goal-persistence` active AND user provided…
от MiniMax-AI★ 30 звёзд на GitHub
Установить goal-token-budgeting в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Goal Token Budgeting
A goal without a budget is open-ended; an agent will spend whatever it takes to "look done" at the cost of the user. A goal with a budget is a contract: the agent is accountable for fitting the work inside the spend, and the user can decide whether more spend is worth it.
This Skill tracks the running usage against the budget, surfaces the trend, and reports the final number on completion.
When to use
Activate when any of these is true:
goal-persistenceis active and the user provided atoken_budgetwhen setting the goal.- The user says "do X within Y tokens" / "use the cheap model for this" / "don't burn too much on this."
- You are about to start a sub-task and want to know "how much budget do I have left?"
- A
context-pressure-compactis about to be applied and you need to report whether the goal is still within budget.
When NOT to use
- The goal has no budget (the user didn't set one). Tracking zero is not useful.
- The user explicitly said "no budget tracking for this one."
Process
At goal set, if the user provided a
token_budget, record it in the goal file (goal-persistenceSkill) under a new section:## Token budget **Budget**: <N tokens> (set by user) **Set at**: <ISO timestamp>If the user did not provide a budget, do not add this section. Absence of the section means "no budget."
At every turn boundary (end of your response, or at every
context-pressure-compact), read the harness's per-turn token usage and append a row to a usage log:## Usage log | turn | tokens | used_so_far | remaining | % of budget | |------|--------|-------------|-----------|-------------| | 1 | 1,240 | 1,240 | 18,760 | 6% | | 2 | 2,100 | 3,340 | 16,660 | 17% | | ... | ... | ... | ... | ... |You can read the harness's token usage from:
- the conversation transcript (if the harness surfaces per-turn counts)
- the system prompt (if it includes running totals)
TokenCountevents (if the harness emits them — seeprotocol::EventMsg::TokenCount)
At every boundary, surface the trend, not just the raw number:
- Under 50% used: silent (the budget is fine).
- 50-80% used: mention the budget in the response, one line. "Budget: 12,400 / 20,000 (62%)."
- 80-100% used: warn the user explicitly. "Budget almost used: 17,200 / 20,000 (86%). Next turn may exceed — should I stop here or continue?"
- Over 100% used: stop, surface to user, ask whether to:
- declare the goal done with the over-budget cost
- ask for a budget extension
- re-scope the goal to fit
At every
context-pressure-compact, the compact summary must include the latest usage row. The user must be able to see the budget trend across the compacted summary.On goal completion (via
completion-auditSkill), the final report must include the actual final token usage, read from the harness — not an estimate. The user set the budget; they get the number.
Output contract
The user sees:
- At goal set: a one-line "Budget: N tokens" in the goal file.
- During execution: silent under 50%, one line at 50-80%, warn at 80-100%, stop at 100%+.
- At every compact: the latest usage row included in the summary.
- On completion: a one-line "Final token usage: M / N (X%)".
Example
> User: "Migrate the auth subsystem to OIDC alongside SAML. Token budget: 20,000."
[Goal file]
## Token budget
**Budget**: 20,000 tokens (set by user)
**Set at**: 2026-08-23T22:00:00Z
[Usage log over time]
| turn | tokens | used_so_far | remaining | % of budget |
|------|--------|-------------|-----------|-------------|
| 1 | 1,240 | 1,240 | 18,760 | 6% |
| 2 | 2,100 | 3,340 | 16,660 | 17% |
| 5 | 3,200 | 8,940 | 11,060 | 45% |
| 8 | 2,500 | 14,300 | 5,700 | 71% ← one-liner appears |
| 10 | 1,800 | 17,200 | 2,800 | 86% ← warn appears |
| 11 | 1,500 | 18,700 | 1,300 | 93% ← warn continues |
| 12 | 1,400 | 20,100 | (over) | 101% ← stop and ask user |
At turn 12, the agent surfaces:
Budget exceeded: 20,100 / 20,000 tokens. I have 2 of the 4 success criteria verified. Options: (a) declare partial completion, (b) ask for a 5,000-token extension, (c) re-scope the goal to what fits in 2,000 more tokens. Which?
Common pitfalls
- Do not invent a budget the user did not set. Absence of budget is not "use whatever you need." It is "track usage but do not warn at thresholds."
- Do not estimate the final number on completion. Read the actual usage from the harness. Estimation is dishonest.
- Do not warn at 50% if the user explicitly said "don't bother me with budget updates." Respect the user's signal.
- **Do not silently
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл goal-token-budgeting?
Track running token usage against goal's `token_budget`, surface at 50/80/100% thresholds, stop at 100%. USE WHEN: `goal-persistence` active AND user provided `token_budget`, user said "do X within Y tokens" / "用 Y token 完成" / "不要超预算" / "stayed within budget" / "超出预算" / "用了多少 token", about to start sub-task and need to know remaining budget, at every compact / turn boundary. TRIGGER PHRASES: "token budget", "预算", "Y tokens", "不要超过", "stayed within budget", "超出预算", "用完没", "用了多少 token", "预算跟踪", "50% / 80% / 100%", "token 预算". SKIP WHEN: goal has no budget (user did not set one), user explicitly said "no budget tracking for this one".
Как установить скилл goal-token-budgeting?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл goal-token-budgeting запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…