Five weeks ago I wrote that the least glamorous piece of an agent loop is also the one that decides whether it compounds: memory . A markdown file outside the context window that holds what is done, what is next, and what was learned, because the model forgets all of it between runs. Write the memory file before the loop.