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:

  1. 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.
  2. 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.

AgentRuns whenJob
InitializerOnce, on the first sessionSet up init.sh, claude-progress.txt, feature_list.json, and an initial git commit
CodingEvery subsequent sessionRead 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 revert bad changes and recover working states.
  • The next session reads git log --oneline -20 to 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:

  1. pwd — confirm the working directory (and the editing scope).
  2. Read claude-progress.txt and git log --oneline -20 — load recent context.
  3. Read feature_list.json — pick the highest-priority passes: false feature.
  4. Run init.sh, smoke-test the app via browser automation.
  5. 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:

FailureInitializer responsibilityCoding agent responsibilityArtifact that anchors the fix
Premature victory on the projectWrite the full feature list as test rubricRead the rubric every session, pick one unfinished featurefeature_list.json
Bugs / undocumented work left at session endCreate initial git repo + progress fileRead progress + git log on start; commit + update progress on endgit history + claude-progress.txt
Marking features done without verificationWrite the rubric with end-to-end stepsSelf-verify via browser automation before flipping passes: truefeature_list.json + Puppeteer MCP
Wasting tokens figuring out how to run the appWrite init.shRead and run init.sh firstinit.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:

  1. Write two prompts — one for first-run setup, one for every subsequent run.
  2. Mandate four artifacts — init.sh, claude-progress.txt, a JSON rubric, and a git repo.
  3. Mandate the bootstrap routine — the 5 opening steps above, in the coding-agent prompt.
  4. Wire up browser automation if the product has a UI.
  5. Forbid edits to the rubric beyond flipping passes.

Anthropic publishes a quickstart that implements this pattern.

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