TL;DR
While standard retrieval-augmented generation (RAG) can successfully find a past trajectory relevant to an LLM agent's current task, it doesn't teach the agent how to reuse that experience when variables or environments change. This paper introduces Query-Conditioned Reuse (QCR), a framework that distills long, messy historical trajectories into compact, target-bound execution notes, boosting agent success rates by 10.7 percentage points while cutting online token costs by nearly half.
What Problem Does This Paper Address?
In LLM agent research, memory systems have traditionally focused on the retrieval bottleneck: how to index, store, and fetch the right past experience. However, the authors argue that for long-horizon tasks (like navigating a complex web interface or executing multi-step API workflows), finding the right memory is only half the battle.
As memory items grow from short facts into long trajectories, a new bottleneck emerges: reuse. A raw historical trace is full of source-specific details—old usernames, specific file paths, dates, and even failed detours. If you inject this raw trajectory directly into an agent's context window, the agent often blindly copies these "stale bindings" into the new task, leading to execution failures.
Methods
To isolate and solve this post-retrieval challenge, the authors created an evaluation framework that holds the retrieved candidates, model, and tool budget fixed, while varying exactly how that memory is presented to the agent.
They introduce Query-Conditioned Reuse (QCR), a lightweight post-retrieval transformation. Instead of feeding the agent the raw history, an intermediate LLM step analyzes the retrieved trajectory against the current target query and generates a highly structured, compact note containing four fields:
- Workflow Invariant: The abstract action pattern or procedural logic that transfers to the new task (e.g., "inspect, validate, modify, verify").
- Bindings to Re-obtain: Explicit warnings about variables (IDs, dates, paths) that the agent must rediscover in the current environment rather than copying from the past.
- Applicability Conditions: Preconditions under which this memory should be discarded or declined.
- Verification Guardrail: The specific checks required to confirm successful completion.
The framework also utilizes a summary-based reranking step to select the single best trajectory from a top-5 retrieved set before generating the QCR note.
Datasets
The authors evaluated their approach using a unified frozen bank of 623 verified historical trajectories generated from successful agent rollouts across three diverse benchmarks:
- WebArena: Web-based tasks (e.g., e-commerce, forums).
- WorkArena: Enterprise cloud workflows (ServiceNow).
- AppWorld: Multi-application API-based tasks.
From this bank, they constructed 2,391 target task variants by systematically altering the original tasks across four levels of "binding shift" (None, Small, Medium, Large) to test how well agents adapt when the underlying workflow stays the same but the specific entities change.
Key Insights and Ideas
- The Long-Context Illusion: Simply giving an agent a larger context window to ingest raw histories backfires. As trajectories get longer, direct injection performance degrades steeply because the agent gets buried under incidental details and old observations.
- Abstraction Prevents Mimicry: Forcing the memory through a target-conditioned abstraction layer (QCR) breaks the agent's habit of literal replay. By explicitly listing what variables need to be "re-bound," the agent is forced to perform target-side discovery.
- Reranking is Crucial: Standard embedding-based retrievers are decent at finding relevant workflows, but ranking candidate summaries against the specific target query closes most of the gap to an "oracle" selector.
Key Results
Across all 2,391 test instances, QCR consistently outperformed both raw trajectory injection and generic summaries:
- Higher Success Rates: QCR achieved an average 62.3% success rate, outperforming the Full Trajectory baseline by 10.7 percentage points and the No Memory baseline by over 20 points.
- Massive Token Savings: QCR cut online token usage by 48.9% compared to injecting full trajectories, proving that cleaner, shorter context leads to better execution.
- Robustness to Change: Under "Large" binding shifts (where multiple variables change), the utility of injecting a Full Trajectory plummeted to just +2.2 points over No Memory. In contrast, QCR preserved a +20.1 point advantage, successfully mitigating stale-binding errors.
Limitations and Future Work
While QCR demonstrates a clear path forward for agent memory, the authors note several boundaries to their current study:
- Successful Traces Only: The current memory bank only contains fully successful historical runs; it does not address how agents might reuse or learn from partial failures.
- Single-Memory Focus: The framework evaluates the reuse of a single selected trajectory rather than synthesizing workflows from multiple different past experiences.
- Static Schema: The four-field QCR schema is a minimal diagnostic implementation. Future work could explore dynamically learned schemas, graph-based procedural representations, or optimizing the reuse policy directly via reinforcement learning.
Summary updated