usage-monitor-token-cleanup
Skill19 starsChanged 50 days agoMITView on GitHub
Measure the context this repo loads every session (CLAUDE.md, memory, skills), report evidence-backed cleanup candidates with estimated savings, and apply only what the user approves. Use to save tokens, trim context, clean up memory or shrink CLAUDE.md.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- orchestrateSkill
- usage-monitor-commit-pushSkill
- usage-monitor-designSkill
- usage-monitor-nsis-installerSkill
- usage-monitor-release-betaSkill
- usage-monitor-releaseSkill
- usage-monitor-release-videoSkill
- usage-monitor-social-videoSkill
- usage-monitor-test-reportSkill
- usage-monitor-visual-optionsSkill
- usage-monitor-workflowSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
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 25
Measure: Run the read-only script and keep its output as the baseline:
- Distinctive: line 31
Analyze: Every finding carries the evidence that justifies it (line numbers, command output, file names).
- Very specific: line 60
Do not commit: Commit only when the user asks, through usage-monitor-commit-push.
- Distinctive: line 64
Never edit production code, tests, or build files.
- Distinctive: line 65
Never shorten a rule without the user approving that specific item.
- Distinctive: line 66
Never "summarize" a decision in a way that loses its reason without moving the reason somewhere.
- Very specific: line 67
Never delete a memory whose issues you did not check with gh.
- Distinctive: line 68
If a finding is a judgment call (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Usage Monitor Token Cleanup
Measure first, propose with evidence, ask item by item, apply only what was approved, measure again. Nothing is changed before the user picks it.
Targets
| Target | Loaded | Path |
| Project instructions | every session | CLAUDE.md |
| Global instructions | every session | ~/.claude/CLAUDE.md |
| Memory index | every session | ~/.claude/projects/<project-key>/memory/MEMORY.md |
| Memory files | on demand | same folder, *.md |
| Skill descriptions | every session | .claude/skills/*/SKILL.md frontmatter |
| Skill bodies | when invoked | .claude/skills/*/SKILL.md |
<project-key> is the absolute repo path with :, \ and / replaced by -.
Workflow
- Measure. Run the read-only script and keep its output as the baseline:
Tokens arepowershell -NoProfile -ExecutionPolicy Bypass -File .claude\skills\usage-monitor-token-cleanup\scripts\measure_context.ps1chars / 3.5— label them as an estimate everywhere; this is not the tokenizer's count. - Analyze. Every finding carries the evidence that justifies it (line numbers, command output, file names). No evidence, no finding.
- Project
CLAUDE.md— it dominates the budget. For each heavy section or first-level bullet the script lists:- Narrative that is history, not rule: measurements, "a primeira versão", dated incidents, run ids, how a bug was found. Candidate action: move it to the plan in
docs/planos/that already covers the subject (the script lists linked plans) or to a newdocs/<area>.md, and leave inCLAUDE.mdthe rule in 1–3 lines plus the link. The why must survive in the destination — moving is allowed, deleting a decision is not. - Duplication: the same rule stated in two sections, or restating
docs/design-system//server/README.md. Candidate action: keep one owner, link from the other. - Rules the tests already enforce (e.g.
ArchitectureRulesTest) can be shortened to the rule plus the test name, never removed.
- Narrative that is history, not rule: measurements, "a primeira versão", dated incidents, run ids, how a bug was found. Candidate action: move it to the plan in
- Memory:
- Broken pointers and orphan files (script output).
project_*memories citing issues: rungh issue view N --json state,titlefor each; a memory whose issues are all closed and whose pending work is done is a candidate for deletion.- Memories that duplicate
CLAUDE.md, the repo, or git history (the memory rules say not to store those). - Memories naming a file, function or flag:
Grepfor it; if it no longer exists, the memory is stale.
- Global
CLAUDE.md: rules redundant with the project file, or conflicting with it. Report conflicts; never resolve them silently — the global file is the user's personal instruction set. - Skills: descriptions over ~300 chars (paid every session), and bodies that repeat
CLAUDE.mdinstead of pointing to it.
- Project
Report. One table, sorted by estimated savings:
# Target Finding Evidence Est. tokens saved Proposed action Reversible? Reversibility: repo files are reversible through git; memory and
~/.claude/CLAUDE.mdlive outside git and are not.- Ask. Use
AskUserQuestionwithmultiSelect: true, one option per finding (batch in groups of up to 4 options per question, up to 4 questions per call). Before offering to delete or rewrite anything outside git, show its full current content in the report so the user decides on what they actually read. - Apply only the approved items.
- Repo files:
Edit, preserving line endings (CLAUDE.mdis CRLF in the working copy). - Memory: delete the file and its line in
MEMORY.md; when merging, update the surviving file and remove the other pointer. - Anything not selected stays untouched, including items the user did not answer.
- Repo files:
- Measure again with the same script and report before/after per target.
- Do not commit. Commit only when the user asks, through
usage-monitor-commit-push. Content moved fromCLAUDE.mdtodocs/goes in the same commit as the removal, so no decision exists in neither place.
Guardrails
- Never edit production code, tests, or build files.
- Never shorten a rule without the user approving that specific item.
- Never "summarize" a decision in a way that loses its reason without moving the reason somewhere.
- Never delete a memory whose issues you did not check with
gh. - If a finding is a judgment call (e.g. whether a passage is rule or history), say so in the Evidence column.
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.

