Long-Horizon Memory and Planning

Why a capable model can still lose the thread after many steps, and what structure does to help.

BeginnerIntermediateExpert · 12 min read · Last updated:

In short

Long tasks fail because small errors accumulate, important facts leave the context, plans go stale and nobody checks until the end. Progress comes from external state, memory that can be corrected, plans that are revised, verified checkpoints and bounded autonomy. Measure long-horizon behavior directly; strong short-task scores do not establish it.

What you will learn: what makes horizons hard, how researchers measure them, error compounding, memory designs, planning and replanning, checkpoints and verification, benchmarks, failure analysis and open questions.
Prerequisites: Agent Memory Types and Persistence and How Agents Reason and Decompose Tasks.

Versions used

The example runs in November 2026 with Python 3.13 and only the standard library. It simulates independent step errors with random numbers and models no real agent. Research descriptions come from sources found on November 28, 2026; several are preprints whose results are not verified here.

Beginner Why long tasks are different

What long horizon means

A long-horizon task needs many dependent steps, often over hours or several sessions, where early choices constrain later ones and feedback arrives late. Migrating a codebase, running an investigation or managing a small operation are examples. Length in tokens is only part of it. A long document summary may be large but shallow; a twenty-step change in which each step depends on the last can be harder.

DifficultyWhat goes wrong
Compounding errorsA wrong early result is trusted later
ForgettingConstraints or decisions drop out of context
DriftThe agent starts solving a neighboring problem
LoopsThe same failing approach repeats
Stale beliefsThe world changes while the plan does not
Weak self-assessmentUnfinished work is reported as done

Measuring in human time

The research organization METR measures a task-completion time horizon: the length of task, measured by how long a human expert takes, at which an agent is predicted to succeed with a stated reliability, such as 50 or 80 percent. Its paper reported that this horizon had doubled about every seven months since 2019 on its tasks, with signs of acceleration from 2024, and later updates revised the task set and estimates.

Read the number carefully

A horizon of some hours does not mean an agent can do every task of that length. The measure depends on the task suite, mainly software work, on human time estimates and on the chosen success rate. METR notes that measurements above 16 hours were unreliable with the task suite described when this page was checked.

The arithmetic of long chains

If every step must succeed and errors are independent, the chance of success is the per-step rate multiplied by itself once for each step. Even a high per-step rate falls quickly. Real errors are not independent, and some are recoverable, so this is a teaching model. It still explains why adding checks can matter more than a slightly better model.

Checkpoints with verification

The program compares an unchecked run with one that verifies each block of ten steps and retries a block when the checker detects an error. Detection quality varies.

"""Why long tasks fail, and what checkpoints with verification change."""
import random

def plain(steps, p):
    """Chance that every step succeeds, with independent errors."""
    return p ** steps


def checked(steps, p, block, detect, retries, trials=20000, seed=3):
    """Verify after each block; redo a block if an error is detected."""
    rng = random.Random(seed)
    wins = work = 0
    for _ in range(trials):
        ok = True
        for start in range(0, steps, block):
            size = min(block, steps - start)
            for _attempt in range(retries + 1):
                work += size
                good = all(rng.random() < p for _ in range(size))
                if good or rng.random() >= detect:
                    break              # passed, or the error slipped through
            ok = ok and good
        wins += ok
    return wins / trials, work / trials / steps


P = 0.99
print("steps  no checks")
for steps in (10, 50, 200):
    print(f"{steps:>5}  {plain(steps, P):.2f}")
print("\n200 steps, blocks of 10, up to 2 retries")
for detect in (0.0, 0.7, 0.95):
    success, cost = checked(200, P, 10, detect, 2)
    print(f"checker catches {detect:.0%}: success {success:.2f}, "
          f"work x{cost:.2f}")

Output:

steps  no checks
   10  0.90
   50  0.61
  200  0.13

200 steps, blocks of 10, up to 2 retries
checker catches 0%: success 0.13, work x1.00
checker catches 70%: success 0.53, work x1.07
checker catches 95%: success 0.89, work x1.10

With 99 percent per-step success, two hundred unchecked steps succeed 13 percent of the time. Retries help only as far as the checker can see: with no detection, nothing changes, while 95 percent detection raises success to 89 percent for about ten percent more work. Two cautions apply. The simulation ignores the cost of the checker itself, and it assumes a retry is a fresh independent attempt. A model that misunderstands a requirement will often repeat the same error, and an action with side effects may not be safe to repeat at all.

Intermediate Memory and planning

Keep state outside the model

The most reliable long-horizon technique is unglamorous: write progress down in a structured place that code controls.

RecordContents
Goal sheetObjective, constraints, acceptance tests and what is out of scope
PlanSteps with status, dependencies and owner
DecisionsChoice, reason, evidence and date
ArtifactsFiles, results and identifiers, with checksums or versions
Open questionsWhat is unknown and who can answer
BudgetSteps, time, money and retries used

At each stage, build the context from these records instead of replaying the whole history. The goal and constraints should appear every time, because they are what drift erodes. Stateful agents and durable execution cover the engineering.

Memory architectures

EpisodicWhat happened, when and with what result
SemanticCurrent facts distilled from episodes
ProceduralHow to do things: tested recipes and tools
Working context is assembled from these stores for the current step.
ApproachStrengthWeakness
Long contextSimple; nothing is selected away earlyCost, limits and uneven attention to details
Rolling summaryCompactErrors and omissions become permanent
Retrieval over recordsScales and keeps originalsMisses what the query does not suggest
Structured stateExact and checkableNeeds a designed schema
CombinedUses each where it fitsMore parts to test

Updating and forgetting

Remembering is the easier half. A 2026 preprint introducing the Memora benchmark reports that the systems it tested often reused memories that were no longer valid and failed to reconcile memories that had changed. Design for this: give each fact a source and a time, mark superseded facts instead of silently keeping both, prefer systems of record over memory and test questions whose correct answer changed partway through. See memory policies.

Memory for acting, not only recall

Many memory tests ask a system to retrieve a fact from a long conversation. Using experience to choose better actions is a different skill. The MemoryArena preprint links tasks across sessions so that later actions depend on what was learned earlier, and reports that agents which do very well on recall-style benchmarks can perform poorly in this setting. AMA-Bench likewise targets memory in agentic work. Choose evaluations that resemble how your agent will use memory.

Plans that survive contact

  • Plan at two levels: milestones for the whole task, detailed steps only for the next one.
  • State for each milestone how completion will be checked.
  • Order work so that risky assumptions are tested early.
  • Replan when evidence contradicts the plan, not on every small surprise.
  • Record why the plan changed.
  • Keep a list of approaches already tried and their results.

Planning and search and plan-and-execute describe the methods.

Expert Verification, evaluation and frontiers

Verification that is independent

CheckerDetectsMisses
Tests and type checksSpecified behaviorWhatever the tests do not cover
Reconciliation with source dataWrong totals and missing recordsWrong interpretation
Rules and invariantsForbidden statesValid but poor choices
Second model reviewSome reasoning errorsShared blind spots
Human review at milestonesIntent and judgmentDetail, if volume is high

A checker that shares the author's assumptions adds little. Base checks on external facts where possible, and do not let the agent edit the checks it must pass.

Bounded autonomy

Long tasks need explicit boundaries: a budget, a list of actions that require approval, checkpoints where work pauses, and conditions that stop it. Make intermediate work reversible where you can, such as changes on a branch or drafts instead of sent messages. A pause with a clear status report is far more useful than hours of confident activity in the wrong direction. See stopping and budgets and autonomy levels.

Long-horizon benchmarks

Simulated businesses are one way to stress coherence. Vending-Bench asks an agent to operate a simulated vending machine business over a long period. The YC-Bench preprint simulates running a startup for a year across hundreds of turns, testing planning under uncertainty and delayed feedback. Such environments reveal failures that short tasks hide, but they remain simulations with their own rules. A good score there does not show readiness to manage a real operation.

Measure your own agent

  • Success by task length, grouped by number of steps or human time.
  • The step at which runs first go wrong.
  • Share of errors detected before the end, and by which check.
  • Repetition: identical failed actions per run.
  • Constraint violations late in long runs.
  • False claims of completion.
  • Cost per successful task as length grows.

Plot success against length. A sharp fall tells you the current limit and where to split work.

Test recovery deliberately

Inject faults into long runs: a tool that returns outdated data, a changed requirement halfway, a lost session, a contradictory instruction in a retrieved file or a restart after a crash. Check whether the agent notices, whether state recovers correctly and whether actions are duplicated. Testing resilient workflows gives techniques.

Report progress honestly

A long run needs a status report that a busy person can trust. Ask for four short parts: what is verified, with the check that verified it; what is done but not yet verified; what is blocked and why; and what will happen next with how much budget. Avoid a single percentage, which suggests a precision that rarely exists. When the agent changes its plan or lowers its goal, the report should say so at the top. Compare reports with actual results from time to time, and treat confident but wrong status as a defect to fix.

Open questions

  • How can an agent judge reliably that it is off course?
  • What should be remembered, and how should conflicts be resolved?
  • When does adding agents help coordination rather than multiply errors?
  • How can people oversee work too long to read in full?
  • How should benchmarks reflect changing, partly observable environments?

These are active research topics. Treat proposed solutions as hypotheses to test on your own tasks.

A practical starting recipe

  1. Write the goal, constraints and acceptance tests.
  2. Split into milestones of a size your agent already completes reliably.
  3. Keep structured state and rebuild context from it.
  4. Verify each milestone with something independent.
  5. Limit retries and escalate repeated failures.
  6. Require approval for irreversible steps.
  7. Increase milestone size only when measurements support it.

A worked long task

Consider an invented request: upgrade an internal library across forty services. Handled as one conversation, the agent edits files, reads long build logs and gradually loses track of which services are finished. Structured, it looks different.

StageWorkCheckpoint
SurveyList services, versions and ownersList matches the repository and registry
PilotUpgrade two unlike servicesTests pass and owners review the approach
RecipeWrite down steps and known exceptionsA fresh session can follow it
BatchesUpgrade five at a time on separate branchesEach service builds and passes tests
ExceptionsGroup failures and escalate unclear onesEvery open item has an owner
CloseReport finished, skipped and failed servicesCounts reconcile with the survey

The pilot tests the riskiest assumption early. The recipe turns experience into inspectable memory. Batches limit how much a mistake can spread, and the final reconciliation catches a service that was quietly dropped. None of these requires a longer context window.

Handover between sessions

Assume that any session can end without warning. A useful handover note states the goal, what is verified as done, what was attempted and failed, what is in progress with side effects, the next step and the open questions. At startup, the new session should check the note against reality, for instance by running tests or querying the system of record, before acting on it. A note that says a change was deployed is a claim; the deployment system holds the fact. Give actions stable identifiers so that a resumed run can ask whether an operation already happened, instead of repeating it. Review a sample of handover notes yourself; if a person cannot tell what to do next from one, a new session probably cannot either.

Common mistakes

MistakeConsequenceInstead
Relying on a bigger context aloneDrift and cost remainStructured state
Summaries that replace originalsErrors become factKeep sources and links
Checking only at the endLarge wasted runsVerify milestones
Self-reported completionUnfinished work acceptedAcceptance tests
Unlimited retriesLoops and spendingBudgets and escalation
Quoting a horizon as a guaranteeOvertrustMeasure your tasks

Checklist

  • Goal and constraints are included at every stage.
  • State survives a restart without duplicating actions.
  • Facts carry sources and times and can be superseded.
  • Milestones have independent checks.
  • Budgets, approvals and stop conditions are enforced in code.
  • Success is measured by task length.
  • Fault injection is part of testing.

Frequently asked questions

Will larger context windows solve this?

They help with keeping information available. They do not by themselves verify results, resolve contradictions, control cost or decide when to stop.

How long can I let an agent run unattended?

As long as your measurements, checks and limits justify for that task and its risks. Start short and extend gradually with evidence.

Is multi-agent planning better for long tasks?

Sometimes, when subtasks are separable and verifiable. Handoffs also lose context, so compare with a single structured agent.

What is the cheapest improvement to try first?

Written acceptance tests for milestones and a persistent progress record. Both are simple and expose failures early.

References

Where to go next