Skip to content

feat(claude): show banked limit resets and expiry dates - #4

Merged
shuv1337 merged 11 commits into
masterfrom
feat/claude-limit-resets
Nov 9, 2026
Merged

shuv1337 merged 11 commits into
masterfrom
feat/claude-limit-resets

Conversation

@shuv1337

@shuv1337 shuv1337 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add read-only Claude limit-reset enrichment per account, alongside ordinary usage.
  • Show the total plus New-model/weekly (and session/full/Other) groups with separate availability and expiry dates in TUI details, static cards, compact output, and typed JSON extras.
  • Preserve spend/usage on optional failures, keep credential ownership unchanged, and add no runtime dependencies.

Verified data source and safety

GET https://api.anthropic.com/api/oauth/usage?cedar_ember=1&skip_spend=1, discovered in the installed Claude Code 2.1.319 bundle. The usage-client User-Agent is required; without it, the response is ineligible with reason surface.

Fields: cedar_ember.eligible, grants[].resets_left, ends_at, starts_at, type, gives_back_weekly, clears, and paused. gives_back_weekly: true takes precedence over type: full and uses the neutral New-model label; Fable is used only when the API explicitly names it.

The client uses GET for status and a separate POST route for redemption. No redemption route was called or implemented. External credentials are never refreshed or written. All probes were GET; a guarded live CLI check additionally rejected any non-GET fetch. Details and fixture provenance: docs/claude-limit-resets.md.

Live worktree output

Claude · work
  Weekly: 92% left, resets 09:59 Sun
  Fable weekly: 98% left, resets 09:59 Sun
  Limit resets: 4
  Fable resets: 3 · expire Mar 8, 2027, 23:59 PST
  Weekly reset: 1 · expires Dec 15, 2026, 20:59 PST

Validation

  • bun test: 785 passed, 0 failed (20 more tests for the review fixes).
  • bun run preflight: passed on the clean committed tree.
  • bun run release:pack: passed, lib/ and web/ included.
  • git diff --check: passed.
  • Worktree CLI (node ./shuvquota.js claude work --compact --no-color): real grants and expiry dates confirmed.
  • Tests cover optional HTTP/JSON/network failures, GET-only reads, per-account isolation, external-file immutability, grouped counts/expiries, unsupported plans, privacy, and JSON/compact/static/watch integration.

No merge requested; main checkout left untouched.

Review fixes

Each requested fix is a separate commit, with a full bun test pass before committing:

  1. 5246599 — Cache successful reset reads for 15 minutes per SHA-256 token hash; honor reset 429 cooldowns/Retry-After and primary usage cooldowns.
  2. 3f355d1 — Five-second optional reset HTTP timeout, preserving ordinary usage on abort.
  3. 27c5d61 — Centralized User-Agent; lazy cached shell-free claude --version detection with 1.5-second timeout, fallback/minimum 2.1.319. Documented stale-UA blank sections.
  4. 335e1a1 — 24-hour reset clocks using hourCycle: "h23", including midnight.
  5. 18f58e4 — Count future grants; preserve safe startsAt and show “from ”.
  6. 239f5ca — Count unclassifiable grants under Other; neutral New-model labels unless the API explicitly names Fable. Includes an untyped future grant test.
  7. 0d09391 — Invalid display zones retry with local time.
  8. a3ec130 — README says “Pacific time (the renderer's display time zone)”.
  9. c3993d0 — Footer/help/docs use “Up next” for upcoming quota resets.

Final local validation: 785 passed, 0 failed; clean-tree bun run preflight, bun run release:pack, and git diff --check all passed. Zero runtime dependencies retained.

Final real-account worktree check: node --import <GET-only-guard> ./shuvquota.js claude work --compact --no-color (the worktree's sq entry point). Exactly two GETs to Claude usage; the guard rejects all other methods/endpoints. The live output above is current; Fable is explicitly named by this account's API response. No credentials refreshed and no reset applied or redeemed.

CI verified green at c3993d0: test and both Socket Security checks passed. PR remains open; do not merge.

@shuv1337
shuv1337 merged commit 66301ec into master Nov 9, 2026
3 checks passed
@shuv1337
shuv1337 deleted the feat/claude-limit-resets branch November 9, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant