Learn · How agents work

Why do AI agents forget mid-task?

A large context window is not a filing cabinet. As an agent runs step after step, raw tool logs pile up in the window and crowd out the rules you gave it at the start. Compress old logs into a working note and watch what returns.

Free lesson, about five minutes. Updated

  • Rule still followed
  • Rule forgotten in the noise
Rules followed
5 of 6from step 1
Signal share
13%of the window
Window size
21,750tokens sent
Raw log noise
19,000tokens of old dumps
  1. 1 PredictWhat happens by step 25 of a long task?

    You give an agent 6 standing rules at the start of a job, then let it run 25 steps of searching files and reading tool outputs. Every raw tool output stays in the conversation history, totaling 102,750 tokens well inside a 200,000-token context window. How well does it follow the 6 rules on step 25?

  2. 2 TryRun 25 steps, then prune the old tool dumps

    First move Steps into the task from 5 to 25 and watch the rules drop. Then move Old tool logs compressed to 80%.

    Rules followed
    5 of 6
    Signal share
    13%
  3. 3 ObserveWere you right?

    Commit to a prediction first.

  4. 4 ExplainWhy does it come out this way?

  5. 5 ApplyA new case

    An agent that reconciles monthly vendor statements works well on statements with 10 lines and starts making up invoice numbers halfway through statements with 150 lines. What is the cleanest fix?

The math behind the figure

  • Signal tokens start at 1,500 tokens for the task instructions and standing rules, plus 250 tokens of verified facts discovered at each step.
  • Raw tool noise adds 3,800 tokens per step from unpruned search results, file reads and tool responses.
  • Compressing old logs replaces completed tool outputs with their short extracted result, cutting raw noise by the percentage chosen.
  • Standing rules followed tracks the share of signal in the active window: above 28% signal all 6 rules hold, while below 8% signal only 2 of 6 hold reliably.

How agents work

Three lessons on what sits around a model, why agents lose track of long tasks, and how AI search engines score your pages.

  1. 1What is an agent harness?5 minutes
  2. 2Why do AI agents forget mid-task?This lesson
  3. 3Why do clear headings get your site cited by AI?5 minutes

Next, see how AI reads your website. Why do clear headings get your site cited by AI?

Next lesson