arXiv(opens in a new tab)cs.AIOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.19474

Beyond Retrieval: Evidence Access and Event Aggregation in Agent Memory

Zerui Yang, Quan Xue, Chaorui Zhang, Xueyan Niu, Xuanyu Zheng, Xiyuan Wang, Haolin Ruan, Guangcheng Song, Weixi Zhang, Wei Han, Bo Bai

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Questions about an agent's history often require aggregating events, which retrieval alone does not resolve. We combine source-preserving evidence access with executable aggregation. Trajectory Memory (TM) retains the original trajectory and constructs a source-addressable reading view at question time. TallyMem augments it with a reusable event ledger, model-generated event specifications and deterministic execution. With a commit-specific adaptation on 776 questions from 99 held-out MINTEval repositories, TallyMem raises Qwen3-32B exact match from 35.2% to 49.0%, a 13.8-point gain over TM; gains span 12.8–13.9 points across three readers. A controlled probe with event sets parsed independently from raw logs shows an 11.0-point gain, from 82.8% to 93.8%, without routing. On full AMA-Bench, the routed system yields a smaller 1.3-point gain, from 69.8% to 71.1%. These results support executable aggregation on tasks that require combining events, with benefits dependent on the task and event specification, the largest residual system-error category in our diagnostic analysis.

1 Introduction

An agent that edits a repository, navigates a website or operates in a simulated home accumulates a history of actions and observations. Later questions about that history can ask what happened at one step, how an object's state changed, or how often an action was taken (Zhao et al., 2026; He et al., 2026; Xu et al., 2026b). Answering them may need the exact action, its result and its position.

Such questions place two distinct demands on memory. The first is access: the steps that determine the answer must reach the reader unchanged. The second is aggregation: when an answer combines many events, they must be selected and combined correctly. Common memory designs retrieve evidence from summaries, extracted facts or linked records (Packer et al., 2023; Chhikara et al., 2025; Xu et al., 2026a; Gutiérrez et al., 2024). These approaches emphasize evidence access through retention and retrieval; combining the retrieved events remains a separate challenge. Figure 1 shows why this is not enough: even a reader given all 150 steps of a trajectory miscounts five of eight action types.

For access, we argue for deferred evidence selection. Memory written before the questions are known must guess what will matter: a summary commits to an interpretation that a later question may contradict, and AMA-Bench attributes memory errors to lost objective information and causal order (Zhao et al., 2026). We therefore keep the trajectory verbatim and decide what to show only at question time. Trajectory Memory (TM) implements this principle through a lossless, source-addressable archive and a budgeted, order-preserving reading view, built without model calls.

Better access does not remove the second demand. We measure a question’s aggregation load, the number of events its answer combines. On a controlled probe with event sets parsed from raw logs, long-context reading of fully visible histories answers the same count correctly for 100% of trajectories at 14 events but for 80% at 53 events. On AMA-Bench, a compiler-derived load proxy shows TM falling from 77.1% at one to five events to 10.0% above a hundred (Figure 2). The probe supplies independent event sets; reference-answer-derived loads provide an approximate cross-check (Appendix G). TM’s advantage over long-context reading is larger for each of five readers when the history exceeds the context budget, while aggregation errors remain on fully visible probe histories.

TallyMem addresses aggregation by separating deciding what to count from counting. Before any question, it builds an event ledger from the trajectory. At question time, a model writes an event

∗^{*}Corresponding author

†^{\dagger}Corresponding author

Question “Until step 149, what types of actions has the agent performed and how frequently?”

AMA-Bench · 150 steps

Reference go 77 · look 49 · open 7 · close 5 · examine 5 · help 4 · take 2 · move 1

Rewritten memory

summaries · extracted facts · embeddings

opened drawer 4

moved cd 3 to safe 1

looks around often

150 steps

"The agent mostly moved between receptacles and looked around, and opened a few drawers and the safe."

LLM no counts survive in memory

Rewrites the trajectory

Individual steps are lost

Counts cannot be recovered

Reading the history

long context · retrieval

0 look

1 go to shelf 1

...

19 open drawer 4

20 take cd 3

21 close drawer 4

...

149 look

the reader

must

classify and

count every

step

go 70 · look 47 · open 5 · close 5 · examine 6 · help 3 · take 2 · move 1

LLM 5 of 8 counts wrong

Keeps the exact steps

Reader must count every step

Errors grow with the load

TallyMem (ours)

compile a query · execute it on the ledger

ledger

8 open success

9 close success

10 go success

...

149 look success

group_count

by tool

steps 0-149

run on all 150 steps

go 77 · look 49 · open 7 · close 5 · examine 5 · help 4 · take 2 · move 1

LLM all eight counts correct

Model writes what to count

Executor counts every step

Answer shows the steps it used

Figure 1: Evidence access and event aggregation on an action-frequency question. Left: an illustrative compression example, not a measured output. Middle: Qwen3-32B's actual long-context answer miscounts five of eight action types. Right: with TallyMem's group-count query over all 150 steps, Qwen3-32B reports every count correctly. Red numbers are wrong.

specification (a scope, an event predicate and an operation), and a deterministic executor evaluates it over the whole ledger; the result and its supporting step IDs join TM's evidence. The specification supports counts, lists, first and last events, groupings and timelines over literal filters. This interface makes event selection explicit and aggregation deterministic, allowing errors in specifying the intended events to be distinguished from errors in combining them.

With a commit-specific adaptation on 99 held-out MINTEval repositories, TallyMem improves exact match by 13.8 points over TM, with gains across three readers. The controlled probe adds 11.0 points without routing. On full AMA-Bench, the routed system gives a smaller gain, from 69.8% to 71.1% (Table 2); gains vary across readers and trajectory splits. Executing specifications also exposes event-selection mistakes as the largest residual system-error category.

Our contributions are:

  1. A diagnosis of distinct access and aggregation bottlenecks using five readers and controlled event sets.

  2. Complementary mechanisms over a shared history: TM preserves and selects source evidence, while TallyMem compiles event specifications for deterministic aggregation over a reusable ledger.

  3. Held-out repository evaluation and controlled aggregation tests, alongside full-benchmark comparisons and analysis of residual event-specification errors.

References (66)