Stop losing your late-night Claude sessions to rate limits.
claude-overtime does three things:
- Warns you at ~95% of your hourly token limit — a desktop notification + terminal banner so you always see it coming.
/overtime&/overtime-recursivecommands — captures your current task context, spawns a manager agent that waits for the rate limit to reset, then actively continues your work unattended. The recursive variant auto-retries on subsequent rate limits.- Rate limit tracker — a status bar showing your current usage % right in the Claude Code CLI.
npm install -g claude-overtimepostinstall automatically runs claude-overtime install, which:
- Copies
/overtimeand/overtime-recursiveslash commands to~/.claude/commands/ - Installs the rate-limit warning hook to
~/.claude/hooks/ - Installs the status line script for usage % display
- Registers the
Stophook and status line in~/.claude/settings.json
Or install manually:
claude-overtime installRun this in any Claude Code session when you're about to (or have just) hit your rate limit:
/overtime
Defaults to resuming in 5 hours. Claude will:
- Capture your current task context (reads the active plan file, or summarizes the conversation)
- Grant temporary project-scoped permissions (so it doesn't stall on approval prompts overnight)
- Ask you to choose an abort-on-failure behavior (stop, warn-and-continue, or cleanup-and-exit)
- Snapshot the current task as a drift anchor
- Write session rules to
.claude/overtime-rules.md - Keep your machine awake
- Pick up the conversation exactly where it left off — following the session rules automatically
You can specify a custom delay:
/overtime 1h
/overtime 90m
/overtime 2h30m
Supported formats: Nh (hours), Nm (minutes), NhMm (combined), Ns (seconds, useful for testing), plain number = minutes.
Same as /overtime, but if the manager agent hits another rate limit during work, it automatically waits for the reset and retries — up to 5 times. Use this for long tasks that might span multiple rate limit windows.
/overtime-recursive
/overtime-recursive 1h
After installation, your Claude Code status bar shows your current rate limit usage:
OT: 72% [============== ]
This updates automatically after each assistant response. Uses Claude Code's built-in rate_limits.five_hour.used_percentage data when available, falling back to the token tracking hook.
The warning fires automatically — you don't need to do anything. When you approach your limit you'll see:
╔══════════════════════════════════════════════════════╗
║ ⚠️ claude-overtime: rate limit ~95% reached ║
║ Run /overtime to continue your session overnight. ║
╚══════════════════════════════════════════════════════╝
Plus a desktop notification (macOS: Notification Center, Linux: notify-send).
Set a custom warning threshold (default: 90,000 tokens ≈ 95% of a typical hourly limit):
export CLAUDE_OVERTIME_WARN_AT=80000Add this to your .zshrc / .bashrc to persist it.
| Component | What it does |
|---|---|
hooks/rate-limit-warn.sh |
Runs on every Claude Stop event, tracks cumulative token usage for the session, fires warning at threshold |
hooks/overtime-statusline.sh |
Status line script showing rate limit usage % in the CLI footer |
commands/overtime.md |
The /overtime slash command — grants permissions, writes session rules, starts caffeinate, and loops |
commands/overtime-recursive.md |
The /overtime-recursive slash command — like /overtime but auto-retries on subsequent rate limits |
bin/claude-overtime.js |
CLI for install / uninstall / status |
Token usage is accumulated in ~/.claude/overtime-token-state.json and resets each new session.
When /overtime fires, it doesn't just set a timer and hope. It:
- Captures task context — reads the active plan file (
~/.claude/plans/*.md) or summarizes the current conversation into 3-5 bullet points - Spawns a manager agent after the delay — a focused Agent subagent that receives the full task context and systematically works through the remaining tasks
- The manager does the work — reads files, edits code, runs tests, and spawns worker subagents for complex sub-tasks
- Cleans up when done — kills caffeinate, removes temporary permissions
When you run /overtime, Claude writes a temporary .claude/settings.local.json in the project with broad tool permissions (Bash(*), Edit, Write, etc.) so the resumed session can work without prompts.
Safety rails:
- Destructive commands are still denied (
rm -rf /,git reset --hard,git clean -f) - All git push commands are blocked — unreviewed overnight code never reaches remote
- Claude is scoped to only finish the in-progress task — no new work, no changes outside the project
- Permissions are automatically removed when the task completes
- If the file already existed, only the
permissionskey is removed on cleanup — your other settings are preserved
When you activate /overtime, Claude writes .claude/overtime-rules.md with 10 behavioral rules the resumed session must follow:
| Rule | What it enforces |
|---|---|
| Git checkpoint | Commits all uncommitted work before writing any new code |
| Incremental commits | Commits after each logical unit — never batches 3+ files |
| Final commit | Clean commit when all work is done |
| Session log | Appends structured entries to .claude/overtime-log.md (gitignored) after each module |
| Architecture consistency | Reads existing files first, matches their patterns (async style, exports, error handling) |
| Structural integrity | Every function handles null/empty/error cases — no dead code or placeholder TODOs |
| Dependency audit | Verifies packages exist in the manifest before using them |
| Flight proxy | Optional — routes HTTP through Flight proxy when FLIGHT_PROXY=true |
| Context drift prevention | Every 3 commits, re-checks the task snapshot to stay on-scope |
| Git push blocked | All pushes denied — you review and push manually in the morning |
The rules file also contains a task snapshot (2-3 sentence summary of what you were working on) that acts as the drift anchor, and your chosen abort behavior for handling checkpoint failures.
claude-overtime uninstallRemoves the commands, hooks, status line, and settings.json entries cleanly.
- Claude Code CLI
- Node.js 18+
- macOS (uses
caffeinate) or Linux withsystemd-inhibit
- It's 11pm. You're deep in a feature.
- You glance at the status bar:
OT: 87%— getting close. - You see the
⚠️ 95%warning. - You type
/overtime(or/overtime-recursivefor a long task, or/overtime 1hif you know your limit). - Claude asks your abort preference, snapshots the task, and writes session rules.
- Claude starts
caffeinateand sets a timer. - You go to sleep.
- Timer fires. Claude reads
.claude/overtime-rules.md, checkpoints git, and resumes. - It commits incrementally, logs progress to
.claude/overtime-log.md, and checks for scope drift every 3 commits. - You wake up in the morning. The feature is done.
caffeinatehas been killed. You review the log and push when ready.