Large language model (LLM) agents often struggle in long-context interactions.
As the history grows, sliding windows and prompt compression may drop earlier information that later steps rely on.
Retrieval-based memory systems surface relevant content but still overlook the causal and logical dependencies between steps.
We introduce ContextWeaver
We introduce ContextWeaver, a selective and dependency-structured memory framework that organizes an agent's interaction trace into a graph of reasoning steps and selects the relevant context for future actions.
- dependency-based construction and traversal that link each step to the earlier steps it relies on;
- compact dependency summaries of the reasoning paths;
- a lightweight validation layer that incorporates execution feedback.
Performance on Benchmarks
On five software-engineering and terminal benchmarks with a fixed budget per task, ContextWeaver improves the resolve rate over a sliding-window baseline on all five, with a significant gain when pooled across benchmarks, while using 13-18% fewer agent steps.
It also performs favorably against alternative context-management approaches, with the largest gains on long-horizon repository tasks.
SWE-Bench Pro Results
On SWE-Bench Pro, ContextWeaver raises the resolve rate from 66.5% to 72.6%, with significant improvements across all three model backbones.
The improvement also holds when the sliding window's budget is raised to cover the summary cost.