AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Nov 4, 2026, 06:00 JST

Claude Code: watchdog auto-resumes stalled jobs after 19-hour limit

Send on LINE
Claude Code: watchdog auto-resumes stalled jobs after 19-hour limit

3 Key Points

  1. What happened

    A Python watchdog checks Claude Code's session log every minute, spots the usage-limit error, waits out the reset, then sends one line asking the same conversation to continue. On 2026-11-03 it resumed an overnight job 19 hours after it hit the weekly limit, with no human involved.

  2. Why it matters

    Teams running Claude Code unattended in tmux no longer lose hours after a limit lifts, but the watchdog has to skip look-alike errors such as context limits or it will retry forever — and it caps itself at 3 attempts.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The setup exists because unattended sessions fail at the worst time. The developer's Claude Code runs in tmux on a home PC with two jobs: orders arriving by voice from a commuter, and a scheduled run every night at 2am. When the 5-hour or weekly quota runs out, Claude Code stops with an error, and with nobody at the screen the session could sit for hours after the limit lifted.

The interesting part is how carefully the watchdog avoids making things worse. It filters out errors that look similar but will not fix themselves, such as a context limit or a budget limit — waiting on those and resending would just repeat the same error. It reads the reset time from the error text, then double-checks the same usage figures shown by Claude Code's /usage and waits until every window is below 100%. Before sending, it re-reads the log and the screen in case the user typed something from their phone in the meantime, and it records the send before sending so a crash cannot cause a duplicate.

On the day it ran, the weekly limit hit right after the 2am scheduled job; the watchdog asked to continue 43 seconds after the limit reset at 21:00, and the stalled job was finished without anyone touching it. The developer notes the exact error wording may change between Claude Code versions, so the pattern matching may need updating — and when it does not match, the design falls back to doing nothing rather than something risky.

FAQ
How does the watchdog know Claude Code has stopped?
Claude Code writes its conversation to a .jsonl file, and when it hits a limit the last line becomes an API error message. The watchdog reads only the last 256KB of the newest file and checks that last conversation line, so it stays light on large logs.
Why not just send "continue" right away?
Because a plain "continue" can repeat work that was already done, such as a push or a report. The message tells Claude Code to check the current file, commit and post state first and not repeat finished commits, pushes or reports.
What does it do if the limit menu appears?
When Claude Code shows a limit menu, the top option is a plan-change option, so sending "continue" plus Enter could select it. The watchdog just presses Escape to close the menu and does not choose anything.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleDeepMind staff push to scrap lifetime non-disparagement clauses