Skip to content

feat: add claudePeakHoursEnabled setting and integrate into UsageMenu…#611

Open
hello-amed wants to merge 4 commits intosteipete:mainfrom
hello-amed:feature/claude-peak-hours-indicator
Open

feat: add claudePeakHoursEnabled setting and integrate into UsageMenu…#611
hello-amed wants to merge 4 commits intosteipete:mainfrom
hello-amed:feature/claude-peak-hours-indicator

Conversation

@hello-amed
Copy link
Copy Markdown

@hello-amed hello-amed commented Mar 27, 2026

Add peak hours indicator for Claude

Shows whether Claude is currently in peak or off-peak usage hours directly in the menu card. During peak hours (8 AM–2 PM ET, weekdays), usage counts more heavily against plan limits — this helps users decide when to schedule heavier work.

What it does

  • Displays a line like "Peak · ends in 2h 30m" or "Off-peak · peak in 9h" below the usage bars
  • Uses countdowns instead of fixed times so you don't have to convert timezones
  • Weekends are always off-peak
  • On by default, can be toggled off in Claude provider settings ("Show peak hours indicator")

Screenshots

image

Changes

  • ClaudePeakHours.swift — determines peak/off-peak status and formats the countdown
  • MenuCardView.swift — shows the note for Claude when the setting is enabled
  • Settings plumbing across SettingsStore, SettingsStoreState, and ClaudeProviderImplementation for the toggle
  • ClaudePeakHoursTests.swift — 14 tests covering weekday boundaries, weekends, and Friday→Monday transitions

Context

Anthropic recently changed how usage limits work during peak hours — sessions burn faster during 8 AM–2 PM ET on weekdays. This was announced as a capacity management change, not a temporary promo. More info:

https://x.com/trq212/status/2037254607001559305?s=46&t=zaM0WGXRKL-GqGy6eWj_1A
https://support.claude.com/en/articles/14063676

…CardView and ClaudeProviderImplementation

- Introduced `claudePeakHoursEnabled` property in SettingsStore and SettingsStoreState.
- Updated UsageMenuCardView to utilize the new setting for displaying peak hours status.
- Added toggle for peak hours visibility in ClaudeProviderImplementation.
- Ensured persistence of the setting in user defaults.
Copilot AI review requested due to automatic review settings March 27, 2026 06:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a user-facing setting to control whether Claude “peak hours” status is shown, wires it through settings persistence, provider settings UI, and the usage menu card, and introduces a core formatter + tests for determining peak/off-peak status.

Changes:

  • Added claudePeakHoursEnabled to SettingsStore state, defaults loading, and UserDefaults persistence.
  • Introduced ClaudePeakHours (CodexBarCore) with weekday/ET peak-window calculations plus dedicated unit tests.
  • Integrated the setting into the Claude provider settings toggles and UsageMenuCardView note rendering.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/CodexBarTests/ClaudePeakHoursTests.swift Adds unit tests covering peak/off-peak labeling and timing boundaries.
Sources/CodexBarCore/Providers/Claude/ClaudePeakHours.swift Implements peak-hours window logic and duration formatting.
Sources/CodexBar/StatusItemController+Menu.swift Passes the new setting into the usage menu card model input.
Sources/CodexBar/SettingsStoreState.swift Extends defaults state to include claudePeakHoursEnabled.
Sources/CodexBar/SettingsStore.swift Loads claudePeakHoursEnabled from UserDefaults (defaulting to true).
Sources/CodexBar/SettingsStore+Defaults.swift Adds computed property for reading/writing the setting to UserDefaults.
Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift Adds a provider settings toggle bound to claudePeakHoursEnabled.
Sources/CodexBar/MenuCardView.swift Extends model input and shows the peak-hours label in usageNotes when enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Updated `claudePeakHoursEnabled` to default to true in the UsageMenuCardView model.
- Added tests to verify peak hours note visibility when the setting is enabled and disabled.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09a4420c39

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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.

2 participants