Long-Running Agent Harness for Multi-Context Software Development

anthropic · Tech · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Long-running autonomous software development agents

Anthropic needed coding agents to make reliable progress on complex software projects across multiple context windows without losing memory, duplicating work, or declaring unfinished applications complete.

Constraints:

Architecture

Anthropic built a two-phase harness for long-running coding agents. An initializer agent creates durable environment artifacts such as init.sh, a progress log, git history, and a JSON feature list with testable requirements. Subsequent coding-agent sessions orient themselves by reading those artifacts, choose one incomplete feature, run the app and a smoke test, implement incrementally, validate with Puppeteer browser automation, commit progress, and update the handoff log.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  Initializer["Initializer agent"] --> Feature_JSON["Feature list JSON"]
  Initializer --> Progress_log["Progress log"]
  Initializer --> Git_history["Git history"]
  Initializer --> Init_script["init.sh"]
  Feature_JSON --> Coding_agent["Coding agent"]
  Progress_log --> Coding_agent
  Git_history --> Coding_agent
  Init_script --> Coding_agent
  Init_script --> Dev_server["Development server"]
  Coding_agent --> Codebase["Codebase"]
  Codebase --> Git_history
  Codebase --> Dev_server
  Coding_agent --> Puppeteer["Puppeteer MCP"]
  Puppeteer --> Dev_server
  Coding_agent --> Progress_log
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Initializer agent First-session prompt mode that sets up the durable project environment and work-tracking artifacts. Feature list JSON, Progress log, Git history, init.sh
Feature list JSON Structured backlog of end-to-end feature descriptions and pass/fail status for the entire project. Initializer agent, Coding agent
Progress log Persistent session-to-session record of completed work and handoff notes. Initializer agent, Coding agent
Git history Version-control record used for orientation, descriptive commits, reverts, and recovery to working states. Initializer agent, Coding agent, Codebase
init.sh Startup script that tells each session how to run the development server. Initializer agent, Coding agent, Development server
Coding agent Subsequent-session prompt mode that orients itself, selects one feature, implements incrementally, tests, and writes handoff artifacts. Feature list JSON, Progress log, Git history, init.sh, Codebase, Puppeteer MCP
Development server Runnable local application instance used for smoke tests and feature validation. init.sh, Puppeteer MCP, Codebase
Puppeteer MCP Browser automation tool that lets the agent test web features as a user would and capture screenshots. Coding agent, Development server
Codebase The application under development, kept in a mergeable clean state between sessions. Coding agent, Git history, Development server

Data flow

The user prompt enters the initializer session, which expands it into a structured feature backlog and environment scripts. Later coding sessions read git logs, progress notes, and the feature list, start the development server through init.sh, run basic end-to-end checks, implement one feature, use browser automation to validate behavior, and persist a commit plus progress update for the next fresh-context session.

“Their solution involved a two-fold agent harness: an initializer agent that sets up structured environments (feature lists, git repositories, progress tracking files) on first run”summary, stated
“Coding agent: Every subsequent session asks the model to make incremental progress, then leave structured updates.”article, stated
[Assistant] I'll start by getting my bearings and understanding the current state of the project."

— article, stated

Why this architecture

The harness moves memory out of transient model context and into durable software-engineering artifacts. JSON feature lists prevent one-shotting and premature completion, progress logs and git history orient fresh sessions, and browser automation closes the gap between code edits and user-visible behavior.

3 supporting quotes
“The key insight here was finding a way for agents to quickly understand the state of work when starting with a fresh context window, which is accomplished with the claude-progress.txt file alongside the git history.”article, stated
“After some experimentation, we landed on using JSON for this, as the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files.”article, stated
“Providing Claude with these kinds of testing tools dramatically improved performance, as the agent was able to identify and fix bugs that weren’t obvious from the code alone.”article, stated

Models used: Claude Agent SDK · Opus 4.5 · Claude

Scale

Alternatives considered (roads not taken)

Rely on context compaction alone

Rejected because: Compaction did not reliably preserve enough clear instructions for the next fresh agent session.

“However, compaction isn’t sufficient. Out of the box, even a frontier coding model like Opus 4.5 running on the Claude Agent SDK in a loop across multiple context windows will fall short”article, stated
“This happens even with compaction, which doesn’t always pass perfectly clear instructions to the next agent.”article, stated

Let agents attempt the whole application in one pass

Rejected because: One-shotting exhausted context and left half-implemented undocumented features for later sessions.

“the agent tended to try to do too much at once—essentially to attempt to one-shot the app.”article, stated
“leaving the next session to start with a feature half-implemented and undocumented.”article, stated

Use Markdown for the feature list

Rejected because: The model was more likely to inappropriately modify or overwrite Markdown, while JSON proved more robust.

“After some experimentation, we landed on using JSON for this, as the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files.”article, stated

Test only with code inspection, unit tests, or curl

Rejected because: Those checks missed whether web features actually worked from a user perspective.

“Claude tended to make code changes, and even do testing with unit tests or curl commands against a development server, but would fail recognize that the feature didn’t work end-to-end.”article, stated

Patterns

context-engineering (agent-architecture)

Anthropic engineered what survives across context windows by externalizing session memory into JSON feature lists, progress logs, git history, startup scripts, and onboarding steps.

“The core challenge of long-running agents is that they must work in discrete sessions, and each new session begins with no memory of what came before.”article, stated
“The key insight here was finding a way for agents to quickly understand the state of work when starting with a fresh context window”article, stated

agent-memory (state)

Progress files and git history act as persistent memory that fresh agent sessions read before selecting new work.

“an init.sh script, a claude-progress.txt file that keeps a log of what agents have done, and an initial git commit that shows what files were added.”article, stated

structured-output-contract (coordination)

The initializer creates a JSON feature list with descriptions, test steps, and pass/fail status, and coding agents are constrained to update only status.

“These features were all initially marked as “failing” so that later coding agents would have a clear outline of what full functionality looked like.”article, stated
“We prompt coding agents to edit this file only by changing the status of a passes field”article, stated

tool-use-orchestration (agent-architecture)

The coding agent uses shell commands, file reads, git, startup scripts, and Puppeteer browser automation as part of its session routine.

“It has context management capabilities such as compaction, which enables an agent to work on a task without exhausting the context window.”article, stated
“By explicitly prompting Claude to test all web features as a human user would—through browser automation that captures screenshots and validates user interactions”summary, stated

eval-driven-development (evaluation)

Features are only marked passing after browser-based validation and a basic end-to-end smoke test at the start of each session.

“Self-verify all features. Only mark features as “passing” after careful testing.”article, stated
“run through a basic end-to-end test before implementing a new feature.”article, stated

Tradeoffs

Use a two-prompt harness

Chose initializer and coding-agent prompts in the same underlying harness over one generic prompt for all sessions.

Rationale: Different session phases needed different behavior: environment setup first, incremental feature work thereafter.

“Initializer agent: The very first agent session uses a specialized prompt that asks the model to set up the initial environment”article, stated
“Every subsequent session asks the model to make incremental progress, then leave structured updates.”article, stated

Persist feature state in JSON

Chose JSON feature list with pass/fail fields over Markdown feature tracking.

Rationale: JSON was less likely to be inappropriately changed or overwritten by the model.

“we landed on using JSON for this, as the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files.”article, stated

Require session startup overhead

Chose read artifacts, start server, and smoke-test before new work over immediately coding the next feature.

Rationale: The overhead prevents agents from building on a broken state and saves time otherwise spent guessing prior work.

“This ensured that Claude could quickly identify if the app had been left in a broken state, and immediately fix any existing bugs.”article, stated
“If the agent had instead started implementing a new feature, it would likely make the problem worse.”article, stated

Use a general-purpose coding agent with phase-specific prompts

Chose same system and tools with different initial prompts over fully separate specialized agents.

Rationale: The current demo used prompt specialization, while the source leaves true multi-agent specialization as an open research question.

“We refer to these as separate agents in this context only because they have different initial user prompts. The system prompt, set of tools, and overall agent harness was otherwise identical.”article, stated
“it’s still unclear whether a single, general-purpose coding agent performs best across contexts, or if better performance can be achieved through a multi-agent architecture.”article, stated

Gotchas (what bit them)

Compaction does not automatically make long-running agents reliable.

Root cause: Fresh sessions can still lack clear prior-work instructions and have to reconstruct partially implemented state.

Resolution: Use durable artifacts such as progress logs, feature JSON, git history, and startup scripts as the cross-session memory layer.

“However, compaction isn’t sufficient.”article, stated
“the next session to start with a feature half-implemented and undocumented. The agent would then have to guess at what had happened”article, stated

Agents overreach when the work is not decomposed into explicit feature units.

Root cause: A high-level prompt encourages the model to attempt too much in one context window.

Resolution: Have the initializer expand the prompt into a comprehensive feature list and require coding agents to work one feature at a time.

“the agent tended to try to do too much at once—essentially to attempt to one-shot the app.”article, stated
“the next iteration of the coding agent was then asked to work on only one feature at a time.”article, stated

Agents may mark features complete without user-visible validation.

Root cause: Code-level tests and curl checks can miss broken end-to-end browser behavior.

Resolution: Prompt the agent to use Puppeteer MCP and test web features as a human user would before marking completion.

“One final major failure mode that we observed was Claude’s tendency to mark a feature as complete without proper testing.”article, stated
“Claude mostly did well at verifying features end-to-end once explicitly prompted to use browser automation tools and do all testing as a human user would.”article, stated

Browser automation still leaves blind spots.

Root cause: Tool and vision limitations prevent Claude from seeing some browser-native UI states such as alert modals.

Resolution: Keep testing limitations explicit and avoid assuming browser automation catches every class of bug.

“Some issues remain, like limitations to Claude’s vision and to browser automation tools making it difficult to identify every kind of bug.”article, stated
“Claude can’t see browser-native alert modals through the Puppeteer MCP, and features relying on these modals tended to be buggier as a result.”article, stated

Evaluation

Anthropic evaluated the harness qualitatively through web-app building experiments, feature pass/fail tracking, git/progress handoffs, startup smoke tests, and browser automation. The article does not provide quantitative success rates, cost, or bug metrics.

Metrics: feature pass/fail status in JSON · successful basic chat smoke test at session start · browser automation screenshots and user-flow validation · clean mergeable code state after each session · no quantitative benchmark metrics reported

3 supporting quotes
“Self-verify all features. Only mark features as “passing” after careful testing.”article, stated
“Providing Claude with these kinds of testing tools dramatically improved performance, as the agent was able to identify and fix bugs that weren’t obvious from the code alone.”article, stated
“Notably absent from the case study are quantitative success metrics.”summary, stated

Outcomes

The reported scale is long-horizon software work across hours or days and over 200 feature requirements in a claude.ai clone example, not a public production throughput metric.

3 supporting quotes
“This research demonstrates one possible set of solutions in a long-running agent harness to enable the model to make incremental progress across many context windows.”article, stated
“For a "clone of claude.ai" project, the initializer created over 200 features with detailed test steps, all initially marked with a passes: false status.”summary, stated
“Providing Claude with these kinds of testing tools dramatically improved performance”article, stated