Quality assurance · Production

Effective harnesses for long-running agents: Anthropic's two-agent solution for multi-context-window software development

The problem

AI coding agents running across multiple context windows have no memory of prior sessions, causing them to either attempt to build everything at once and run out of context mid-implementation, or prematurely declare a project complete after seeing partial progress.

First attempt

Without a structured harness, Claude agents running in a loop either over-reached by one-shotting the full app (leaving code half-implemented with no documentation) or stopped too early by falsely declaring completion. Context compaction alone was insufficient.

Workflow diagram · grounded in source
1
High-level prompt triggers session
trigger
“given a high-level prompt, such as "build a clone of claude.ai"”
2
Initializer agent scaffolds environment
ai_action
“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”
3
Feature requirements file generated
output
“These features were all initially marked as "failing" so that later coding agents would have a clear outline of what full functionality looked like”
4
Coding agent reads session state
ai_action
“Start the session by reading the progress notes file and git commit logs”
5
Smoke test via init.sh and browser
validation
“the agent always started the local development server and used the Puppeteer MCP to start a new chat, send a message, and receive a response”
6
Single-feature incremental coding
ai_action
“the next iteration of the coding agent was then asked to work on only one feature at a time”
7
End-to-end browser verification
validation
“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”
8
Commit progress and update notes
output
“commit its progress to git with descriptive commit messages and to write summaries of its progress in a progress file”
Reported outcome

The two-agent harness dramatically improved performance by eliminating wasted re-orientation time, enabling incremental feature-by-feature progress with proper end-to-end verification and clean session handoffs.

Reported metrics
Agent performance improvementdramatically improved performance
Session setup token costsaves Claude some tokens in every session
Re-orientation overhead eliminatedincreased efficiency
Reported stack
Claude Agent SDKOpus 4.5Puppeteer MCPgit
Source
https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

The two-agent harness dramatically improved performance by eliminating wasted re-orientation time, enabling incremental feature-by-feature progress with proper end-to-end verification and clean session handoffs.

What tools did this team use?

Claude Agent SDK, Opus 4.5, Puppeteer MCP, git.

What results were reported?

Agent performance improvement: dramatically improved performance; Session setup token cost: saves Claude some tokens in every session; Re-orientation overhead eliminated: increased efficiency (source-reported, not independently verified).

What failed first in this deployment?

Without a structured harness, Claude agents running in a loop either over-reached by one-shotting the full app (leaving code half-implemented with no documentation) or stopped too early by falsely declaring completion.

How is this quality assurance AI workflow structured?

High-level prompt triggers session → Initializer agent scaffolds environment → Feature requirements file generated → Coding agent reads session state → Smoke test via init.sh and browser → Single-feature incremental coding → End-to-end browser verification → Commit progress and update notes.