← Back to patterns
build

How Anthropic Prevents Agents from Losing Progress Mid-Migration

TRIGGER

Agentic systems processing many similar items (migrations, lint fixes, batch operations) lose track of progress mid-task—they may skip items, repeat work, or lose state when context windows fill up, resulting in incomplete or inconsistent execution.

APPROACH

For large tasks with multiple steps or requiring exhaustive solutions (code migrations, fixing numerous lint errors, running complex build scripts), have Claude use a Markdown file or GitHub issue as a checklist and working scratchpad. Example for lint fixes: (1) Tell Claude to run the lint command and write all resulting errors (with filenames and line numbers) to a Markdown checklist, (2) Instruct Claude to address each issue one by one, fixing and verifying before checking it off and moving to the next.

PATTERN

Context cleared mid-batch means items skipped, repeated, or lost. Write a Markdown checklist to disk with every item and status. The agent reads it after resets, checks items off as completed. Persistent file beats ephemeral context.

WORKS WHEN

  • Task involves processing 10+ similar items that must all be addressed
  • Each item can be independently verified as complete before moving on
  • Progress needs to survive context resets (/clear) or session interruptions
  • You need an audit trail of what was done (code review, compliance)

FAILS WHEN

  • Items are interdependent and completing one changes requirements for others
  • Task list itself is dynamic and changes based on discoveries during execution
  • Overhead of checklist management exceeds the complexity of the actual work
  • Items require holistic consideration rather than sequential processing

Stage

build

From

April 2025

Want patterns like this in your inbox?

3 patterns weekly. No fluff.