Add rate-limit reset time to Claude Code statusline sample#58
Open
Masahide-S wants to merge 1 commit into
Open
Add rate-limit reset time to Claude Code statusline sample#58Masahide-S wants to merge 1 commit into
Masahide-S wants to merge 1 commit into
Conversation
Recent Claude Code versions include rate_limits.five_hour.resets_at and rate_limits.seven_day.resets_at (Unix epoch seconds) in the statusLine stdin payload alongside the existing used_percentage fields. Format the reset time as "~HH:MM" for same-day resets or "~M/D HH:MM" otherwise, and append it to the 5h/7d metric values. Falls back to plain percentages when resets_at is absent (older CLI versions, or plans without rate limit visibility). Signed-off-by: s2422109 <166011337+s2422109@users.noreply.github.com>
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.
Context of Contribution
Summary of the Proposal
As mentioned in #56, this is a cleaned-up resubmission of the rate-limit
reset time feature, rebuilt from scratch as a minimal diff on top of the
latest
mainper your feedback.Extends
docs/samples/claude-code/runcat-statusline.pyso the 5h/7drate-limit metrics written to
runcat-usage.jsoninclude a reset time,e.g.
3% (~14:30)or12% (~7/22 03:00).Recent Claude Code versions include
rate_limits.five_hour.resets_at/rate_limits.seven_day.resets_at(Unix epoch seconds) in the statusLinestdin payload, alongside the
used_percentagefields the script alreadyreads. This formats that timestamp as
~HH:MMfor a same-day reset, or~M/D HH:MMotherwise, and appends it to the existing 5h/7d values.No new file reads, no new dependencies, and no requirement for the Claude
Desktop App — everything comes from the same JSON payload the script
already parses on stdin.
On older CLI versions (or plans where
rate_limitsisn't populated),resets_atis simply absent and the script falls back to a plainpercentage, same as before.
Screenshot
The Custom Metrics card showing both formats: the 5h row with a same-day
reset (
~HH:MM) and the 7d row with a cross-day reset (~M/D HH:MM).Reference
The reset-time display rule (same-day →
~HH:MM, cross-day →~M/D HH:MM) follows the approach described in Brainy-Software's Zennarticle on displaying Claude Code's rate-limit reset time
(the article implements it in JavaScript; this PR applies the same
formatting rule in Python).
Checklist
Base branch: runcat-dev/RunCatNeo:main ← Masahide-S/RunCatNeo:feature/rate-limit-reset