If you read one line: A long-running agent forgets everything between sessions, so stop trying to make the model remember — write the state to disk. Anthropic's harness for agents that run for hours uses a claude-progress.txt log, an init.sh script, and one git commit per feature so that a brand-new context window can read where the last one stopped and keep going.
Ask an agent to build one small thing and it works inside a single context window. Ask it to build a whole feature — or a whole app — and the work spills across many windows, run over hours. That is where agents fall over, and the reason is not that the model got dumber. It is that each new session starts blank. The window that shipped the auth flow at 2pm is gone by the session that starts the billing flow at 4pm, and the second session has no idea the first one existed.
Anthropic's engineering team calls getting consistent progress across multiple context windows an open problem, and the harness they published is the most copyable answer so far. It is worth understanding because the instinct — "give the agent a memory database" — is usually the wrong first move. The right first move is much cheaper.
The core idea: durable state lives on disk, not in the window#
The context window is a scratchpad. It is large, it is fast, and it is completely erased when the session ends. Anything that has to survive to the next session cannot live there. So the harness moves the load-bearing state out of the window and into files the agent can re-read:
claude-progress.txt— a plain-text log the agent appends to at the end of every session: what it just built, what passed, what's next.init.sh— a script that rebuilds the working environment so a fresh session can get to a runnable state without re-deriving it.- The git history — a commit after each feature, so the progress log is grounded in real, inspectable diffs.
None of these is a vector store. None of them requires an embedding model. They are the artifacts a careful human engineer would leave for the next person on the project — and that is exactly the job the next context window is doing.
Two roles, not one loop#
The pattern splits the work across two agents with different prompts.
1. The initializer agent — runs once
The first session is special, so it gets its own specialized prompt. Its only job is to set the project up so every later session is cheap to resume. It writes the init.sh, creates the claude-progress.txt, and makes the first git commit showing the files it added. It does not try to build the whole product. It builds the runway.
This is the step teams skip, and skipping it is why hand-rolled loops stall: if session 1 dives straight into feature work, sessions 2 through 20 each have to reconstruct the project's shape from scratch, burning tokens and making inconsistent guesses.
2. The coding agent — woken over and over
Then the coding agent is woken repeatedly. Each waking follows the same tight loop, scoped to one feature at a time so the work fits a single window:
1. read claude-progress.txt + git log # where did the last session stop?
2. run ./init.sh # get to a runnable state
3. implement ONE feature
4. run the tests # prove it works
5. append a line to claude-progress.txt # hand off to the next session
6. git commit # ground the note in a real diff
The loop is deliberately boring. The intelligence is in the model; the reliability is in the scaffolding around it. Because every session ends by writing its handoff note and committing, the next session — however fresh, however amnesiac — can reconstruct the state of the work in seconds and continue as if it had been there all along.
Why the progress file beats a memory store here#
A memory database answers "what facts do I know?" across many tasks. That is a real need, and we've compared the options. But keeping one long build on track is a different problem, and a text file wins it for three reasons:
- It's legible. You, the founder, can
cat claude-progress.txtand know exactly what your agent has done. A vector store is opaque; a log is a story. - It's grounded. The progress note sits next to a git commit, so a claim ("added Stripe webhook handler") is backed by a diff the agent — and you — can inspect. Memory stores can drift from reality; a commit can't.
- It's free of retrieval risk. No embedding, no similarity threshold, no top-k tuning. The next session reads the whole file. There is nothing to mis-retrieve.
This sits one level above the in-window levers. Context editing, compaction, and the memory tool decide what stays inside a single window as it fills; this harness decides how state survives between windows. And it rhymes with isolating context in sub-agents — same instinct, different axis: don't cram everything into one context, give each unit of work a clean one and a way to hand off.
What to copy this week#
You do not need Anthropic's exact code to steal the pattern. If you run any agent on a task longer than a single window, add three things:
- A progress log the agent reads first and appends to last, every session.
- An init/bootstrap step so a cold session reaches a runnable state without guessing.
- A commit per unit of work, so the log is anchored to real diffs.
The lesson underneath is the one that keeps recurring as agents get more capable: the model is not the scarce resource anymore — it gets cheaper by the week. The scaffolding around it — the harness that decides what the model sees, when it wakes, and where it writes — is the part you actually engineer. Anthropic just showed that for the hardest version of the problem, the scaffolding is smaller than you'd think: a file, a script, and a commit.



