token-budget-review
Skill0 starsChanged 6 months agoMITView on GitHub
Audit project token usage by area (always-loaded, skills, examples, docs, worktrees, templates, ops bots), surface offenders, emit area-grouped cleanup plan. Trigger /token-review.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- plugin-v2/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- plugin-v2/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/agents.mdcCursor rule
- agentic-security-reviewSkill
- arc42-baselineSkill
- caveman-commitSkill
- caveman-helpSkill
- caveman-reviewSkill
- cavemanSkill
- create-goalSkill
- design-twiceSkill
- discovery-sprintSkill
- domain-contextSkill
- github-project-setupSkill
- grillSkill
- improve-codebase-architectureSkill
- issue-breakdownSkill
- issue-draftSkill
- issue-pr-syncSkill
- new-adrSkill
- new-glossary-entrySkill
- orchestrateSkill
- portfolio-trackSkill
- product-pageSkill
- project-reviewSkill
- project-runSkill
- project-scaffoldingSkill
- quality-assuranceSkill
- quality-metricsSkill
- record-decisionSkill
- review-fixSkill
- roadmap-managementSkill
- sales-cycleSkill
- specorator-designSkill
- specorator-improvementSkill
- specorator-onboardSkill
- stock-takingSkill
- tackle-issueSkill
- tdd-cycleSkill
- tracer-bulletSkill
- ubiquitous-languageSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Run quarterly, before a release, or when an agent reports unexplained slowdowns.
- Very specific: line 27
Run the queries in MEASURE.md end-to-end.
- Very specific: line 54
Use PLAN-TEMPLATE.md to scaffold docs/superpowers/plans/<date>-token-budget-cleanup.md.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Budget Review
Audit how much of the prompt budget the repo burns on every Claude Code session, surface offenders by area, and emit a cleanup plan one PR per area.
Run quarterly, before a release, or when an agent reports unexplained slowdowns.
When to invoke
- Slash:
/token-review(or/token-review <slug>to scope to a sub-tree). - Natural language: "review token usage", "audit token budget", "the prompt feels heavy", "where is our context going".
- Automated: as a scheduled
/loopor/scheduleagent, monthly.
Outputs
/tmp/token-audit-<YYYY-MM-DD>.txt— raw measurements (intermediate; not committed).docs/superpowers/plans/<YYYY-MM-DD>-token-budget-cleanup.md— area-grouped implementation plan with one chunk per area, plus a Chunk 0 mechanical compress and a final guardrail chunk.
Phases
Phase 1 — Measure
Run the queries in MEASURE.md end-to-end. Capture output to /tmp/token-audit-<date>.txt. Do not skip queries — each surfaces a different category of waste.
The measurement set covers:
- Always-loaded chain —
CLAUDE.md+AGENTS.md+memory/constitution.md+.claude/memory/MEMORY.md(loaded every session). - Skill catalog — frontmatter
description:field of every.claude/skills/*/SKILL.md(rendered into the system prompt). - Skill bodies — full text of every
SKILL.md(loaded on invocation). - Agent prompts —
.claude/agents/*.md(loaded on subagent dispatch). - Examples sub-tree —
examples/**/*.md(silent token bomb if agents read for "reference"). - Worktree pollution —
.worktrees/**/*.md(full repo copies; inflates Glob/Grep). - Docs heavyweights —
README.md,docs/sink.md, top ADRs. - Templates —
templates/**/*.md. - Operational bot prompts —
agents/operational/*/PROMPT.md.
Phase 2 — Surface offenders
For each area, identify:
- Top 3-5 files by size.
- Files exceeding the cap defined in
docs/token-budget.md(when present). - Duplication / cross-file overlap (e.g. CLAUDE.md ↔ AGENTS.md).
- Forward-deferred references that could be lazy-loaded.
Rank areas by per-session impact (how often the artifacts are loaded). The always-loaded chain and skill catalog dominate.
Phase 3 — Emit plan
Use PLAN-TEMPLATE.md to scaffold docs/superpowers/plans/<date>-token-budget-cleanup.md. The template includes:
- Header with goal, architecture, branch convention.
- Audit summary table (one row per area).
- One chunk per area, each one PR.
- Chunk 0 = mechanical
/caveman:compresspass on the heaviest natural-language files. - Final chunk =
verify-gate guardrail (so the savings can't regress). - An optional repeatable-skill chunk that re-runs this very audit.
Each chunk lists: files, branch name, ordered checkbox steps, commit + PR commands.
Phase 4 — Hand off
Recommend running the plan with superpowers:subagent-driven-development (Claude Code) or superpowers:executing-plans (other harnesses). Each chunk = one PR cut from the integration branch (or stacked off the umbrella per the plan). Order chunks by ROI (always-loaded first, guardrail last).
What this skill does NOT do
- It does not apply changes itself. The skill measures and plans; execution is delegated.
- It does not prune
.worktrees/<slug>/automatically — that's destructive (Article IX). Surface candidates; let the human decide. - It does not modify ADRs in place — ADR bodies are immutable; suggest superseding instead.
See also
docs/superpowers/plans/— past cleanup plans.docs/token-budget.md— the budget policy + verify-gate hook (added in a follow-up).MEASURE.md— measurement queries.PLAN-TEMPLATE.md— output template.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

