cheapestinference/claude-auto-retry
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
What it solves
claude-auto-retry is a utility that prevents productivity loss when using Claude Code (the CLI tool) by automatically resuming sessions that have been paused by Anthropic's subscription rate limits, API overloads, or transient errors. It eliminates the need for users to manually monitor the terminal and type "continue" once a limit resets.
How it works
The tool operates as a shell function wrapper around the claude command. It uses tmux to keep the session running in the background, even if the user disconnects or the laptop sleeps. A background monitor polls the tmux pane every 5 seconds to detect specific error messages in the terminal output.
Depending on the message detected, it triggers different recovery paths:
- Usage Limits: Parses the reset time (timezone-aware) and sends "continue" after the reset plus a 60-second margin.
- API Overload: Implements an exponential backoff with jitter for 5xx errors or
overloaded_errorresponses. - Safeguard False Positives: Performs a bounded number of immediate re-sends to clear transient AUP flags.
- Interrupted Streams: Resumes work when a connection is dropped or the computer sleeps mid-response.
Who it’s for
Developers using the Claude Code CLI who run long-running tasks, overnight jobs, or agentic workflows that are frequently interrupted by rate limits or API instability.
Highlights
- Zero Workflow Change: Integrates as a replacement for the
claudecommand with the same TUI experience. - Tmux Integration: Automatically creates and manages
tmuxsessions to ensure persistence across SSH drops or system sleeps. - Timezone-Aware Parsing: Accurately handles IANA timezone offsets and Daylight Saving Time transitions when calculating reset times.
- Event-Driven Detection: Optional
StopFailurehook for ambiguity-free overload detection without terminal scraping. - Chrome-Aware Scraping: Intelligent terminal monitoring that ignores UI elements like the input box and status spinners to avoid false positives.
- Pure Node.js: No external
node_modulesdependencies.
Related
- Project
- Project
- Project
- Dispatch
- Project