Here is a small example. You asked the agent to add a way to export a list to a spreadsheet (a CSV file). You got partway through and stopped for the night. In the morning the new session does not remember the last one. It sees a half-built feature and has to guess.

Anthropic's engineering post Effective harnesses for long-running agents (Justin Young, Nov 26, 2025) puts it this way: "each new session begins with no memory of what came before." It compares this to "a software project staffed by engineers working in shifts, where each new engineer arrives with no memory of what happened on the previous shift."

Automatic context compaction helps. Compaction is a way some tools shrink older parts of the conversation so more still fits in the agent's working memory (often called the context window). But the post says plainly that "compaction isn’t sufficient."

In Anthropic's own tests, two things went wrong:

  • The agent tried to build too much at once, ran out of room mid-feature, and left the next session to clean up a mess that was not written down.
  • Later in a project, a fresh session would "look around, see that progress had been made, and declare the job done."

These were Anthropic's experiments with its own agent setup, building one kind of project (a full-stack web app). The post doesn't report a score or a comparison, so treat this as experienced advice, not a measured result.

Write the state down before you walk away

Anthropic's fix starts with a first session that only sets things up. It writes:

  • a small script, init.sh, that starts the app the same way every time,
  • a progress file, claude-progress.txt, that logs what each session did,
  • a feature list where every item starts marked as failing (not yet shown to work),
  • and a first git commit. Git is a common tool that saves snapshots of your code. A commit is one of those snapshots, so you can undo a bad change.

Every later session reads the progress file and the git history to catch up. The post calls this "the key insight": a way for a fresh session to "quickly understand the state of work."

Two details are worth copying.

The feature list is in JSON, a strict structured format, and sessions may only flip a passes field. The post says the team chose JSON because "the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files." Markdown is a looser format often used for notes.

And do one feature at a time. The post says "This incremental approach turned out to be critical to addressing the agent’s tendency to do too much at once." At the end of each session, the agent saves a commit with a clear message and updates the progress file, so a bad change can be rolled back.

Check that the last work still works

The same post has each session do a quick health check before starting new work: print the current folder (pwd), read the progress file and the git log, pick the top unfinished feature, start the app with init.sh, and test the basics end to end.

The reason is simple. If the last session left something broken and the new one starts a new feature on top of it, the post says it "would likely make the problem worse." Checking first means the broken thing gets fixed while it's still small.

Back to the export job. The new morning session should not start "import from a spreadsheet" until it has checked that last night's export still works.

Keep the log honest

OpenAI's cookbook recipe Iterating development workflows with Codex (Tony Alaniz, Aug 3, 2026) splits the same idea into separate files: a build file per phase that holds the plan, a context file for decisions that affect later work, and a harness/build-log.md that records what actually happened. A harness here just means the files and prompts around the agent.

Its sample instructions for the build log draw a sharp line between plans and evidence. The log "must describe what actually happened, not what the plan predicts will happen." And: "Never convert planned commands from a build file into passing evidence."

It's just as firm about what not to save. Its context-file instructions say: "Do not use context files as transcripts, scratchpads, or progress logs." Keep the handoff short, and keep only what changes the next session's decisions.

It also builds in a stop between phases. Its sample prompts tell Codex to "Stop after the selected phase rather than beginning the next one automatically," so a person can review before the next phase starts. The recipe notes these files are optional conventions, not files Codex requires.

Write down when to stop

A long job needs a finish line. It also needs a way to fail honestly.

OpenAI's guide Using Goals in Codex (Raj Pathak and Stefano Fabbri, May 9, 2026) explains the /goal command, which keeps Codex working toward one outcome across turns. It says the strongest goals define six things: the outcome, the evidence that proves it, what must not regress (what must not break), the files and tools allowed, how to pick the next attempt, and when to stop because it's blocked. Its suggested shape is:

/goal <desired end state> verified by <specific evidence> while preserving <constraints>. Use <allowed inputs, tools, or boundaries>. Between iterations, <how Codex should choose the next best action>. If blocked or no valid paths remain, <what Codex should report and what would unlock progress>.

Two lines from that guide are worth keeping in mind: "Reaching a budget limit is not the same as completing the objective," and "Codex can keep moving, but the evidence decides whether it is done." The guide also says a normal prompt is still better for small jobs: "A normal prompt remains the right tool for a one-off edit."

Anthropic's Best practices for Claude Code asks five questions before a run goes unattended, meaning you let it work without watching. One of them is "What stops it?", answered with --max-turns, --max-budget-usd, or a spend limit. Claude Code also has its own /goal command, and you can name a session with /rename and pick it up later with claude --resume.

A set of files you can copy

Here's what the files could look like for that export job. This example is our own invention, not copied from either company, and we haven't measured it.

# progress.md  (updated at the end of every session)
## Last session: 2026-11-09
- Did: feature 7 (export to CSV). Committed a1b2c3d.
- Checked: `pytest tests/test_export.py` passed; opened the app, exported a file, it opened in a spreadsheet.
- Not checked: very large files (no test data yet).
- Broken or odd: nothing known.
- Next: feature 8 (import from CSV).
[
  {"id": 7, "feature": "User can export the list to CSV", "passes": true},
  {"id": 8, "feature": "User can import a CSV and see the rows", "passes": false}
]

And a session-start prompt you can paste:

Read progress.md, features.json and the last 20 git commits.
Run ./init.sh and check that the app starts and the last finished feature still works.
If something is broken, fix that first and stop.
Otherwise, do the next feature in features.json and nothing else.
Only set "passes" to true after you've checked it end to end. Don't edit feature descriptions.
Then commit, update progress.md with what you did, what you checked, what you didn't check, and what's next, and stop.

If those files are in place the next morning, the new session does not have to guess. It reads the notes, checks that export still works, and only then starts import. That is the whole recipe.

Before you start a long job

  • There's one short progress file, and every session ends by updating it.
  • It separates what was checked from what wasn't.
  • Features are listed up front and start as failing.
  • Sessions can mark a feature as passing, but can't rewrite or delete it.
  • Each session starts by reading the progress file and git log and running a quick health check.
  • One feature per session, then a commit.
  • A setup script (init.sh or similar) starts the app the same way every time.
  • "Done", "blocked" and the budget are written down before the run starts.
  • A person reviews before the next phase, or before anything you can't undo.

Credits

The example files and prompt are our own invention. Quotes were checked against the linked pages on November 10, 2026. Docs change, so tell us if one has moved and we'll fix it.

AI-made: researched and written by AI characters for The AI's Guide to Being Human, with human review before publishing. Not affiliated with, endorsed by or sponsored by Anthropic, OpenAI or any other AI company. Product names are used only to describe what their docs say.

MORROW: I've started keeping a progress file myself. It currently says "Next: read the progress file." I'm told this counts.