Anthropic’s worked-out solution for getting an agent to make consistent progress across many context windows: split the work into a one-shot initializer agent (sets up the environment) and a recurring coding agent (makes incremental progress, leaves clean state for the next session).
Where this fits
This is the workflow pattern branch of Long-Running Agents. The architectural counterpart that runs underneath it in production is the Brain Hands Session Split; the role-decomposed variant from Cursor is Cursor Planner Worker Judge; the bash-minimal version of the same loop is the Ralph Loop.
This is the concrete companion to Context Engineering’s long-horizon trio (compaction / structured note-taking / sub-agents). It’s structured note-taking turned into a reusable harness pattern.
Key
The core problem is the shift handover, not the context window itself.
Imagine a software project staffed by engineers working in shifts, where each new engineer arrives with no memory of what happened on the previous shift. Compaction alone doesn’t bridge the gap. The fix is to externalize state — a feature list, a progress log, git history, and a runnable env — so each new shift can read its way back into the work.
The Two Failure Modes Compaction Doesn’t Fix
Even with compaction, a frontier agent given a high-level prompt (“build a clone of claude.ai”) fails in two predictable ways:
- One-shotting — agent tries to do everything at once, runs out of context mid-implementation, leaves a half-built feature undocumented. The next session has to guess what happened and waste time getting the basics working again.
- Premature victory — a later session looks around, sees that something was built, and declares the whole job done.
Both stem from the same root: the agent has no durable model of “what done looks like” and no durable record of “what’s been done so far.” Compaction is lossy; it can’t reliably manufacture either.
The Two-Part Architecture
Despite the names, both “agents” run on the same harness with the same tools and system prompt. The only thing that differs is the user prompt.
| Agent | Runs when | Job |
|---|---|---|
| Initializer | Once, on the first session | Set up init.sh, claude-progress.txt, feature_list.json, and an initial git commit |
| Coding | Every subsequent session | Read the artifacts, pick one feature, implement + verify, commit, update progress |
The artifacts the initializer leaves behind are the durable backbone. Each subsequent session reads them as its first acts, regaining situational awareness without help from compaction.
The Four Artifacts
1. feature_list.json — the test rubric
The initializer reads the user’s high-level prompt and expands it into a comprehensive list of end-to-end features, all initially marked passes: false. For a claude.ai clone, this was over 200 features.
{
"category": "functional",
"description": "New chat button creates a fresh conversation",
"steps": [
"Navigate to main interface",
"Click the 'New Chat' button",
"Verify a new conversation is created",
"Check that chat area shows welcome state",
"Verify conversation appears in sidebar"
],
"passes": false
}Three design decisions that matter:
- Coding agents may only flip
passes— strongly-worded instructions like “It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality” prevent silent rubric tampering. - JSON, not Markdown — Anthropic found models are less likely to inappropriately edit or overwrite JSON files than Markdown. Structural rigidity acts as a guardrail.
- Steps are end-to-end user actions — not unit-test descriptions. The rubric is “click here, see this,” not “function returns expected value.” This forces real verification.
This is a concrete instance of Evaluation-First Prompting: the success criteria are written before any feature is implemented, in a machine-readable form, and become the agent’s standing definition of “done.”
2. claude-progress.txt — the shift handover note
The agent appends to this file at the end of every session, summarizing what was done. The next session reads it first. It’s literally structured note-taking with one well-known filename.
3. Git history — the lossless audit trail
The initializer creates the initial commit. The coding agent commits after each feature with a descriptive message. Two benefits:
- The agent can
git revertbad changes and recover working states. - The next session reads
git log --oneline -20to reconstruct recent work without trusting the progress note alone.
4. init.sh — the runnable env
A script that starts the development server. The next session runs it before doing anything else, then runs a basic end-to-end test (e.g. send a chat message via Puppeteer) to confirm nothing is broken from the previous session. Catch the bug before adding to it.
The Session Bootstrap Routine
Every coding-agent session is prompted to run a fixed opening sequence:
pwd— confirm the working directory (and the editing scope).- Read
claude-progress.txtandgit log --oneline -20— load recent context. - Read
feature_list.json— pick the highest-prioritypasses: falsefeature. - Run
init.sh, smoke-test the app via browser automation. - Only then start work on the next feature.
The session ends with a git commit + progress update. Clean state in, clean state out.
End-to-End Testing as a Hard Requirement
Without explicit prompting, Claude will mark features complete based on unit tests or curl against a dev server — and miss that the feature doesn’t actually work for a user. The fix: prompt the agent to test as a human user would, via browser automation tools (Puppeteer MCP in Anthropic’s setup).

This is the same principle as Lucas Meijer’s evaluation packs — force the agent to actually run the product. Real bugs only surface when the agent uses what it built.
Known limitation: vision and browser-automation gaps. Claude can’t see browser-native alert modals through Puppeteer; features depending on those modals stay buggy.
The Failure-Mode → Solution Map
Anthropic’s summary table, reframed in terms of which artifact solves which failure:
| Failure | Initializer responsibility | Coding agent responsibility | Artifact that anchors the fix |
|---|---|---|---|
| Premature victory on the project | Write the full feature list as test rubric | Read the rubric every session, pick one unfinished feature | feature_list.json |
| Bugs / undocumented work left at session end | Create initial git repo + progress file | Read progress + git log on start; commit + update progress on end | git history + claude-progress.txt |
| Marking features done without verification | Write the rubric with end-to-end steps | Self-verify via browser automation before flipping passes: true | feature_list.json + Puppeteer MCP |
| Wasting tokens figuring out how to run the app | Write init.sh | Read and run init.sh first | init.sh |
Why This Pattern Works
It’s an applied form of Context Engineering’s file-as-state principle:
- State lives outside the context window. Files survive resets, compaction, even harness crashes.
- Each session reconstructs context just-in-time — see Context Engineering on just-in-time retrieval. The agent doesn’t carry state across sessions; it re-derives it from artifacts.
- The user (or harness operator) can read and edit the artifacts. Progress is observable and steerable, not buried in transcript history.
- JSON’s rigidity is a feature. Less editable than prose = less likely to drift under context pressure.
It’s also a counter-example to one school of thinking on Multi-Agent Systems: this isn’t a multi-agent system in the orchestrator-worker sense — it’s the same agent, same tools, called many times with two different opening prompts. Anthropic explicitly notes: “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.”
Open Questions Anthropic Flags
- Single agent vs. specialized roles — would a testing agent, QA agent, and cleanup agent outperform one general coding agent? Probably for some workloads; framework cost is the trade-off.
- Beyond web apps — the demo is full-stack web. Whether the same pattern transfers to scientific research, financial modeling, or other long-horizon work is open.
Practical Adoption
If you are building on the Claude Agent SDK or any similar harness, the minimum viable adoption:
- Write two prompts — one for first-run setup, one for every subsequent run.
- Mandate four artifacts —
init.sh,claude-progress.txt, a JSON rubric, and a git repo. - Mandate the bootstrap routine — the 5 opening steps above, in the coding-agent prompt.
- Wire up browser automation if the product has a UI.
- Forbid edits to the rubric beyond flipping
passes.
Anthropic publishes a quickstart that implements this pattern.
Related
- Long-Running Agents — umbrella; this is the workflow-pattern branch
- Brain Hands Session Split — the production architecture this pattern runs inside
- Cursor Planner Worker Judge — Cursor’s role-decomposed analogue (planner/worker/judge ↔ initializer/coding/test-checker)
- Ralph Loop — bash-minimal version of the same loop; the “are you really done?” re-prompt is the simplest defence against premature victory
- Five Patterns for Long-Running Agents in Production — the four artifacts here are an instance of the checkpoint-and-resume pattern
- Context Engineering — the broader discipline; long-horizon trio (compaction / note-taking / sub-agents); just-in-time retrieval is the umbrella for the bootstrap routine
- Context Window Management Strategies — file-as-state; this pattern is the canonical worked example
- Agent Memory — structured note-taking section;
claude-progress.txtis the canonical filename - Evaluation-First Prompting —
feature_list.jsonis evaluation-first prompting in JSON form; pairs with Lucas Meijer’s evaluation packs - Agent Harness — same harness, different prompts; the cleanest illustration of “agency is harness-mediated”
- Agentic Porting Workflow — Mario Zechner’s
port.md+ jq is the same shape applied to porting; another worked example of the file-as-state pattern - Pi (Coding Agent) — Pi’s
PLAN.md/TODO.mdare the same idea in the minimal-harness world - Making Your Agent Reliable — end-to-end testing as the reliability lever
- Building long-running agents — source
Sources
- Building long-running agents — “Building long-running agents” (Justin Young, Anthropic Engineering, 2025); the canonical write-up of the initializer + coding agent pattern, including the four failure modes table and the claude.ai-clone case study