Skip to content
Cameron Mills

All projects

Keeping long AI agent runs alive through usage limits and full contexts

Steward, the managed agent runner

Part of Life Tracker

The runner behind every unattended Claude Code job. It pauses a run before the usage limit, resumes the same conversation after the reset, moves a run that has grown too long into a fresh session, and feeds it all from a timed work queue.

Code on GitHub

The launch film

The film illustrates a configured overnight run. Its timings and thresholds are illustrative.

How it works

How a queued job runs unattended through usage limits and long contexts. Select a layer to open it.

Problem

An unattended Claude Code run can hit the usage limit mid-task or be cut off by a sleeping Mac. It can also run so long that every turn re-sends a huge conversation and the cost keeps climbing.

Approach

Never lose the conversation, and always keep a written checkpoint. Every run is told it may be paused at any moment and must keep a checkpoint written for a future self with no memory of the work.

Architecture

Every unattended run goes through one manager. Each run gets its own folder with its events, a readable log and its checkpoint, and any abnormal end leaves a crash report with the exact command to resume. Each kind of ending (finished, paused, limited, timed out, interrupted) is recorded distinctly.

Work arrives through a timed queue of new tasks, resumes and re-runs. Resumes go first, so a paused build finishes before new work starts. An always-on scheduler runs whatever is due and reports that it is alive. The /build pipeline launches each of its stages through this same queue. An entry waiting on something that nothing can produce any more expires after 48 hours, and I get one card to re-queue it. A brief that asks for a git review runs under a separate fourth role, which is the only one allowed to write to git.

What I built

  • Pausing at the limit. Shortly before the usage window runs out, the run is stopped and a resume is queued for just after the reset, bringing the whole conversation back. The resume points the agent at its checkpoint rather than having it re-read everything.
  • Fresh sessions for long runs. Once a conversation gets long enough to be expensive, the session ends at a safe point and a fresh one carries on from the brief and the checkpoint alone.
  • Liveness and limits. A run counts as alive if anything shows it is still working, a run that stops writing its checkpoint gets a single nudge, and every run has a time limit, which can be lifted while keeping the pause at the usage limit.

Portable preview

Version 0.2.0 is a public preview. It adds Claude Code, Codex and local-model adapters on Windows, macOS and Linux. A real Codex task passed, and a real local-model completion is still unverified. Automatic context rotation, checkpoint nudges and model fallback remain Claude-only.

The launch film illustrates a configured overnight run, so its timings and thresholds are illustrative.

Results

One build was paused with the usage window almost exhausted, resumed hours later and finished. Moving long runs into fresh sessions was simulated to cut agent spend by about 12%. It was first tested only on synthetic data, and a live planning stage has since moved into a fresh session and finished there.

Steward, the managed agent runner: results against their thresholds
CheckExpected or thresholdActualResult
A wound-down run resumes and finishesResumed after the reset with the conversation intactPaused near the limit, resumed hours later and finishedPass
Context rotation on a live runMove to a fresh session and carry onFinished in its second sessionPass
The two mechanisms checked on live runs, after the first tests on synthetic events.

What didn't work

Several agents running in parallel once used up the whole usage window in minutes, so each extra running agent now brings the pause forward. Runs were marked abandoned while still working, because the sandbox hid them from the check. Now a run is only closed on positive evidence that it has stopped. Moving to a fresh session sometimes cut off work in flight, such as a test run, so the checkpoint now has to carry decisions, file paths and the commands to check the work.

Stack

  • Python
  • Bash
  • launchd
  • Claude Code

How these figures are sourced

The outcome figure is agent-reported: it is taken from a test log or report written by the agents that built and ran the system. The status was read from the code repository at commit c8e90f7 on 1 Oct 2026. Every figure and claim on this page is tied to a source file or a CV line in the site's content.