When you compact an agent's context, keep the state
A compaction summary that says "we worked on the billing feature" has lost the constraint the user gave in turn three. Constraints, decisions, progress and facts found along the way are state. Keep them word for word in their own section, and only summarise the history.
To test it, ask whether the agent could pick the task back up from the summary alone. If it couldn't, the write-back failed.
ai-agentsllm