What OpenRouter means by agent memory
The post defines agent memory as "the information your application saves from earlier conversations and adds to new prompts, so an AI agent can use what it learned in past sessions".
It separates two problems:
- Short-term memory is the current session's transcript, sent with each request.
- Long-term memory is what your application stores when a session ends and puts back into later prompts.
It also separates memory from compaction. Shrinking an active transcript during a long task is a different problem. "This article is about carrying facts from session 1 into session 13 without resending every line of code written in between."
The four designs
OpenRouter says most applications use one of four designs:
| Design | What it sends | When the work happens |
|---|---|---|
| Full history | Every past message, every request | Nothing between sessions; the prompt grows |
| Summary notes | A short memory file in the system prompt | A model rewrites the file after each session |
| Retrieval | The closest few past messages for each question | Messages are embedded as they arrive |
| Notes plus retrieval | Both the notes file and retrieved messages | Both of the above |
Source: OpenRouter, December 4, 2026.
One distinction matters for the results. Retrieval sends original messages, so it "keeps exact strings, like a hostname or a date, that a summary might drop".
How the test was set up
OpenRouter wrote 12 synthetic sessions between a developer and a coding assistant, in two versions from two random seeds. Each version came to 95,000 to 130,000 tokens, depending on the tokenizer. Every session had 24 ordinary coding exchanges, with 19 facts, updates, and distractors planted at fixed points.
The facts included:
- A stable preference: "we use pnpm in this repo, never npm or yarn."
- A repo rule: "never push directly to main, always open a PR against develop."
- A one-time detail: a staging database host and port.
- Two updates: tests moved from Jest to Vitest in session 3, and the user moved from Lisbon to Berlin in session 7.
- A launch date, and three staging deploy failures in sessions 1, 3, and 9, all from an out-of-memory error in the build step.
The distractors were deliberately similar: a production database host, a teammate in Lisbon, an earlier launch date, an old Jest config, a production deploy failure, and two successful staging deploys.
In session 13, the agent got 8 questions with exact answers, each worded differently from the fact it tested. The runs used Claude Haiku 5.5, GPT-6 Luna, and DeepSeek V4.1 Flash, plus a no-memory baseline. Code scored 48 answers per design by exact match.
What the results show
| Design | Correct | Median prompt tokens |
|---|---|---|
| No memory | 0 of 48 | 261 |
| Full history | 46 of 48 | 97,341 |
| Summary notes | 47 of 48 | 639 |
| Retrieval | 47 of 48 | 785 |
| Notes plus retrieval | 47 of 48 | 1,163 |
Source: OpenRouter, December 4, 2026. Times and costs in the original post depend on its setup.
Three findings stand out.
Accuracy was close; prompt size was not. OpenRouter says it directly: "a one-point gap between 46 and 47 is noise. The real difference is prompt size."
The basics held in every design. "Every memory design got the stable preference, both updates, the staging host, the launch date, and the cause of the failures right in every run." Outdated facts weren't a problem when the notes writer was told to replace them.
Full history's cost grows with each session. OpenRouter's cost table lists it as the only design that "Grows every session". On one model, the history crossed a token threshold where the input price rises, and full history was the only design that crossed it.
Why the count broke
The question "How many times has the staging deploy failed, not counting production?" was the hardest. Across all memory runs, it was right 22 times out of 30.
The failures came in two kinds:
- Mixing up similar events. With full history, two models answered 4 on one seed "because they counted the production failure even though the question said not to". Retrieval made the same mistake once.
- Dropping the number. In one summary-notes run, the model answered "unknown". Its notes read "Staging builds have had reported OOM failures", with no number. OpenRouter's comment: "It kept the event and lost the count."
Notes plus retrieval was the only design that got the count right in all six runs.
The structured log made it worse
OpenRouter tried a sixth design: a JSON memory file with facts, rules, and an append-only list of events. It scored 43 of 48. The count was right in 2 of 6 runs, the event logs grew to between 24 and 79 entries, and the models "logged the same kind of failure differently from one session to the next". Each request also got bigger.
The conclusion is direct: "A model that summarizes or logs events will sometimes miss one or count one twice." For anything that needs counting or totaling, such as failed deploys or support tickets, OpenRouter recommends recording events "from your own code in a database table" and giving the agent a tool that queries it.
What the test doesn't settle
The post is careful about its limits, and they matter before you copy the design.
- Synthetic sessions. The 12 sessions were written for the test, not taken from real users.
- Small sample. With 48 answers per design, OpenRouter itself treats a one-point gap as noise.
- One kind of workload. The sessions are a developer working with a coding assistant. Other domains may plant facts differently.
- Untested split. OpenRouter suggests a smaller model could write notes for a larger agent model, but says "We didn't test the split setup".
- Word limits drift. The notes instruction said under 250 words; "the files ran from 170 to 340".
How this maps to memory you already use
The test is about apps you build, but the same pieces show up in assistants you use every day, as their vendors document them.
Claude saves memory "as a set of individual topics as you chat, rather than summarizing conversations after they end", and on paid plans it can also search past chats. Anthropic says those searches "use Retrieval-Augmented Generation (RAG)". That's a notes-style store alongside retrieval over past conversations.
Claude Code keeps an auto memory with a MEMORY.md index. The first 200 lines or 25KB load at the start of a session, and topic files are read on demand. That's a notes file with a size cap.
OpenRouter's test didn't cover these products, so the results don't transfer directly. The lesson that does transfer: notes can keep an event and lose its number. If a count matters to you, write the number down yourself.
For the broader difference between memory and retrieval, see AI memory vs RAG.
What people try first
Replaying the whole history. It scored about the same while sending far more tokens.
Asking the summarizer to keep counts. In the test, a model kept the event and dropped the number.
Switching to a structured JSON log. It scored lower and made requests bigger.
Trusting retrieval with counting questions. Retrieval also counted the wrong failure once.
Skipping update instructions. The test told the notes writer to replace changed facts, and every model handled both updates.
The Fix: Build memory the way the test suggests
Step 1: Start with summary notes
Have a model rewrite a short memory file after each session, and tell it to replace outdated facts.
Step 2: Cap and check the notes
Set a word limit and measure it, since the test's files drifted past theirs.
Step 3: Add retrieval for exact details
Embed past messages and label each with its session number or date, so the model can pick the newest value.
Step 4: Keep counts in code
Log countable events from your app into a database table and give the agent a query tool.
Setting this up in MemoryLake
OpenRouter's test is about what an app should store between sessions. If you work across several assistants rather than one app, the same question applies to you: which facts should carry from one session to the next, and who keeps them current.
MemoryLake is a memory layer for that context, kept in one place you maintain and available to the assistants you connect, such as ChatGPT, Claude, Claude Code, and Codex.
You write the entries yourself. Nothing is read out of, written to, or deleted from your chats, Claude's memory, ChatGPT's memory, Claude Code's auto memory, or any vendor's store. Each assistant's memory works the way its vendor describes it.
Step 1: Create an API key
Sign in and generate a key from the dashboard. Keep it somewhere private.

Step 2: Upload your first memories
Start with the kinds of facts the test planted: stable preferences, repo rules, one-time details, and the current value of anything that changed.

Step 3: Connect your AI & agents
Connect the assistants you use, so the same facts are there in each new session.

What this changes in practice
The first difference is shorter prompts. A curated set of facts replaces replaying old conversations.
The second is fewer stale answers. When you replace a changed fact yourself, the old value doesn't linger next to the new one.
The third is honest counts. Numbers you track yourself don't depend on a summarizer keeping them.
Best practices for agent memory
Write facts as current values. Replace, don't append, when something changes.
Label anything retrieved with a date or session. It lets the model choose the newest value.
Keep counts and totals in a database. Query them with a tool.
Test with your own sessions. Plant updates, distractors, and counts, and score by exact match.
Separate run state from memory. OpenRouter's post treats saving one run's state and carrying facts across sessions as different jobs.
Watch prompt size as sessions add up. Full history grows; notes stay about the same size.
Conclusion
OpenRouter's test gives builders a clear starting point. Summary notes, retrieval, and their combination recalled facts as well as full history while sending a fraction of the tokens. Every design kept stable facts and updates when told to replace outdated values.
Counting events across sessions was the weak spot, and a structured log didn't fix it. The practical rule is to let memory hold facts and let your own code hold counts.