Usage4Claude
CLAUDE.md400 starsChanged 2 months agoMITView on GitHub
A macOS menu bar app that monitors Claude / Codex subscription usage. Swift + SwiftUI + AppKit, targeting macOS 13+. - Unit tests: swift test (SwiftPM only tests pure functions, runs in seconds; Package.swift uses a sources allowlist — newly extracted pure-function files must be added manually before they're testable) - Full build: ./scripts/build.sh --config Debug (.xcodeproj is the authoritative build; SwiftPM exists only for testing) - Localization consistency: python3 scripts/check_l10n.py (checks key sync across 7 languages; enforced in CI)…
In this repository2 other files it gives its agents.
- capture-usage4claude-screenshotsSkill
- releaseSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Do not touch the page, its assets (css/custom.css, js/i18n.js) or the middleware placeholder replacement.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
Usage4Claude — Project Overview
A macOS menu bar app that monitors Claude / Codex subscription usage. Swift + SwiftUI + AppKit, targeting macOS 13+.
Build & Test
- Unit tests:
swift test(SwiftPM only tests pure functions, runs in seconds;Package.swiftuses a sources allowlist — newly extracted pure-function files must be added manually before they're testable) - Full build:
./scripts/build.sh --config Debug(.xcodeprojis the authoritative build; SwiftPM exists only for testing) - Localization consistency:
python3 scripts/check_l10n.py(checks key sync across 7 languages; enforced in CI) - Website:
python3 website/build.pyregenerates the 7 homepages fromwebsite/src(template + strings); generated files are committed,--checkruns in CI. Never hand-edit the generatedindex.htmlfiles — seewebsite/README.md
Architecture Map
App/: entry point,MenuBarManager(coordinates UI and data), icon rendering (MenuBarIconRenderer/ShapeIconRenderer)Services/:ClaudeAPIService(cookie and OAuth dual paths),CodexAPIService(two-step auth),OAuthTokenCache(actor: token caching + refresh single-flight),KeychainManager(uses UserDefaults in DEBUG!),*OAuth/(PKCE + local callback server)Models/:UserSettingsis the settings facade; accounts/refresh policy/launch-at-login/appearance have been split out intoAccountStore/SmartRefreshPolicy/LaunchAtLoginManager/AppearanceManagerHelpers/DataRefreshManager.swift: scheduled refresh, Codex's three-tier token refresh chain, reset verification- Localization:
L.xxxaccessors (Helpers/LocalizationHelper.swift) →Resources/*.lproj/Localizable.strings; new keys must be synced across all 7 languages (de/en/fr/ja/ko/zh-Hans/zh-Hant) Tests/: SwiftPM test target, only covers pure-function files listed inPackage.swift's sources.agents/skills/: ready-made skills exist for release and screenshot capture (capture-usage4claude-screenshots)
Key Conventions
- Commits: English, no emoji, no Co-Authored-By — see
docs/COMMIT_MESSAGE_GUIDELINES.md(release commits are hand-written by the owner) - Releases:
CHANGELOG.mdis the authoritative version source and technical record;docs/RELEASE_NOTES.mdis the user-facing text for the Sparkle popup/Release body. A commit message with a[release]prefix pushed to main triggers a fully automated CI release — seedocs/DAILY_RELEASE_WORKFLOW.md - Service-layer public completions must always be called back on the main thread
Config/Info.plistis a static file (Xcode's auto-generation mode drops Sparkle keys) — edit it directly to change keys- Outdated docs go into
docs/archive/, not left in thedocs/root
Known Pitfalls
- SwiftUI Canvas's clockwise semantics are the opposite of NSBezierPath's (y-axis points down) — see
docs/SWIFTUI_CANVAS_PATH_DRAWING_GUIDE.md - DEBUG builds store credentials in UserDefaults (key prefix
DEBUG_), separate from Release's Keychain - Exception: Codex OAuth access_tokens always go to the Keychain (
CodexAccessTokenStore), in DEBUG too; they are reused until expiry so login, launch and diagnostics never spend a refresh_token (#87, #88) - OAuth refresh_tokens rotate on every renewal — any new token-fetching code path must reuse
OAuthTokenCache's single-flight mechanism - New root-level
.mdfiles are gitignored by default via/*.md— add a!/filename.mdallowlist entry to track them website/legal.htmlis the Stripe-reviewed 特定商取引法に基づく表記 page (Stripe's registered site ishttps://u4c.fi5h.xyz). Do not touch the page, its assets (css/custom.css,js/i18n.js) or the middleware placeholder replacement; any change risks another Stripe review. It is linked only from the Japanese homepage (LEGAL_NOTICE_LINKinwebsite/build.py)
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.

