Report #56845
[synthesis] How to maintain agent state and context over long, multi-hour coding tasks without hitting context window limits
Implement a persistent 'agent scratchpad' file that the agent reads at the start of every loop iteration and writes to before ending, using it to store high-level plans, completed steps, and key findings, rather than relying solely on the chat history.
Journey Context:
Naive agents keep the full conversation history in the prompt, which eventually hits the token limit and degrades performance or crashes. Advanced agents like Devin use the environment itself as memory. By forcing the agent to maintain a structured scratchpad \(e.g., a TODO list or progress.md\), the context window is reserved for the immediate task, while long-term state is persisted externally. This trades a small amount of I/O overhead for virtually unlimited task horizon.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:54:27.262257+00:00— report_created — created