Running a 2-day job through Claude Code's usage limits
Claude Code learned to auto-continue after a usage limit resets, and it's a genuinely nice feature. But it stops after three resets in a row, and on the desktop app it only covers the 5-hour limit, not the weekly one.
I had a job that ran longer than that, so I wrote a small skill to carry it the rest of the way. Here's the problem, the mechanism, and the one thing that makes it cost nothing.
The problem
I was running a long batch task in the Claude desktop app, the kind that chews through a usage window and keeps going. Claude Code (v2.1.234+) will now wait at the limit and pick the task back up once it resets, which is great... until the third resume in a row, where it stops and asks you to step in.
And the desktop "Auto-continue when limits reset" checkbox only covers the 5-hour session limit. The weekly card doesn't offer it at all. For a task that spans five, eight, a dozen windows across a couple of days, that's still babysitting.
The insight: waiting is free
The usage limit counts model inference, the tokens you actually process, not wall-clock time. So a session that's just sitting there asleep burns nothing against your quota.
If you can get the session to pause and wait for the reset instead of grinding into the wall, the wait costs you nothing and the work just picks up on the next window.
The mechanism
Marathon is a skill (a behaviour protocol the model follows) plus one tiny shell script. The loop goes:
- Do a chunk of the task.
- Check usage at checkpoints, both the 5-hour and the weekly windows.
- Once you're past 90%, poll after every chunk so it never overshoots.
- At 95%, kick off a background timer that sleeps until the window's reset plus 5 minutes of drift, and stop working. Zero usage while it sleeps.
- When the timer exits, the session wakes back up with full context, double-checks that the window really did reset, and carries on.
- Repeat, with no cap on how many windows it spans.
The whole waiter, essentially:
reset_epoch=$(date -j -u -f "%Y-%m-%dT%H:%M:%S" "${reset_iso%.*}" +%s)
secs=$(( reset_epoch - $(date -u +%s) + 300 ))
sleep "$secs"
echo "window reset, resume"
When NOT to use it
If your task fits inside about three resets, Claude Code's built-in auto-continue already has you covered, so use that. Marathon is for the multi-day runs that outlast the 3-continuation cap, or ones that are going to hit the weekly limit.
Get it
MIT, no telemetry, two small files: https://github.com/cybersgk/claude-marathon-skill
git clone https://github.com/cybersgk/claude-marathon-skill.git
cp -R claude-marathon-skill/skills/marathon ~/.claude/skills/marathon
Then tell Claude: marathon this: <your long task>
Comments
No comments yet. Start the discussion.