Skip to main content

What should an agent remember before it retrieves?

A dense retriever usually embeds the current query and ranks a fixed candidate set. A tool-using agent has more information: the searches it already tried, files it opened, tool arguments it sent, responses it observed, and failures accumulated earlier in the same session.

This project asks a narrow question:

Can a causal summary of that chronological state improve the query side of a frozen dense retriever when predicting the next tool argument?

The main task is next-argument retrieval from public Hermes reasoning traces. The frozen encoder is BAAI/bge-m3; the learned component is a lightweight query-side residual. Candidate embeddings stay fixed.

Why the separation matters

An in-distribution gain can come from at least three different sources:

  1. Current-query semantics — what the user or agent asks now.
  2. Chronological state — what happened earlier in this session.
  3. Target frequency — which arguments appeared often in training.

Calling all three “memory” would overstate the result. The implementation therefore exposes state and target-frequency priors as different score terms and reports each ablation separately.

What the evidence currently supports

  • Maintained session state improves the main Hermes search-query task over a reset-state control.
  • A separated target prior produces a larger in-distribution gain than the state residual alone.
  • Results depend on target type, candidate vocabulary, and tool distribution.
  • Support gating is not no-loss under tool shift.
  • External TAU-bench performance is bounded by low train-only candidate coverage.

What this project is not

This repository is not a production retrieval SDK, a general agent-memory benchmark, or evidence that every history item should be retained. It is a reproducible research package built to keep positive findings, counterexamples, and provenance-linked artifacts together.

Continue with the method, or go directly to the results.