LLM agents tackling complex tasks accumulate long interaction histories that must be compacted to fit context windows and reduce costs. Existing methods like summarization or KV cache compression add extra computation or require re-encoding history when caches expire.
ReCAP builds a lightweight graph from attention values computed during regular inference, storing block importance scores and dependency links. For each new user request, it selects relevant history by combining stored importance with request-specific string matches and traversing dependencies, without any additional model calls.
On SWE-Together and Lost-in-Conversation code tasks, ReCAP reduces estimated compaction latency by approximately 95% compared to summarization, roughly halves the historical context per call at comparable quality, and improves accuracy by 19.8 and 41.2 points over full history. This makes it especially valuable for long-running, multi-turn agent sessions.