Add session-budget, weekly-budget, and peak-hours widgets#289
Open
actionk wants to merge 1 commit intosirmalloc:mainfrom
Open
Add session-budget, weekly-budget, and peak-hours widgets#289actionk wants to merge 1 commit intosirmalloc:mainfrom
actionk wants to merge 1 commit intosirmalloc:mainfrom
Conversation
Three new widgets for tracking usage budget and peak hours: - session-budget: shows 5-hour usage with surplus/deficit indicator (↓ = under budget, ↑ = over budget based on elapsed time) - weekly-budget: same concept for the 7-day rolling window - peak-hours: shows whether Anthropic peak hours are active (weekdays 5am-11am PT) with countdown to next toggle Includes full test suites for all three widgets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three new widgets for tracking Claude Code usage budget and Anthropic peak hours:
session-budget— Shows 5-hour session usage with a surplus/deficit indicator relative to linear pacing. Example:5h: 32% ↓34%means usage is 34% below the expected pace (you have headroom).↑means you're burning faster than expected.weekly-budget— Same concept applied to the 7-day rolling window. Example:Week: 27% ↓9%peak-hours— Shows whether Anthropic's peak hours are active (weekdays 5am–11am PT / 1pm–7pm GMT) with a countdown to the next toggle. Example:⚡ Peak 3h20morOff-peak 17h37mHow budget indicators work
Widget types
session-budgetweekly-budgetpeak-hoursImplementation details
resolveUsageWindowWithFallbackandresolveWeeklyUsageWindowutilities for elapsed/remaining time calculationformatRawOrLabeledValue,getUsageErrorMessageshared helpersIntl.DateTimeFormatwithAmerica/Los_Angelestimezone for reliable cross-locale PT conversionWidgetinterface pattern with preview mode supportTest plan
SessionBudget— 8 tests (preview, null data, errors, under/over budget arrows, raw value, clamping)WeeklyBudget— 7 tests (preview, null data, errors, under/over budget, raw value)PeakHours— 5 tests (preview, peak detection, off-peak detection, weekends, non-null guarantee)