Anthropic engineers address the challenge of getting AI agents to accomplish complex software tasks that exceed a single context window. Because each session starts with no memory of the previous one, agents often struggle to make consistent, long-term progress, similar to human engineers working in shifts without communicating.

To solve this, Anthropic proposes a two-part agent architecture: an initializer agent and a coding agent.

  1. The Initializer Agent: In the first context window, a specialized prompt tasks this agent with setting up a foundational environment. This includes an init.sh script, a progress log (claude-progress.txt), an initial Git commit, and a comprehensive JSON file listing all required features. By outlining every feature upfront and marking them as “failing,” the agent provides a clear roadmap for the entire project.
  2. The Coding Agent: In subsequent sessions, the coding agent reads the logs, Git history, and the feature list to quickly grasp the project’s current state. It is explicitly instructed to work on only one feature at a time, making incremental progress. At the end of its session, the agent commits its code and updates the progress log, ensuring a clean, documented, and bug-free state for the next session.

Anthropic identified two primary failure modes without this harness: agents trying to “one-shot” an entire application (leading to broken, half-implemented code) and agents prematurely declaring a project complete. The structured, incremental approach forces the model to verify each feature step-by-step. Furthermore, providing Claude with end-to-end testing tools—such as browser automation via Puppeteer—significantly improved its ability to spot and fix bugs.

Ultimately, structuring long-running tasks with clear initialization, modular tracking, and robust testing allows agents to handle complex engineering projects much more effectively across multiple context windows.