claude-usage-meter
AGENTS.md2 starsChanged 11 days agoMITView on GitHub
Claude Code mod (installed like a plugin, distributed through this repo's own marketplace) that draws context, 5-hour session, weekly usage and a daily budget on the footer. README.md covers what users see. Every change reaches main through a pull request, never a direct commit: The version bump is what makes the release: installed copies are keyed by version, so a change merged without a bump never reaches anyone who installed from the marketplace. Third-party marketplaces also don't auto-update by default,…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md 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 7
Every change reaches main through a pull request, never a direct commit:
- Very specific: line 16
When two open PRs both append tests to the end of hooks/register.test.tsx, the second to merge conflicts there.
- Very specific: line 30
All code is hooks/register.tsx, loaded through hooks/hooks.json as a function-hooks module.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md
Claude Code mod (installed like a plugin, distributed through this repo's own marketplace) that draws context, 5-hour session, weekly usage and a daily budget on the footer. README.md covers what users see.
Shipping a change
Every change reaches main through a pull request, never a direct commit:
- Branch off an up-to-date
main(fix/…,feat/…,chore/…). - Make the change with tests;
sh scripts/check.shpasses (CI runs the same script on every PR). - Bump
versionin.claude-plugin/plugin.jsonin the same branch, as semver: patch for fixes, minor for new metrics or settings, major when saved settings stop loading. - Open the PR with the
prskill's template (Summary, Evidence with before/after, Merge Danger).
The version bump is what makes the release: installed copies are keyed by version, so a change merged without a bump never reaches anyone who installed from the marketplace. Third-party marketplaces also don't auto-update by default, so users still run /plugin marketplace update claude-usage-meter (or turn on auto-update) to pick it up.
When two open PRs both append tests to the end of hooks/register.test.tsx, the second to merge conflicts there; keep both blocks and re-run the tests.
Commands
sh scripts/check.sh # validate, test, and tsc when .claude-plugin/types/ exists
claude plugin validate . # manifest and hooks.json
claude plugin test . # every *.test.tsx; there is no filter for a single test
tsc -p . # needs .claude-plugin/types/, written once Claude Code has loaded the mod
claude --plugin-dir . # run a local cloneArchitecture
All code is hooks/register.tsx, loaded through hooks/hooks.json as a function-hooks module; types/index.d.ts holds the domain types and the PluginState atoms (config, usage, baseline).
- Data in:
session.startseeds from$.session.usage(),session.measureupdates after each response,session.compactrecomputes the context fromtokensAfter. No API calls are made. - Several terminals: limits belong to the account, so each terminal publishes its newest reading to
~/.claude/usage-meter/latest-limits.json(underCLAUDE_CONFIG_DIRwhen set) and every 10 ssyncLimitsadopts a newer one and drops readings past theirresetsAt. A writer never replaces a newermeasuredAt. - Settings: stored under
settings.v2in$.store, which all terminals share. Pane changes read the saved value, apply the change and write it back, queued per terminal, so one terminal never undoes another's choice. Changing the shape needs a new key or a migration inmergeWithDefaults. Each change is also written to~/.claude/usage-meter/latest-settings.json; every terminal returns it as awatchPathsentry fromclassic.SessionStart, andclassic.FileChangedadopts it at once, in the same queue.loadSettingsprefers that file over the store (two terminals saving at once can leave the store on the older choice), and both go throughmergeWithDefaults. - Daily budget:
dayBaselinein the store records the weekly percent at the start of each local day. - UI:
ui.renderforSessionModedraws the footer; forPanethe settings. Text lives inMESSAGES(en,pt-BR); add both. Hover styles rely on the engine order indocs/adr/0003; check them withscripts/hover-check.sh.
Tests use claude-code/testing: answerEngine stubs the store, files and clock, so time-based behaviour is tested with clock.advance.
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.

