LeverageAI Field Note
Handover Notes for Robots
The overnight agent that gets stuck and doesn’t know it — and the shift-operator discipline that keeps multi-hour jobs running until morning.
Scott Farrell · LeverageAI
I kick off a long-running Claude Code job — not always coding, often coding-adjacent: an ETL load, an ingest pipeline, a multi-step data import with subtasks and subagents stacked underneath. It is going to take many hours. I leave it overnight. When I come back, it has stalled. Worse: it doesn’t know it’s stuck. It makes mistakes in its own monitors. It sits politely on a hung child process, or loops the same subtask, or reports progress that hasn’t moved since midnight. Temporal blindness is the failure mode. The model cannot feel time pass inside a session the way a human operator can glance at a wall clock and know the batch should have finished two hours ago.
In Breaking the 1-Hour Barrier I wrote about agents that build understanding over ten-plus hours. That piece promised the stretch. This one is the operational discipline that actually delivers it — not a fancier orchestration harness, but handover-note habits borrowed from human ops shifts.
The reframe that made it work landed early and stayed put. I stopped treating the agent like a clever program that should self-heal, and started treating it like a colleague on a night shift:
You’re the operator who just came on shift. Make sure it’s still running okay. Leave some notes for the next person coming on shift to check it.
That sentence is not flavour text. It is the whole pattern. What follows is how I operationalised it — six mechanisms that stack into one overnight discipline — and the two epiphanies that explain why a framing that sounds soft produces hard completion rates.
Persistence outside the model
The first move is almost embarrassingly simple: externalise the heartbeat. A cron every thirty minutes wakes the agent and asks it to check on itself. The scheduler holds persistence, not the model. That is the same axis I wrote about in Designing Loops, Not Prompts — the deterministic component is the trustworthy one; the model is the worker you wake, not the clock you trust. I am not re-litigating cron-as-orchestrator here. The heartbeat is the substrate. The discipline sits on top of it.
What the agent does when it wakes is write a shift log: an append-only journal of where the job is up to. Each check-in adds an entry. The next check-in reads the previous ones. Stuck-detection becomes a text-diffing task. The model cannot feel that three hours have passed with no forward progress. It can notice that its last three entries say the same thing. That conversion is the clever move — take a capability the model lacks (temporal self-awareness) and route the problem through a capability it is excellent at (comparing text). It is Text Is the Model’s Home Turf applied to self-monitoring: put the hard problem on the model’s home ground.
Subagents get their own rule. When the main process spawns them, I tell it that they should write status back to the main agent now and again — not only return a final verdict when they finish or die. Evidence-of-progress beats an eventual yes-or-no. I have called the outward version of this Witness Not Oracle; pointed inward, it is a backchannel so the parent is not blind while children work. The main agent can see movement (or the absence of it) before the thirty-minute alarm goes off.
How much is the night shift allowed to touch?
Heartbeats and logs keep the process honest. They do not decide what the operator is allowed to do when something is wrong. So I give graduated authority: tiered permissions for the overnight shift. Sometimes restart-only — kill the hung step and relaunch it. Sometimes debug-and-fix — inspect the failure, patch the code, continue. Sometimes full rewrite of a broken step. The tiers are deliberate, and they map onto the same autonomy ladder I talk about under the Enterprise AI Spectrum, compressed into a single unattended job.
Here is the empirical finding I want written down every time it happens: widening the agent’s authority increased completion rates, and the code changes were mostly good. I review in the morning. Occasionally I dislike a fix. More often the agent unblocked itself with something I would have written anyway. If you only allow restarts, you get clean restarts of broken code. If you allow it to fix things, more jobs finish. That trade-off is not theoretical. It is the difference between an overnight that dies at step four and one that greets you with a done log at 7am.
Quality still belongs to someone. I put it on the main agent: completeness and quality are its responsibility, and it must not describe the quality gates to the subagents. If you tell the children exactly how they will be graded, they train to the test. That is the Hidden Gates pattern live in production — the same general agent principle that you need strong validation at all. Prefer deterministic checks (lint, tests, row counts, schema assertions) when you can get them. When you cannot, AI-checking of quality gates is sometimes nearly as good. The point is ownership and opacity: the parent holds the bar; the children do not get the answer key.
Why thirty minutes — and what it is not
The half-hour cadence was chosen so the heartbeat rides the prompt cache. On a Claude subscription, Claude Code requests the one-hour TTL automatically for the main conversation, and the cache refreshes free on each use — so a thirty-minute check-in keeps a one-hour cache warm at read prices.1 Cache writes cost a premium (about 1.25× for the short TTL tier, about 2× for the one-hour tier); cache reads come in around 0.1× standard input.2 Where that economics holds, the check-in is nearly free compared with walking back into a cold session the next morning and paying full freight for a long prefix.
Two honest caveats, because this is not primarily a cost trick. First: subagents use the five-minute TTL even on a subscription, so their caches die between check-ins regardless.1 Second: there was a documented regression where the default TTL silently dropped from one hour to five minutes around early March 2026,3 with an April 2026 update adding ENABLE_PROMPT_CACHING_1H to restore the longer window.4 You can verify your actual TTL from the session JSONL — each assistant message breaks out ephemeral_5m versus ephemeral_1h cache tokens. If you are on five-minute TTL, the thirty-minute cadence still buys reliability; it just does not buy cache savings. Frame the rhythm as cache-friendly where it applies. Say plainly that the real payoff is completion: the job is still running when you open the laptop.
You’re not prompting behaviour. You’re priming a genre.
Here is the payoff — the part that made me stop and write this down instead of treating the pattern as a personal hack.
Telling the agent you’re the operator who just came on shift; leave notes for the next person is not decoration. It imports an entire human genre the model absorbed in training: SRE handover notes, ops runbooks, incident discipline, the terse culture of people who hand a live system to the next pair of eyes. The genre carries its procedures with it. You’re not prompting behaviour. You’re priming a genre.
That explains why it does a super good job of keeping the process running. Handover notes have a built-in audience — the next operator — and text written for an audience is more structured than text written as a scratchpad. The agent writes differently when it believes someone else will read the log at the next shift change. Status becomes claims. Blockers become named. “Still on step 4” becomes “still on step 4; source has >10k rows; last attempt hung on transform; restarting with smaller batch.” The audience does half the work. Genre priming is generalisable beyond overnight agents: whenever you need structured operational text from a model, give it a human genre with a built-in reader, not a blank journal.
The second epiphany is quieter and almost as useful. The shift log is a proto-wiki page. Right now, in my default setup, it evaporates when the job ends. That is a waste. File it back. Incidents become reusable claims — ingestion stalls at step 4 when the source has more than ten thousand rows — and the next overnight job starts with a past. That is Give Your Agent a Past and File Back the Walk closing the loop on operations, not only on knowledge work. The log stops being disposable telemetry and becomes institutional memory for the next run.
What ships
Three pieces of shippable IP fall out of this once you see the whole architecture.
The barbell. There is a real tension. Cache economics favour the same session doing the check-in — warm prefix, cheap reads, continuous narrative. Fresh eyes favour a separate supervisor with no sunk cost in the story (“I’m sure it’s nearly done”). Resolve it with a barbell: cheap same-session heartbeats every thirty minutes, plus one fresh-context senior review at longer intervals that reads only the shift log. The cheap loop keeps the patient alive. The expensive glance is not contaminated by the patient’s own confidence.
The dead-man’s switch. Nothing watches the watcher. If cron dies, or the session dies, silence looks like success. Add a dumb external check: alert if the shift log’s mtime goes stale. Zero AI. A file timestamp and a pager. Completes the architecture without adding another agent that can also get stuck.
The graduated-authority charter. The one-pager that says what the overnight operator may restart, what it may debug and fix, and what it may rewrite is Governance-as-Code at the job level. It is exactly the artefact a regulated client needs before they will let an agent run unattended overnight. Not a policy deck. A charter with teeth, tied to a specific job class, reviewed in the morning like any other change set.
The night shift that works. External heartbeat. Append-only shift log. Subagent backchannel. Graduated authority. Hidden quality gates. Cache-aligned cadence where the TTL allows it. Genre-primed voice. File the walk back. Barbell the supervision. Watch the watcher with something that is not a model.
None of that is a bigger harness. It is handover-note discipline for a robot that never sleeps — and still needs the next person coming on shift.
I used to treat long-running agents as something that should simply not get stuck. They will get stuck. The useful question is whether the shift leaves notes clear enough that the next operator — human or agent — can see it, fix it, and hand the job forward. That is not orchestration theatre. That is ops. And ops is what makes a ten-hour agent a finished job instead of an expensive story about almost.
References
- [1] Claude Code Docs. “Prompt caching.” https://code.claude.com/docs/en/prompt-caching — “On a Claude subscription, Claude Code requests the one-hour TTL automatically… Subagents use the five-minute TTL even on a subscription, since the automatic one-hour TTL applies to the main conversation.”
- [2] Anthropic. “Prompt caching.” https://platform.claude.com/docs/en/build-with-claude/prompt-caching — “Cache writes (the first time Claude processes and stores the context) cost 25% more than standard input tokens. Cache reads (every subsequent hit) cost about 10% of the standard input token price.”
- [3] GitHub issue #46829 (anthropics/claude-code). “Cache TTL appears to have silently regressed from 1h to 5m around early March 2026.” https://github.com/anthropics/claude-code/issues/46829 — “Analysis of raw Claude Code session JSONL files spanning Jan 11 – Apr 11, 2026 shows that Anthropic appears to have silently changed the prompt cache TTL default from 1 hour to 5 minutes sometime in early March 2026.”
- [4] Claudcod. “Claude Code Prompt Caching: TTL Guide.” https://claudcod.com/blog/claude-code-prompt-caching/ — “The April 2026 Claude Code update introduced ENABLE_PROMPT_CACHING_1H, which gives you back the longer window.”
Discover more from Leverage AI for your business
Subscribe to get the latest posts sent to your email.
Previous Post
The "This Answer Is Wrong" Button: Flight Recorders for Organisational AI