Unattended all-day agent loop
Unattended all-day agent loop
One-line summary: Keep a bot working all day by waking on a clock or event, reading a small durable queue/state file, doing one atomic unit in a fresh isolated session, writing the result to git, then exiting — not by keeping one session alive.
Vintage: 2026-08. Practitioner blogs April 2026; Claude Code Routines announced 2026-04-14; Cherny maintenance experiment and auto-mode default recorded 2026-08. Capability claims are a snapshot.
The insight
The inner loop (perceive → reason → act until a task ends) is well-described encyclopedia material. All-day autonomy is an outer loop around it. 2026 practitioner writeups and vendor docs converge on the same outer loop: wake → read durable state → one isolated unit of work → write artifacts → sleep. The scheduler (cron, OpenClaw heartbeat, Claude Code cloud routine, Cursor Cloud Agent trigger) is interchangeable. The loop that fails is the one that tries to remember the day inside one context window.
This is complementary to parallel-claude-workflow (a human tending a fleet of interactive sessions) and plan-then-execute-coding (steer the plan, then auto-accept). Those still assume someone is jumping between tabs. The unattended pattern assumes nobody is.
The chain
Immortal-session / in-context memory decays within about an hour → durable filesystem or queue state plus isolated wakes → reviewable git/PR artifacts keep a human at the merge gate → all-day progress without babysitting. Canonical: immortal-session-decay-to-unattended-queue-loop.
Evidence
- From 2026-08-18-autoresearch-effective-all-day-bot-loops: "wake on a clock or event, read a small durable state file, do one atomic unit of work in a fresh isolated session, write the result back to files/git, then exit."
- From 2026-08-18-autoresearch-effective-all-day-bot-loops: DEV Community walkthrough —
claude -p+state.md+ cron;state.mdmust stay under 4 KB because it is injected every iteration; overlapping ticks need a lock. - From 2026-08-18-autoresearch-effective-all-day-bot-loops: SitePoint's 13-day recipe — atomic task files, committed
CLAUDE.md, isolated CLI sessions, tests as a gate, commit after every task so rollback is onegit revert. - From 2026-08-18-autoresearch-effective-all-day-bot-loops: Sam French (2026-04-08) — SQS long-poll → headless
claude -p→ git push → email; "withoutTODO.mdthe agent spins in circles"; "no git push = nothing happened"; exponential backoff after a 47-failure burst. - From 2026-08-18-autoresearch-effective-all-day-bot-loops: Claude Code Routines (research preview, 2026-04-14) — saved prompt + repo + connectors on Anthropic cloud; schedule / API / GitHub triggers; each fire is a new session that clones the default branch; no mid-run permission prompts; Pro 5 / Max 15 / Team–Enterprise 25 routine runs per day.
- From 2026-08-18-autoresearch-effective-all-day-bot-loops: Cursor Cloud Agent best practices — environment first, then secrets/OIDC, egress,
agents.md+ skills for a "smart but low-context" developer. That is inner-run reliability; all-day coverage still needs an outer trigger. - From 2026-08-18-autoresearch-effective-all-day-bot-loops: openclaw heartbeat — every N minutes read
HEARTBEAT.md; usually replyHEARTBEAT_OK(cheap no-op). Default Opus + 30 min estimated ~$15/day; Haiku + 60 min + quiet hours ~$0.60/day. - From 2026-08-18-autoresearch-effective-all-day-bot-loops: Anthropic "Building effective agents" — workflows are LLMs on predefined code paths; agents dynamically direct their own process. Default to simplest; agents cost more and can compound errors. Applied here: the scheduler should stay a workflow; the unit of work can be an agent.
- From 2026-08-18-autoresearch-effective-all-day-bot-loops: boris-cherny (2026-08-13) Slack
proj-claude-maintains-apps+ daily routines opened 388 PRs / 180 merged after Claude Code Review + human review.
Design implications
- Durable state is the queue + wiki + git, not the session. Hot state is the next pending row; cold state is already-ingested sources and
CLAUDE.md/agents.md(claude-md-team-knowledge-base). - One unit per wake. A research queue that drains one entry per invocation is the same rule as French/SitePoint, not a lesser version.
- Heartbeat is for cheap "is there anything?" checks. Burning a frontier model every 15 minutes is the cost failure mode openclaw documents.
- Human review stays at the merge/ingest gate (Cherny's 180/388 still required a human).
- Do not replace an existing coded drain (
queue-next→ promote → ingest →queue-done) with a new always-on app. The cited systems are a scheduler + a queue file + an isolated agent + a review surface.
Contradictions / tensions
- Pattern vs product. Routines, Cursor Cloud Agents, OpenClaw heartbeat, and a cron script implement the same outer loop. No bake-off on a research-wiki workload. "Best" is not a SKU.
- Always-on vs drain. Heartbeat optimizes for proactive notify. Routines / SQS / cron-drain optimize for "do the next unit, then stop." For a promote+ingest research queue the drain fits the architecture; that is not a measured comparison.
- Quota vs "throughout the day." Routine daily caps plus subscription usage mean a Max-plan Claude Code routine cannot fire every hour all day without overage. Desktop auto-continue only resumes after reset.
- Linear Loops (July 2026 team-level scheduled Linear Agent) is mentioned in search results; official pages timed out this pass — unconfirmed.
Open questions
- How much workspace memory should a research bot rewrite each wake without the optimism-compounding DEV warned about ("great progress today" becoming next-loop belief)?
- At what queue depth does one-unit-per-wake fall behind a weekday of arrivals?