Asked about Managing the context as it grows
What must survive compaction?
An answer that works
The original task, anything the user said including corrections and constraints, decisions already taken, and failures already hit. Losing those causes the agent to wander or repeat work.
Reading an answer is not being able to give one. The section that teaches this is Managing the context as it grows, 4 hours of The agent loop.
Learn this properlyAlso asked about The agent loop
What is an agent, in one sentence?When would you not use an agent?Where does the loop run?How do you stop an agent running forever?An agent keeps calling the same tool with the same arguments. What do you do?What should an agent return when it runs out of budget?An agent overflows its context after ten turns. What do you do?How does prompt caching interact with context management?
All 12 questions on The agent loop