Source: https://www.orchestro.org/blog/run-coding-agents-unattended
Updated: 2026-11-24

GUIDE · LONG RUNS

# How to keep Claude Code and Codex working for days without losing the thread

By Daniele Pelleri, building Orchestro at Aetha · Published 2026-11-24

**Short answer:** A single agent session is not built to run for days. A multi-day run is a loop around many bounded sessions: an awake host, a schedule, authenticated CLIs, available quota, and a project history that outlives each session.

## A session is not a multi-day run

Claude Code and Codex work in sessions. A session has a context, a budget of model calls and an end. Leaving one session open overnight does not make it a multi-day run: when it stops, hits a limit or loses its terminal, whatever it knew about the task stops with it. Work that lasts several days is a sequence of bounded sessions, each started for a reason and each leaving the project in a state the next one can read.

## What a while loop does not give you

The shortest way to leave an agent unattended is a shell loop that starts the CLI again every time it exits. It keeps the agent busy. Four things it does not do, and an unattended run needs all of them:

*   **Durable state.** The loop restarts the agent, not the work. Unless the task, what was tried and the next action are stored outside the session, each iteration starts from what it can rediscover.
*   **Work selection.** A loop runs the same prompt again. Deciding which eligible work comes next, and within which permissions, is a separate job: [how Orchestro works](https://www.orchestro.org/how-it-works) shows it from the owner’s side.
*   **Recovery.** When a run is interrupted, something has to notice and resume the same job from a durable checkpoint instead of starting over. The [simulation](https://www.orchestro.org/live/demo) plays this step with sample data.
*   **Independent verification.** Inside the loop, the agent that did the work also says it is finished. A check that runs outside that session is what makes “done” mean done.

## What a multi-day run needs

These are the same requirements Orchestro states in its [quickstart](https://www.orchestro.org/docs/quickstart) and FAQ for a configured watch process that keeps checking and launching authorized work across days:

*   **An awake host.** Execution runs on the project’s own Mac or server. If the machine sleeps or shuts down, nothing runs until it is back.
*   **A project schedule.** Something has to decide when the next session starts: a schedule, not a person reopening a terminal.
*   **Authenticated CLIs.** Each coding agent CLI must already be signed in on that host. An expired login is a stop, not a retry.
*   **Available quota.** The CLI workflow uses your coding-agent subscriptions. Model calls consume subscription quota and the provider’s terms and limits apply; this is not unlimited model execution.

## Keep the thread outside the chat

The thread a long run must not lose is not the conversation: it is the state of the work. Store it where every new session can read it:

1.  **The work item and its acceptance.** What is being done and how you will know it is done, written before the first session starts.
2.  **What was tried.** Rejected revisions, failed checks and their causes, so a new session does not repeat the same fix.
3.  **The next action.** One concrete step, so a session that starts at 3 a.m. does not spend its quota rediscovering where things stand.
4.  **Progress separate from a heartbeat.** “The process is alive” and “the work moved” are different facts. Record the last durable progress, not just the last ping.

## Let a separate check decide what is done

Over several days, an agent that both does the work and declares it finished accumulates unverified claims. Have a separate check run on the exact revision before a task closes. Our guide on [agents that say “done” while tests fail](https://www.orchestro.org/blog/ai-coding-agent-says-done-but-tests-fail) covers this step.

## The limits that remain

*   Individual worker runs still have limits, whatever the loop around them does.
*   When the host is off or a provider is unavailable, the loop does not run.
*   When quota runs out, work waits until it is available again.
*   Missing permission, a missing credential or missing evidence can require the owner. A long run pauses on those; it does not grant itself access.

## How Orchestro handles it

Orchestro coordinates your existing coding agents around a project goal. Codex and Claude Code have repair-worker adapters (see [supported agents](https://www.orchestro.org/docs/agents)). A configured local loop selects and executes authorized work while its host and providers are available, keeps the work history across sessions, and shows last durable progress separately from a heartbeat. No activity is invented when the record is missing or stale. Start with the [quickstart](https://www.orchestro.org/docs/quickstart) to see what a scheduled operation needs, read [how Orchestro works](https://www.orchestro.org/how-it-works) for the full loop, or try the [64-second simulation](https://www.orchestro.org/live/demo), no signup needed.

[Apply for early access](https://www.orchestro.org/early-access)

[All articles](https://www.orchestro.org/blog)
