Skip to content

Add rate-limit reset time to Claude Code statusline sample#58

Open
Masahide-S wants to merge 1 commit into
runcat-dev:mainfrom
Masahide-S:feature/rate-limit-reset
Open

Add rate-limit reset time to Claude Code statusline sample#58
Masahide-S wants to merge 1 commit into
runcat-dev:mainfrom
Masahide-S:feature/rate-limit-reset

Conversation

@Masahide-S

@Masahide-S Masahide-S commented Jul 19, 2026

Copy link
Copy Markdown

Context of Contribution

  • Bug Fix
  • Refactoring
  • New Feature
  • Others

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 main per your feedback.

Extends docs/samples/claude-code/runcat-statusline.py so the 5h/7d
rate-limit metrics written to runcat-usage.json include a reset time,
e.g. 3% (~14:30) or 12% (~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 statusLine
stdin payload, alongside the used_percentage fields the script already
reads. This formats that timestamp as ~HH:MM for a same-day reset, or
~M/D HH:MM otherwise, 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_limits isn't populated),
resets_at is simply absent and the script falls back to a plain
percentage, 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).

スクリーンショット 2026-07-19 19 08 22

Reference

The reset-time display rule (same-day → ~HH:MM, cross-day →
~M/D HH:MM) follows the approach described in Brainy-Software's Zenn
article 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

  • I have read the CONTRIBUTING.md and agree to follow it.
  • This PR does not contain commits of multiple contexts.
  • Code follows proper indentation and naming conventions.
  • Implemented using only APIs that can be submitted to the App Store.

Base branch: runcat-dev/RunCatNeo:main ← Masahide-S/RunCatNeo:feature/rate-limit-reset

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>
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