Skip to content

Report usage-limit hits - #11

Merged
Expecho merged 2 commits into
mainfrom
usage-limits
Nov 4, 2026
Merged

Expecho merged 2 commits into
mainfrom
usage-limits

Conversation

@Expecho

@Expecho Expecho commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Reports how often a usage limit stopped a session.

What counts as a hit

  • Claude Code: the synthetic error message Claude Code writes when a usage limit rejects a request (apiError: "usage_limit_reached" with rate_limit_info). The limit type (5-hour, weekly, weekly Opus/Sonnet, extra usage) and reset time come from it. The older Claude AI usage limit reached|<epoch> format and team/enterprise spend limits count too.
  • GitHub Copilot: session.error events with errorType quota (premium requests used up) or rate_limit.
  • Not counted: transient capacity 429s (apiErrorIsTransient), login, server and model errors, and context-full or max_tokens stops. Cursor logs no errors.

In the reports

  • Summary, daily, weekly, monthly, session and project reports get a summary line and a Usage limits table (limit, hits, sessions, last hit, median time to reset), shown only when a limit was hit.
  • JSON output gets a usageLimits object with totals, per-limit counts and each hit.
  • README and the skill document it.

Testing

  • test/limits.test.mjs: detection (structured, text-only, legacy, spend; transient/login/server excluded), Copilot errors, the Claude loader's dedupe of resumed copies, the Copilot loader, stats and rendering.
  • All 59 tests pass. Real logs give no hits and no false positives.

🤖 Generated with Claude Code

Expecho and others added 2 commits November 4, 2026 10:50
Counts the times a plan's usage limit stopped a session: Claude Code's
error message for a request the limit rejected (5-hour, weekly, weekly
Opus / Sonnet, extra usage, spend limits; type and reset time from its
rate_limit_info, or the text in older versions), and Copilot's quota and
rate_limit session errors. Transient capacity 429s are left out. The
summary and period reports add a Usage limits table and a summary line
when a limit was hit; JSON always has usageLimits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/copilot.mjs
#	src/loader.mjs
@Expecho
Expecho merged commit ba585ac into main Nov 4, 2026
6 checks passed
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