An Effective Operating System for Long-Running Agents
Key point
Keep long sessions moving steadily forward using an initializer agent and a coding agent.
Details
For an AI agent to reliably continue work spanning hours or days, each new session needs to be able to quickly restore prior progress even when starting fresh. Context window and compaction alone weren't enough, and high-level prompts alone made it hard to fully complete a productive web app.
The core solution has two stages. In the first session, an initializer agent sets up the initial environment, and after that, a coding agent advances just one step at a time in each session, leaving traces behind for the next session.
The following elements were important in the initial environment.
- init.sh: lets the dev server start up immediately
- claude-progress.txt: a progress log recording what the agent has done
- feature list: a list of required features organized as JSON
- Initial git commit: clearly records the added files and starting state
In particular, the feature list reduced the problem of the agent trying to build the entire app at once, or mistakenly believing work was finished when it was still in progress. All features start out marked as failing, and the coding agent is guided to only ever change the passes value, preserving the structure of the JSON file.
Each subsequent session starts in the same order every time.
- Check the working directory with
pwd - Read the git log and progress file to understand recent work
- Select the highest-priority feature from the feature list that isn't yet finished
- Start the server with
init.shand verify basic functionality first
This approach keeps the agent from wasting time guessing at state. It becomes clear how far the previous session got, what remains, and what should be tested first.
Another important pillar is testing. Rather than stopping at unit tests or curl, verification with browser automation tools closer to how a human actually uses the app is needed to properly catch whether things actually work. That said, tools like Puppeteer MCP have their limits too, and easy-to-miss bugs—like a browser's default alert modal—can still slip through.
Ultimately, this approach converges on a practical set of operating principles for long-running agents: build the work foundation in the first session, advance just one feature at a time in subsequent sessions, and leave a clean state and clear records each time so the next instance can pick up right where it left off.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.