Auto-retry Claude Code on subscription rate limits, API overload (529/5xx) and safeguard false positives — waits for the printed reset, exponential backoff, tmux-based
# Add to your Claude Code skills
git clone https://github.com/cheapestinference/claude-auto-retryGuides for using ai agents skills like claude-auto-retry.
Last scanned: 7/25/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-07-25T06:18:01.969Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}claude-auto-retry is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by cheapestinference. Auto-retry Claude Code on subscription rate limits, API overload (529/5xx) and safeguard false positives — waits for the printed reset, exponential backoff, tmux-based. It has 289 GitHub stars.
Yes. claude-auto-retry passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/cheapestinference/claude-auto-retry" and add it to your Claude Code skills directory (see the Installation section above).
claude-auto-retry is primarily written in JavaScript. It is open-source under cheapestinference on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-auto-retry against similar tools.
No comments yet. Be the first to share your thoughts!
Automatically retry Claude Code sessions when you hit Anthropic subscription rate limits.
When Claude Code shows "5-hour limit reached - resets 3pm", this tool waits for the reset and sends "continue" automatically. You come back to find your work done.
No dependencies. No workflow change. Just install and forget.
💡 Why wait out the limit at all? This tool auto-resumes Claude Code the moment you're rate-limited — but if you run overnight jobs or always-on agents, there's a way to stop hitting the wall in the first place. See how it's done →
You're in the middle of a complex task with Claude Code. After a while, you see:
You've hit your limit · resets 3pm (Europe/Dublin)
Claude stops. You have to wait hours, come back, and type "continue". If you're running long tasks overnight or while AFK, this kills your productivity.
npm i -g claude-auto-retry
claude-auto-retry install
That's it. Type claude as you always do. When the rate limit hits, the tool:
You come back to find your task completed.
You type "claude"
│
▼
Shell function (injected in .bashrc/.zshrc)
│
├─ Already in tmux? ──▶ Start background monitor
│ Launch claude with full TUI
│
└─ Not in tmux? ──▶ Create tmux session transparently
Launch claude + monitor inside
Attach (looks the same to you)
MONITOR (background, ~0% CPU):
│
├─ Polls tmux pane every 5 seconds
├─ Detects rate limit text
├─ Parses reset time from message
├─ Waits until reset + safety margin
├─ Verifies Claude is still the foreground process
└─ Sends "continue" via tmux send-keys
When you disconnect (SSH drops, close terminal, laptop sleeps), tmux keeps running. The monitor keeps waiting. When you reconnect with tmux attach, you find Claude working on your task. This is the key advantage over wrapper scripts.
claude command, same TUI, same everythingreconcile re-arms monitors for any live claude session that lost one; an optional timer (systemd --user on Linux, launchd on macOS) runs it automatically (details)429/500/502/503/504/529) and retries on a configurable exponential backoff with jitter and a cumulative-wait cap, distinct from the usage-reset path (details)--print mode support — buffers output, retries cleanly for piped/scripted usagenode_modulesThe tool acts on these real-world Claude Code renders — if you landed here after pasting one of these errors into a search engine or an AI assistant: yes, this tool automates the wait-and-retry for all of them.
| Render | Example |
|---|---|
| N-hour limit | 5-hour limit reached - resets 3pm (UTC) |
| Session limit | You've hit your session limit · resets 2am (Europe/Zurich) |
| Weekly limit | You've hit your weekly limit · resets Oct 9, 10am |
| Usage limit | Claude usage limit reached. Resets at 2pm |
| Out of extra usage | You're out of extra usage · resets 3pm |
| Try again | Please try again in 5 hours |
| Hit your limit | You've hit your limit · resets 3pm (Europe/Dublin) |
| Rate limit | Rate limit hit. Resets at 4pm |
| Live-limit companion hint | /usage-credits to finish what you're working on. |
/rate-limit-options menu — driven to "Stop and wait", never "Upgrade"What do you want to do?
❯ 1. Upgrade your plan
2. Stop and wait for limit to reset (3pm)
Handled across any menu layout (the option order varies by Claude Code version); the tool locates the cursor and the "Stop and wait" option, and refuses to press Enter if the layout is unreadable.
| Render | Example |
|---|---|
| Terminal API error (colon form) | API Error: 529 {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}} |
| 5xx family | API Error: 500 / 502 / 503 / 504 … (including bodyless renders like 503 no healthy upstream) |
| API-level 429 | API Error: Server is temporarily limiting requests (not your usage limit) · Rate limited |
API Error: <model>'s safeguards flagged this message (https://www.anthropic.com/legal/aup).
They may flag safe, normal content as well. … Claude Code can't respond to this request with <model>.
Custom patterns can be added via config for future message format changes.
Detection is chrome-aware: it looks at the live bottom of the pane, but first skips
past Claude Code's UI furniture — the input box, footer, key hints, the todo/task widget,
the status spinner, and the /usage-credits hint. So a genuine limit banner still
registers even when a tall task list or background-agent status pushes it well above the
prompt, while a banner merely quoted in scrollback (with real output below it) does not
trigger a retry.
Your own customPatterns are the exception: they are matched against the raw last-N
lines (not the chrome-skipped view), so a pattern keyed on footer text — a usage
percentage, a model name — keeps firing. You own the false-positive tradeoff for your
regexes; the built-in detection keeps the chrome-aware discipline.
Optional. Create ~/.claude-auto-retry.json:
{
"maxRetries": 5,
"pollIntervalSeconds": 5,
"marginSeconds": 60,
"fallbackWaitHours": 5,
"retryMessage": "Continue where you left off. The previous attempt was rate limited.",
"customPatterns": ["my custom pattern"]
}
| Option | Default | Description |
|---|---|---|
maxRetries |
5 |
Max retry attempts per rate-limit event |
pollIntervalSeconds |
5 |
How often to check the terminal (seconds) |
marginSeconds |
60 |
Extra wait after reset time (seconds) |
fallbackWaitHours |
5 |
Wait time if reset time can't be parsed |
retryMessage |
"Continue where..." |
Message sent to Claude on retry |
customPatterns |
[] |
Additional regex patterns to detect rate limits |
All fields optional. Invalid values fall back to defaults automatically.
Set CLAUDE_AUTO_RETRY_LAUNCH_WRAPPER to a prefix command and it's prepended to each
interactive session — useful for keeping a machine awake while Claude works, or any other
per-process wrapper:
# macOS: don't sleep while a session runs
export CLAUDE_AUTO_RETRY_LAUNCH_WRAPPER="caffeinate -i"
Generic (not macOS-specific — e.g. nice, chrt … work too). Unset or blank spawns
claude directly, unchanged.
Separate from subscription rate limits, this fork also detects sustained API
overload — Claude Code's own terminal API Error: <code> line for the retryable
set (429 / 500 / 502 / 503 / 504 / 529, or an overloaded_error JSON body) — and
retries on an exponential backoff instead of waiting for a usage reset. The two
paths never collide; usage limits always take precedence.
Sustained only. Claude Code already retries transient 5xx/529 internally with its own backoff. This feature fires only when those internal retries are exhausted and a terminal error is left in the pane. It should rarely trigger.
Terminal vs. transient. Claude Code renders an in-progress retry as the parens form
API Error (529 …) · Retrying in 5s · attempt 3/10, and the final exhausted error as the colon formAPI Error: 529 …. Detection requires the colon form and suppresses the· Retrying…/attempt n/msuffix, so the tool never interrupts Claude's own backoff.
Anchored, tail-only matching (why it won't fire on your code). Patterns are case-insensitive regexes matched against only the last 12 lines of the pane — never the full scrollback. They are anchored to Claude Code's
API Error: <code>render, so a bare503in code you're editing (res.status(503)),