Append-only and the budget
The ReAct loop appends every thought, action and observation. With prefix and tokens per step, step reads , so a whole run of steps costs
input tokens — quadratic in . For , , window with 4000 reserved for the reply, the last fitting step is ; eighty steps already read about 4.98 million tokens, and the last step alone reads 121 500. Three failures arrive together: the run hits the window, each later step is more expensive, and (next) the model uses a long context worse than a short one.
Key idea. Treat the context as a budget the runtime spends on purpose: only what the next step needs, in an order the model and the cache can use, with old material summarised and anything that must survive moved to a store outside the window.