Skip to content

Conversation

@arpit551
Copy link

@arpit551 arpit551 commented Jan 5, 2026

Summary

  • Add automatic rate limit detection and wait to Ralph Wiggum loops
  • Enable truly autonomous long-running tasks spanning multiple 5-hour blocks

What this PR does

When running long Ralph loops, hitting Claude's rate limit would cause the loop to fail. This enhancement adds:

  • Rate limit detection by checking transcript for common error patterns
    (rate.limit, rate_limit, too.many.requests, 429, quota.exceeded, usage.limit)
  • Integration with ccusage to determine remaining time until block reset
  • Automatic wait and resume functionality

When a rate limit is detected:

  1. The stop hook checks the transcript for rate limit error patterns
  2. Uses ccusage (if available) to get accurate remaining time
  3. Displays a message showing wait time and resume time
  4. Sleeps until the block resets (with 60s buffer)
  5. Continues the Ralph loop automatically

Test plan

  • Run /ralph-loop with a long task
  • Verify rate limit detection works when quota exhausted
  • Verify ccusage integration provides accurate wait times
  • Verify loop resumes after rate limit reset

🤖 Generated with Claude Code

arpit and others added 2 commits January 6, 2026 03:49
When running long Ralph loops, hitting Claude's rate limit would cause
the loop to fail. This enhancement adds:

- Rate limit detection by checking transcript for common error patterns
  (rate.limit, rate_limit, too.many.requests, 429, quota.exceeded, usage.limit)
- Integration with ccusage to determine remaining time until block reset
- Automatic wait and resume functionality

When a rate limit is detected:
1. The stop hook checks the transcript for rate limit error patterns
2. Uses ccusage (if available) to get accurate remaining time
3. Displays a message showing wait time and resume time
4. Sleeps until the block resets (with 60s buffer)
5. Continues the Ralph loop automatically

This enables truly autonomous long-running tasks that can span multiple
5-hour blocks without manual intervention.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Instead of depending on ccusage npm package, now parses the reset time
directly from the rate limit error message pattern "resets X:XXam/pm"
(e.g., "resets 6:30am").

This approach:
- Removes external dependency on ccusage
- Uses the exact reset time shown to the user
- More reliable and simpler

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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