W
WisyLink
ProductPricingAPIBlogContact
All posts

WisyLink Blog

agent-memorycontext-windowlasting-memoryepisodic-memoryretrievalsummarization

Agent Memory: How Context Is Kept Across Sessions

When an agent goes beyond a single conversation, what it remembers is a design decision. Working memory versus lasting memory, retrieval precision, and the value of forgetting.

Jun 8, 202611 min read
Agent Memory: How Context Is Kept Across Sessions

Agent memory is a system's ability to carry information from earlier interactions beyond a single conversation and use it in later decisions. A system that forgets everything when a session ends starts from scratch every time; one that carries context binds the past to the present β€” but that bond is not automatically a gain. The real question is not what it remembers, but what it finds worth remembering. Through 2026, the field has focused on how that choice is made.

Because every remembered thing carries a cost. The longer a piece of information is kept, the greater the chance it will be recalled at the wrong moment.

  • Short-term working memory carries the task at hand; long-term memory extends beyond sessions.
  • The context window is finite, so remembering is often compressing by summarizing.
  • Episodic memory holds what happened; semantic memory holds what is true.
  • Recalling a wrong memory can be more disruptive than remembering nothing at all.
  • Every memory goes stale over time; yesterday's truth can become today's falsehood.
  • Forgetting is not a flaw β€” it is a deliberate design decision.

What does an agent remember across sessions?

Cross-session memory names information that is carried even after a conversation ends and can be retrieved again in a later encounter. In a one-shot interaction the system looks only at the text in front of it, and when the work is done everything dissolves. In a system that carries context, some traces remain β€” and which traces remain is a decision made up front.

Two layers need to be distinguished here. Temporary information held mid-task and lasting information carried from one task to another are not the same thing. The first is the material of the job at hand and loses meaning when the job ends; the second is a ground that accumulates over time, belonging to a person or a piece of work. Mixing the two leads to treating a temporary note as a lasting fact.

Which information is worth making permanent is not as easy a question as it seems. A preference, a constraint, a past decision can stay useful for a long time; a momentary detail should be used once and left behind. Healthy memory does not accumulate everything. The more accurate the choice of what to keep, the less noise the system carries β€” and the fewer wrong memories it later recalls.

Another subtlety hides in the direction of remembering. Recording information is not enough on its own; that information must later be findable again at the right moment. A system that keeps a great deal but can retrieve little of it is not really remembering. That is why cross-session memory is not a storage problem but an access problem β€” and the real design burden collects on the access side.

Why separate working memory from lasting memory?

Working memory is the temporary information an agent holds to complete the current task; lasting memory is information that persists across sessions and is recalled when needed. The first is fast to access but narrow and short-lived; the second is broad, but not every piece is available at every moment. Keeping these two layers apart is not fussiness β€” it is a necessity.

The reason for the separation is this: holding a detail that belongs to the current job and a lasting truth in the same place damages both. If temporary information leaks into the lasting layer, a one-off situation starts behaving like a permanent rule. Conversely, if lasting information is held only in working memory, it disappears when the session closes and the system has to learn the same thing again and again.

In practice, well-built systems define a promotion decision between these two layers. Information in working memory is promoted to lasting memory only when it crosses a certain threshold. That threshold looks at how often the information proves useful, how generally applicable it is, and how durable it is. If promotion is too loose, lasting memory fills with junk; if it is too strict, the system cannot hold on to important things. The balance between the two is memory's real design load.

DimensionStateless one-shotAgent with lasting memory
Lifespan of informationEnds with the sessionExtends beyond sessions
Starting pointFrom scratch every timeFrom accumulated ground
Core riskRebuilding context again and againRecalling a wrong memory
Maintenance loadAlmost noneManaging staleness and noise

When the context window fills, what does remembering become?

The context window is the finite bound on how much information a system can hold in front of itself at once. That bound always exists, and when the past grows long enough, carrying everything as-is becomes impossible. Remembering then stops being about storing raw history and turns into compressing it by summarizing. Memory, then, is not an accumulating pile but a continually rewritten distillation.

Remembering by summarizing has a cost. Compression is always a loss; reducing a conversation to a few sentences means sacrificing every detail those sentences do not hold. The problem is that what will need to be sacrificed cannot be known in advance. A detail that looks unimportant today and gets dropped may be exactly what is needed tomorrow β€” and the summary has already erased it.

That is why the field treats the tension between keeping raw history and keeping a summary as a balance. Raw history loses nothing but hits the limit quickly and makes finding the right piece harder. A summary is light but dulled. Mature approaches layer the two: recent past in detail, distant past in compressed form. That way the system both protects current detail and is not crushed under the weight of distant history. The real skill is knowing how much to distill of what.

Distillation also has a direction problem. A summary drawn without knowing which question it will serve goes blind β€” because every summary carries an implicit decision about what to foreground and what to push back. If a future question does not land on the axis the summary kept, compression has erased exactly the detail being sought. So as necessary as compressing is, knowing what you are compressing for is equally necessary.

How do episodic and semantic memory diverge?

Memory has two different jobs, and thinking of them separately clarifies design. Episodic memory holds what happened when: which decision was made in a particular encounter, what was mentioned, what was asked for. Semantic memory holds lasting truths abstracted from events: a preference, a rule, an unchanging constraint. One is historical; the other is independent of time.

This distinction makes a practical difference. An episodic memory is tied to a specific past moment and becomes misleading if recalled outside that context. A semantic memory remains valid detached from context, because it describes a general condition rather than an event. Mixing the two leads to treating something that happened once as a permanent rule.

The two memories also age differently. An episodic memory is still valid years later, because something that happened in the past remains something that happened; what changes is only how much it touches today. A semantic truth, by contrast, can silently turn false when conditions change, and so needs regular testing. Keeping memory healthy means managing these two layers not by the same measure, but by their own rates of aging.

Working memory
Temporary information held briefly to sustain the current task, losing meaning when the task ends.
Episodic memory
A historical trace of what happened in a particular encounter β€” which decision was made at which moment.
Semantic memory
Lasting truths and rules abstracted from events, remaining valid independent of time.
Retrieval precision
The rate at which the right memory β€” not the wrong one β€” can be brought back when a moment requires it.

Why is recalling a wrong memory worse than remembering nothing?

Retrieval precision is the measure that determines a memory's real value. No matter how much a system accumulates, if it cannot bring the right piece at the needed moment, that accumulation becomes a burden. Worse still, recalling a wrong memory as if it were true is more disruptive than remembering nothing, because it seats the system on a wrong foundation with a confident tone.

The reason is hidden in how trust works. A system that remembers nothing at least shows that it does not know and behaves carefully. A system that remembers wrongly starts from a faulty foundation rather than an incomplete one, and that error is silent β€” because from the outside it looks like self-assurance. Silent errors are always more dangerous than noisy ones.

That is why mature systems take retrieval out of the realm of chance. Before a memory is recalled, whether it truly belongs to that moment, whether it is still valid, and how reliable it is are weighed. When the risk of imprecise retrieval is high, not recalling at all is often the safer choice. A memory's quality is measured not by how much it holds, but by how often it brings the wrong piece.

That measure also directly contradicts the urge to accumulate. As memory grows, similar, partly overlapping, sometimes contradictory memories multiply inside it, and choosing the right piece gets harder. So remembering more, counterintuitively, raises the risk of remembering wrongly. Mature memory therefore treats growth not as a success but as a tension to be managed β€” because every new memory can also become a source of noise at the moment of retrieval.

In what order does healthy memory learn to forget?

Staleness is a memory losing its validity over time; information that was true yesterday may no longer hold today. If a memory does not account for this, it contradicts itself between old truths and new realities and errs silently. That is why forgetting is not a flaw of memory but a design decision that keeps it alive. The sequence below is not a product recipe; it is a priority order the field has reached through experience.

  1. First attach a validity attribute to every memory; when and under what condition a piece of information was kept determines how much it can later be trusted.
  2. Separate episodic traces from semantic truths; a historical moment must not behave like a permanent rule.
  3. Gradually reduce the weight of little-used and aging memories; not everything can be kept at the same freshness.
  4. When two conflicting memories meet, prefer not the newer but the more durable and more valid one.
  5. Before retrieval, weigh whether the memory is still valid; if doubtful, do not recall it at all.
  6. Retune the boundaries through use; what to keep is not fixed β€” it is something learned over time.

The value of this sequence is that it treats forgetting as maintenance rather than loss. A memory that discards nothing is eventually crushed under its own noise. A memory that forgets deliberately stays light and finds the right piece more easily when needed. The real skill is knowing what to leave behind as much as knowing what to keep.

Forgetting also has an irreversibility side. A discarded memory does not return, so deleting and demoting are not the same thing. Healthy systems often prefer slowly reducing a memory's weight over a sharp delete; that way old information is pulled into the background without being wholly erased. When forgetting is a gradual fade rather than a sudden cut, noise decreases and the door back is not shut completely.

The path ahead for agent memory

What gets harder from here is not teaching agents to remember more, but teaching them to forget better. Accumulating is easy; the question the field is really working on is when a piece of information is worth carrying and when it becomes a burden. This is sliding from a capacity question toward a choice question.

Teams making good progress in the field tend to measure retrieval precision rather than memory size. They treat a memory's staleness as a design input and count forgetting as an alignment tool rather than a deficiency. They weigh success not by how much is held, but by how rarely a wrong memory is recalled.

Another thing that gets harder is keeping memory consistent with itself over time. When a system runs long enough, it accumulates memories that contradict its own past, and carrying those contradictions silently leads to unexpected decisions later. The maturing view is to see memory not as a store set up once and left alone, but as a living structure continually reviewed, with the old sorted from the new. An unmaintained memory eventually becomes the largest source of noise.

In the period ahead, real maturity seems to lie not in giving agents a wider memory, but in drawing more carefully what that memory will carry and what it will leave behind. The stateless era taught the cost of rebuilding context every time; the memory-bearing era is teaching how to question a memory's validity. What the field is slowly realizing is this: the hard part was never teaching an agent to remember. The hard part was knowing what it ought to forget.

F.A.Q.

Frequently asked questions

What is the difference between working memory and lasting memory?
Working memory is temporary information held briefly to complete the current task and loses meaning when the task ends. Lasting memory extends beyond sessions and is recalled when needed. Keeping them separate prevents a one-off situation from behaving like a permanent rule.
How does memory work when the context window fills up?
Because the context window is finite, carrying everything as-is becomes impossible once the past grows long. Remembering then shifts from storing raw history to compressing it by summarizing. Mature approaches keep recent past in detail and distant past in distilled form.
How do episodic and semantic memory differ?
Episodic memory is a historical trace of what happened when, tied to a specific moment. Semantic memory holds lasting truths abstracted from events and remaining valid independent of time. Mixing the two leads to treating a once-lived situation as a permanent rule.
Why is recalling a wrong memory dangerous?
A system that remembers nothing shows that it does not know and behaves carefully. A system that remembers wrongly starts from a faulty foundation and does so with a confident tone. That silent error is more disruptive than incomplete information, because from the outside it looks like self-assurance.
Why is an agent's forgetting a design decision?
Memories go stale over time; information that was true yesterday may no longer hold today. A memory that discards nothing is crushed under its own noise and contradicts itself between old truths and new realities. Forgetting deliberately keeps memory light and makes finding the right piece easier.
Share
XLinkedInFacebook
On this page
  1. What Cross-Session Memory Means
  2. Working Memory vs Lasting Memory
  3. When the Context Window Is Finite
  4. Episodic vs Semantic Memory
  5. The Cost of Recalling Wrong Memories
  6. Designing Forgetting
  7. The Direction of Memory Design

Documentation

  • Overview
  • API
  • CLI
  • GitHub
  • npm

Blog

  • Explore the blog
  • Same Prompt, Different Output: Reproducibility in Production
  • Proving the Origin of Machine-Generated Media
  • Context Engineering: From Prompt Polishing to Information Architecture
  • Tool-Using Agents: AI Moving from Answering to Acting

Legal

  • Privacy
  • Terms
  • Company

Product

  • Capabilities
  • Pricing
  • Contact
  • Engineering
WisyLink Β© 2026Β·
Built with ❀️ by our team