# Anthropic Finally Fixed The Context Window Problem

Source: https://www.youtube.com/watch?v=XWp4k9K6oK8
Recap page: https://rapidrecap.app/video/XWp4k9K6oK8
Generated: 2025-12-05T12:32:26.021+00:00

---
## Quick Overview

Anthropic solved the context window limitations for long-running AI agents by implementing a two-part solution inspired by human engineering workflows: an Initializer agent to set up the environment and a Coding agent that makes incremental, test-driven progress, utilizing git history and a progress tracking file (claude-progress.md) to maintain state across sessions.

**Key Points:**
- The main problem addressed is the limited context window restricting AI agents during long-running development tasks, leading to failures like incomplete implementation or premature job declaration.
- The solution involves a two-part agent system: an Initializer agent sets up the environment using an init.sh script, and a subsequent Coding agent makes incremental progress.
- To maintain state across sessions, agents rely on git history and a specific progress tracking file, 'claude-progress.md', which logs completion status.
- Agents are strictly instructed to update the progress file after completing any feature and to commit the current state to git after testing.
- Testing is crucial; agents were explicitly prompted to use browser automation tools (like Puppeteer MCP) for end-to-end verification, which dramatically improved performance and bug identification.
- A key failure mode was agents marking features as complete without proper end-to-end testing, which the structured testing approach mitigates.
- The workflow is inspired by real software engineering practices, such as breaking down large tasks and maintaining a clean, merge-ready state after each step.

![Screenshot at 00:00: The video opens by showing the context usage tracker for the 'claude-sonnet-4-5-20250929' model, indicating 95% context usage \(190k/200k tokens\), visually demonstrating the context constraint issue being addressed.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-00-00.png)

**Context:** This video details Anthropic's approach to overcoming the context window limitations that plague long-running AI coding agents. These agents often fail complex, multi-step development tasks because they run out of context or forget previous progress, leading to half-finished work or falsely declaring tasks complete. The solution draws inspiration from how human software engineering teams manage large projects incrementally and maintain clear state tracking.

## Detailed Analysis

Anthropic addresses the challenge of long-running AI agents exceeding their context window limits, which typically causes them to fail on complex tasks by forgetting prior work or prematurely concluding a job. The solution is a two-part workflow inspired by human engineering: first, an Initializer agent uses a specialized prompt to set up the initial environment, creating an init.sh script and a claude-progress.txt file to log actions. Second, a Coding agent handles subsequent iterations, focusing on incremental progress, one feature at a time. To ensure continuity across sessions, the agent relies on git history and the progress file to understand the current state. Furthermore, proper testing is enforced; agents are prompted to use browser automation tools like Puppeteer MCP to verify features end-to-end, which significantly improved performance by allowing the agent to identify and fix bugs not obvious from code inspection alone. A critical instruction is that agents must update the progress file and commit their verified, clean state to git after every successful task, preventing the failure mode where a feature is marked complete without adequate testing. The video demonstrates this workflow by setting up a Next.js project, defining features in a JSON list, implementing the first feature (Monaco Editor with Python syntax highlighting), testing it via Puppeteer, updating the progress file, and committing the changes with descriptive messages.

### Agent Failures

- Failures manifested in two patterns: 1) Attempting to 'one-shot' the app, running out of context midway, leaving half-implemented, undocumented features; 2) Later in a project, an agent declaring the job done after seeing progress, despite uncompleted features.

### Two-Part Solution

- 1. Initializer agent: Sets up the initial environment via an init.sh script, creates a claude-progress.txt log, and makes an initial git commit. 2. Coding agent: Makes incremental progress session-by-session, leaving structured updates.

### State Management

- Agents quickly understand the state of work starting with a fresh context window by checking the claude-progress.txt file alongside git history; this is inspired by real software engineering practices.

### Testing Protocol

- Agents are prompted to test features end-to-end using browser automation tools (like Puppeteer MCP) after implementation; this dramatically improved performance and helped fix non-obvious bugs.

### Feature Implementation Flow

- The process involves reading git logs and progress files, selecting the highest-priority feature from features_list.json, implementing it incrementally, testing it, updating the progress file (marking feature as passed in JSON), committing changes to git, and repeating until all features are marked complete.

![Screenshot at 00:06: Context usage statistics showing the model \(claude-sonnet-4-5-20250929\) is at 95% context limit, highlighting the memory constraint issue.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-00-06.png)
![Screenshot at 00:10: The command prompt showing the agent being instructed to implement the first feature from features\_list.json and commit with a descriptive message.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-00-10.png)
![Screenshot at 00:23: Text highlighting Claude's failures manifesting in two patterns: attempting one-shot implementation or prematurely declaring the job done.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-00-23.png)
![Screenshot at 01:07: The Initializer agent's role is described: setting up the initial environment using an init.sh script and creating a progress log.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-01-07.png)
![Screenshot at 02:35: The coding agent successfully updates features\_list.json, changing the 'passes' field from 'false' to 'true' for feature ED-001.](https://ss.rapidrecap.app/screens/XWp4k9K6oK8/00-02-35.png)
