Skip to content

AGENTS.md: rules for the GitHub API budget - #10021

Merged
probonopd merged 1 commit into
masterfrom
claude/api-budget
Oct 11, 2026
Merged

probonopd merged 1 commit into
masterfrom
claude/api-budget

Conversation

@probonopd

Copy link
Copy Markdown
Member

GitHub allows 5000 REST requests an hour per user (1000 for GITHUB_TOKEN per repository), and every token that acts as the same account shares one bucket. Today an analysis with four requests per pull request, eight in parallel, plus a concurrent dry run of stale-discovered.sh that walked the comments of 3400 pull requests, used up the whole hour.

This adds a "GitHub API budget" section to AGENTS.md:

  • for scripts and workflows: count the requests before writing the loop, list once and filter locally, fetch per-item data only for the surviving candidates, send every request through one counting function that checks rate_limit every 50 requests and stops with a reserve left, print the count in the summary, stop after limit actions, one request-heavy job at a time, respect the search API's own limit;
  • for an agent working by hand: use git (refs/pull/N/head, ls-remote, raw.githubusercontent.com) where it gives the same answer for free, read rate_limit before a batch and keep a reserve, cache responses, 2-3 requests in parallel at most, stop at the first "rate limit exceeded".

The matching change to stale-discovered.sh (prefilter by updated_at, request counter and quota guard) is in #10014.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DZvaN9tm5taf5avUvVtmyq


Generated by Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DZvaN9tm5taf5avUvVtmyq
@probonopd
probonopd merged commit 075a736 into master Oct 11, 2026
1 check passed
@probonopd
probonopd deleted the claude/api-budget branch October 11, 2026 10:59
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