02Memory
Memory.
How agents remember: within a task, across runs, and across a whole project.
One agent can act. This chapter is what makes the whole system get smarter with every run instead of starting over.
AThe idea Introductory
Agents keep two kinds of memory: a small working memory for now, and a larger long-term memory for later.
Some things an agent needs only for the current step; others it should keep for hours, days, or across a whole project. Think of week three of a long design study: Monday's mesh settings still matter, and the reason a candidate was rejected in week one must not be forgotten.
Like short-term attention plus a notebook you can look things up in later.
- Working memory. What is on the desk right now, for the current step.
- Episodic memory. The diary: what happened in past runs, in order.
- Semantic memory. The facts and limits that stay true between runs.
- Procedural memory. The how-to recipes it has learned to reuse.
ExWhen you ask for it
- The ask. "Pick up last month's study where we left off."
- The recall. The agent does not re-read everything: it pulls the study goal, the last decision, and the two open questions from long-term memory into its working window.
- The pickup. It resumes mid-thought, like a colleague back from holiday with good notes: the next step already proposed, both open questions on the table.
→In plain terms
The context window is the desk: small on purpose. The agent keeps the few things that matter now on it, and the rest in drawers it can always open.
BHow it works Intermediate
Long-term memory has tiers, and only what is relevant is paged into the limited context window.
The context an agent can hold at once is small, so memory is organised so the right pieces can be pulled in on demand.
- Working. The live context for the current step.
- Episodic. A time-ordered log of past runs.
- Semantic. Stable facts, constraints and rules.
- Procedural. Reusable skills and how-tos.
Five layers the agent reasons with. Each holds a different kind of thing, and each has a job.
Working
what is on the desk now
The goal, the plan, recent tool outputs and intermediate results for the current run.e.g. "Optimize this resonator for 1.2 MHz while keeping stress below the limit."
Episodic
the diary of runs
What happened in previous runs: the actions taken, what worked, and what failed.e.g. "A similar geometry failed because a very thin domain broke the mesh."
Semantic
validated facts
Technical knowledge, specifications and relationships that stay true between runs.e.g. "This material's stiffness, and which parameter drives the damping."
Procedural
how-to recipes
Instructions, workflows and the correct way to use each tool.e.g. "Generate the geometry, mesh it, run the study, verify convergence."
Reflective
lessons learned
Strategies distilled from many past runs, above any single one.e.g. "For low-frequency designs, check thin domains before refining the mesh."
ExOne run's memory traffic
- Run starts: page in. The goal, the spec limit (semantic), last run's verdict (episodic) and the setup recipe (procedural) load into the window.
- While it works. Notes, intermediate results and tool outputs pile up in working memory; whatever stops being relevant is paged out to make room.
- Run ends: write back. The result and the decision become a new episodic record, a confirmed fact updates semantic memory, and a fix that worked is saved as a procedure.
- Later. Old episodes are consolidated into summaries, so next month's run pages in one page of lessons, not fifty transcripts.
→Where it actually lives, and how it comes back
The five layers are what the agent reasons with. Underneath, three durable stores hold the real thing, and one retriever ties them all together.
Agentic RAG
the retriever, every run
Searches every memory layer, your documents and company knowledge, then pulls back exactly what this run needs.e.g. before a run it retrieves the right process, tool settings, constraints and similar past cases.
Shared project memory
one project state
The common state every agent team can see, so nobody works from a stale picture.e.g. "Design 47 is the approved baseline; Design 42 was rejected."
Structured results
exact numbers, queryable
A database of precise results and experiment records the agents can query directly.e.g. "every approved design between 1.15 and 1.25 MHz with displacement above 4 um."
Code + artifacts
the real files
Versioned code, configurations, models, plots and reports, kept where they can be re-run.e.g. the numbers live in the database, the code in version control, and the full solver model in the file store.
ExWorked example
Picking up where it left off
Starting a new run on a device it has seen before, the agent pages in the relevant episodic memory (the last run results), the semantic facts (the material limits), and a procedural skill (the setup script), leaving everything else out of context.
→What it gives you
The agent never re-reads everything. It pulls just the few relevant memories into context.
CIn depth Advanced
Memory is a temporal knowledge graph with retrieval scoring, consolidation, and paging in and out under a fixed budget.
At scale, memory is not a flat list. It is a graph of facts linked over time, actively managed to stay relevant and small.
Temporal KG
linked over time
Facts are connected and time-stamped, so the agent knows what supersedes what.
Retrieval scoring
relevance + recency
Candidate memories are ranked, and only the top few are loaded.
Consolidation
summarise
Old episodes are merged and summarised so memory does not grow without bound.
Paging
in / out
Under a fixed token budget, relevant memory is paged in and stale detail paged out.
ExUnder the hood
The paging score
Before each turn, every candidate memory gets one score: how relevant it is to the live goal, plus how recently it was touched. The window is filled from the top of that ranking until the token budget is spent. Whatever loses is written back to the long-term store with its links intact, ready to be re-scored the moment the goal shifts.
score(m) = w1 * relevance(m, goal) + w2 * recency(m)
load top ranked while tokens(window) <= budget
losers: write back to store, keep links, stamp time
next turn: rescore everything, the ranking can flip
What this buys you: memory stays useful as it grows, so the agent recalls the right thing at the right time instead of drowning in its own history. When this goes wrong you would see the agent confidently citing a limit that was superseded weeks ago; the loop catches it by time-stamping every fact, so retrieval ranks the newer value above the stale one and the check step flags the mismatch.
→Why it matters
Relevant, current, bounded. The right memory arrives just in time, and stale detail is retired.
→Try it
Fill the agent's context window
Relevance beats volume.
The window is small on purpose. Memory's real job is pulling the few relevant facts in and leaving everything else out. Fill it with a lunch note and an old prototype and even a smart agent answers badly. Paging and retrieval scoring do this selection automatically, so the right few facts are in context at the right moment, and whatever is evicted goes back to the store, not to the bin.
Memory is what the agents keep. Knowledge is what they look up. Next: how our RAG grounds every answer.
