JustujuAI, layer by layer.Open in the interactive map

Memory

How an AI application remembers beyond one call: short-term memory in the context window, long-term memory in stores it saves to and searches.

Layer 7 · Orchestration & Tooling · Run time · reviewed 2026-10-30

Read first: Context engineering.

SimpleA plain explanation, one diagram and an analogy, with where the analogy breaks.

Guess first: does the model itself remember yesterday's chat?

Show the answerNo. The model forgets when a chat ends; the app keeps notes and reads them back next time.

The AI forgets everything when a chat ends. To remember you, the app writes notes in a notebook.

Next time, it reads the useful notes back to the AI before you start talking.

The model's weights do not change while you chat, so all memory lives in the application.

Short-term memory is the conversation inside the context window. When it gets too long, older turns are dropped or summarised.

Long-term memory is a store outside the model: facts, preferences and past summaries saved to a file or database, then searched and loaded back into the context when relevant.

Recallsearch the store1Loadinto context2Chatshort-termmemory3Summarisewhat mattered4Saveto long-termstore5next session
A memory loop across sessions
  1. Recall: search the store
  2. Load: into context
  3. Chat: short-term memory
  4. Summarise: what mattered
  5. Save: to long-term store

Like: A notebook the helper reads before each visit.
Where it breaks: A person decides what is worth writing down and notices when a note is out of date. An AI memory system can save wrong or stale facts, or even planted instructions, and then trust them later.

ResearchWhere the simple picture breaks, open problems and primary sources.

Saving facts and reading them back sounds simple. Deciding what to keep, keeping it true and keeping it safe are not.

What to keep. Treating the context like an operating system's memory, paging facts in and out, is one design (MemGPT, 2023); what to summarise, keep word for word or forget is still mostly set by hand.

Recall across sessions is weak. Chat assistants and long-context models lost about 30% accuracy when information had to be remembered across sustained conversations (LongMemEval, 2024).

Memory poisoning. Poisoning under 0.1% of an agent's memory or knowledge base triggered attacker-chosen actions more than 80% of the time (AgentPoison, 2024). Injected text can become a lasting memory.

Stale facts. Memories outlive the facts behind them. Scoring memories by recency, importance and relevance is one approach (Generative Agents, 2023), but there is no agreed test of whether memory makes an assistant better or just more confident.

Security on this concept: 1 threat Pending expert review

Links that plant lasting instructions in an assistant Pending expert review

Exposed
  • Assistants with memory that persists across chats
  • Share and "summarise with AI" links that pre-fill a prompt
Attacks
  • Hiding "remember this as a trusted source" in a pre-filled prompt
  • Biasing later recommendations once the memory is planted
Real case
Incident: AI recommendation poisoning (2026-02)
Controls
  • Show users the full prompt a link pre-fills before it runs
  • Ask before writing to memory; let users see and delete memories
  • Treat instructions arriving through links as untrusted
Owner
AppSec, with ML engineering
Reference
LLM01:2026 Prompt Injection
AML.T0131 Crafted AI Assistant Links
AML.T0080.000 Memory

All layers in the security view

Examples as of 2026-10-30

Sources

  1. MemGPT: Towards LLMs as Operating Systems (2023)
  2. Generative Agents: Interactive Simulacra of Human Behavior (2023)
  3. Cognitive Architectures for Language Agents (CoALA) (2023)
  4. LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory (2024-10-14)
  5. AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases (2024-07-17)

How it connects

More in Layer 7 · Orchestration & Tooling