Skip to content

Claude plan usage in the notch: 5-hour and weekly limits - #159

Merged
Louis-CFM merged 5 commits into
mainfrom
claude-plan-gauge
Oct 3, 2026
Merged

Louis-CFM merged 5 commits into
mainfrom
claude-plan-gauge

Conversation

@Louis-CFM

Copy link
Copy Markdown
Owner

Summary

  • New Claude plan pill (GitHub build): the 5-hour and weekly usage of your Claude plan, with reset times. Mochi turns green, orange or red as you get closer to a limit.
  • The data comes from the Claude Code status line (rate_limits), relayed by nb-hook --statusline over the local socket. No network call and no token read. Pro and Max plans only.
  • Settings → Agents → Plan usage installs the relay in ~/.claude/settings.json with a before/after preview, a dated backup and a confirmation. An existing status line keeps working: the relay saves it and runs it, and Uninstall puts it back.

Tests

  • New CI step, scripts/test-plan-gauge.sh: parsing, bounds, expired windows and colors.

Louis-CFM and others added 5 commits October 3, 2026 01:33
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ly, validation

- Preview writes nothing; all file I/O deferred to confirm (fixes cancel-uninstall data loss)
- Reinstall preserves existing statusLine padding/refreshInterval (only command swapped)
- Pill label and color computed live from claudePlanUsage at render; removed tasks mutation in didSet
- integration_claude_plan is githubOnly: true (App Store has no installer)
- Install checks xcode-select -p and shows clear error if CLTools missing
- nb-hook.py: invalid stdin returns early in normal mode; --statusline continues regardless
- Validation: clamp pct 100-200 to 100 (not rejected); reject pct > 200; reject resets_at > 400 days
- Card: TimelineView every 30s; DateFormatter created once with en_US_POSIX locale
- Settings Plan usage: shows Installed/Not installed state and only the relevant button
- Diff shows only the statusLine key (before/after), not full settings.json
- settings.json written with .withoutEscapingSlashes
- 27/27 tests pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…talog pill

- Remove integration_claude_plan from PillCatalog; it was never shipped
- Add "Show in the notch" toggle in Settings → Agents → Plan usage; enabling
  it auto-triggers relay install if not yet installed; cancelling reverts toggle
- Small capsule pill in IslandHeader (home view, GitHub build): colored dot +
  "Claude 73%" label, active look while plan detail is open
- Tap pill: ClaudePlanCardView replaces left card; showingPlanDetail resets on
  focusId/view/mode change; big Mochi takes plan usage color while open
- Card tweaks: fixed 50pt bar, arrow.clockwise icon, compact reset labels
  ("in 1 h 20" / "Mon 9:00"), subtitle "just now / N min ago / N h ago",
  no truncation; TimelineView every 30s
- App Store build unaffected (all new UI is #if !APPSTORE)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Weekly reset label: "Mon 9:00" without "Resets" prefix (icon suffices)
- Label column widened to 40pt so "5 hours" never truncates
- Cache relay-installed state in AppState.planRelayInstalled; set at launch,
  refreshed on Settings open and after every Install/Uninstall confirm;
  IslandHeader reads state.planRelayInstalled instead of calling
  HookServer.statusLineInstalled() on each render
- Uninstall confirm sets showPlanInNotch = false

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Louis-CFM
Louis-CFM merged commit ad44a2f into main Oct 3, 2026
1 check passed
@Louis-CFM
Louis-CFM deleted the claude-plan-gauge branch October 3, 2026 00:13
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