agentleFS
f-is-hf-is-h/Usage4Claude/CLAUDE.md

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)…

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
  1. Very specific:

    Do not touch the page, its assets (css/custom.css, js/i18n.js) or the middleware placeholder replacement.

    line 46

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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.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)
  • Website: python3 website/build.py regenerates the 7 homepages from website/src (template + strings); generated files are committed, --check runs in CI. Never hand-edit the generated index.html files — see website/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/: UserSettings is the settings facade; accounts/refresh policy/launch-at-login/appearance have been split out into AccountStore/SmartRefreshPolicy/LaunchAtLoginManager/AppearanceManager
  • Helpers/DataRefreshManager.swift: scheduled refresh, Codex's three-tier token refresh chain, reset verification
  • Localization: L.xxx accessors (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 in Package.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.md is the authoritative version source and technical record; docs/RELEASE_NOTES.md is 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 — see docs/DAILY_RELEASE_WORKFLOW.md
  • Service-layer public completions must always be called back on the main thread
  • Config/Info.plist is 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 the docs/ 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 .md files are gitignored by default via /*.md — add a !/filename.md allowlist entry to track them
  • website/legal.html is the Stripe-reviewed 特定商取引法に基づく表記 page (Stripe's registered site is https://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_LINK in website/build.py)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.