All chaptersChapter 2 of 3
Level

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.

MEMORY a small now, a large laterAgentreads + writesWorking memorynowLong-term memorylater: facts, past runs, skillsread / writeread / write
Short-term and long-term. A small working memory holds the current task; a larger long-term memory keeps what was learned for later.
  1. Working memory. What is on the desk right now, for the current step.
  2. Episodic memory. The diary: what happened in past runs, in order.
  3. Semantic memory. The facts and limits that stay true between runs.
  4. Procedural memory. The how-to recipes it has learned to reuse.

ExWhen you ask for it

  1. The ask. "Pick up last month's study where we left off."
  2. 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.
  3. 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.

TIERS + CONTEXT page in only what is relevantContext windowlimitedfreeWorkinglive contextEpisodicpast runsSemanticfacts + rulesProceduralskillspage in relevant
Tiers, paged into context. Memory is split into working, episodic, semantic and procedural tiers; only the relevant few items are paged into the fixed-size context window.
  1. Working. The live context for the current step.
  2. Episodic. A time-ordered log of past runs.
  3. Semantic. Stable facts, constraints and rules.
  4. 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

  1. Run starts: page in. The goal, the spec limit (semantic), last run's verdict (episodic) and the setup recipe (procedural) load into the window.
  2. While it works. Notes, intermediate results and tool outputs pile up in working memory; whatever stops being relevant is paged out to make room.
  3. 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.
  4. 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.

workingepisodicsemanticprocedural

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.

MEMORY GRAPH retrieve, score, page, evictpage inpage outtimet+2dt+9dsumconsolidatemerged summaryContext windowfixed token budgetpage in (retrieve, score)page out (evict stale)Discardedstale detail
Relevant, current, bounded. Facts are linked over time in a knowledge graph; retrieval ranks by relevance and recency, stale detail is paged out, and older episodes are consolidated.

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

Ranked
memories are scored by relevance and recency; only the top few load, so week three of a study feels as sharp as day one.
Consolidated
old episodes are merged and summarised over time; a month of runs becomes one page of lessons.
Bounded
under a fixed budget, stale detail is paged out, set aside in the store rather than deleted.

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.

BUDGET what shares the window this turnone context window (fixed budget)paged IN this turnworking: the live taskepisodic: recent runssemantic: facts + rulesprocedural: how-to recipesevict + retrieve laterevicted to long-term store
A fixed window, spent deliberately. Illustrative split: the tiers compete for one budget; losers are paged out to the store, not lost.

Why it matters

Relevant, current, bounded. The right memory arrives just in time, and stale detail is retired.

Try it

1
Memory: what to keep in mind

Fill the agent's context window

The agent must answer: will this beam pass at 85 C?
the context window holds only 3 items. pick the 3 that matter.
Memory: drag or tap three into the slots
1 context slot
2 context slot
3 context slot

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.