2 pointsby rajish6 hours ago1 comment
  • rajish2 hours ago
    Forgot the GitHub link: https://github.com/rajish/cc-hdrm

    Quick technical notes since a few things tend to come up:

      How does it get credentials? It reads the OAuth tokens that Claude Code stores in macOS Keychain. No login flow, no API keys, no config file. If Claude works in your terminal, cc-hdrm works automatically. Tokens are read fresh from Keychain every poll cycle — nothing cached to disk.                      
                                                                                                                                                                                                                                                                                                                       
      What API does it hit? GET /api/oauth/usage — the same endpoint the web dashboard uses for the quota bars. It returns your current utilisation percentages and reset times for both the 5-hour and 7-day windows. This is not the chat completions API, so it doesn't consume any tokens or count toward your     
      limits.
    
      How does the "subscription intelligence" work without an LLM? It's just math. The pattern detector looks at your usage history in SQLite and applies heuristics — e.g., if your average utilisation has been under 5% for two consecutive weeks, it flags "forgotten subscription." Tier recommendations compare your actual usage against known tier limits and pricing. The natural-language summaries are template-based, not generated. No API calls, no inference.
    
      Privacy: Everything stays on your machine. The only network traffic is the usage polling endpoint (same as opening claude.ai/settings) and token refresh when your OAuth token expires. No telemetry, no analytics, no phoning home.
    
      Why native Swift instead of Electron? Menu bar utilities should be invisible. cc-hdrm uses about 30 MB of memory and negligible CPU. The analytics charts are SwiftUI Charts. No web views anywhere.
    
      The whole thing started because I kept getting rate-limited during long Claude Code sessions and had no visibility into how close I was to the limit. The 5-hour window resets are especially hard to track mentally when you're deep in a coding session.