ContextEvo is a framework for improving long-horizon LLM agents by evolving how the agent's context is managed, rather than only what skills it accumulates. It reconstructs the model-visible context at key decision points from execution trajectories, attributes failures to context-management problems using cross-case evidence and counterfactual replay, and applies targeted policy updates.
On three long-horizon benchmarks, starting from the open-source Pi-agent harness, ContextEvo improved full-benchmark scores by 3.1 to 4.4 percentage points under DeepSeek-V4-Flash. The evolved policies were comparable to or better than several prominent harnesses, including Codex, OpenCode, and OpenClaw. Analysis found that fixed or locally evolved context strategies fell short under long-horizon information pressure, while ContextEvo adapted to each environment's information demands.
This matters because context management is often a fixed part of agent harnesses. Showing it can be evolved automatically from trajectories gives a new lever for long-horizon tasks where long histories bury useful evidence.