Context, State, Memory and Knowledge
In this article
- Place a piece of information in one of four homes (the request, authoritative state, memory or shared knowledge) and say why it belongs there.
- Tell memory from knowledge by asking whose fact it is, who may change it, how long it lives and how it is read back.
- Decide which copy wins when the same fact sits in a chat, a memory record and a system of record and they disagree.
- Terms defined here: agent memory, external knowledge.
Overview
A customer opens a support chat. The assistant greets them in Spanish, which is right: they asked for that last month. Then it says their refund is still pending, which is wrong: the refund was paid yesterday. Both answers came from the same request, and the difference has nothing to do with the model.
Every assistant that outlives a single request has to decide where each piece of information lives: in the request itself, the application's authoritative state, memory or shared knowledge. Memory and knowledge are the two most often mixed up, and the costliest mistake is treating memory as the record.
Four homes for one chat
Brightline, an invented home-internet provider, runs a support assistant: a model plus the application around it. The company, its orders and its pages are made up. In one chat, four items show up:
- the refund status of order 8841;
- the last few turns of this conversation;
- the customer's wish that replies come in Spanish;
- the help page saying the router can be returned within 14 days.
None of them lives in the model. On each call the model sees only the model-visible context, whatever the application put into that request's context window. Claude Code's docs say it plainly: every session starts with a fresh context window, and what carries over is stored in files and loaded back [1].
Before you look at the table, try placing the four items yourself.
| home | item | owner | lifetime | written by | read back by |
|---|---|---|---|---|---|
| context (the request) | last few turns | this session | until the session ends | the application, rebuilt for every call | the model, on that call |
| authoritative state | refund status of order 8841 | the order system | as long as the order | the order system, when the refund is processed | key: the order number |
| memory | replies in Spanish | this customer | across conversations | the assistant, in one conversation | key: the customer, at the start of a later chat |
| knowledge | 14-day router return window | Brightline, for every customer | until the page is edited | the help-page editors | search: a query |
Authoritative state is the order system's record: it is correct because the code that processes refunds is the code that changes it.
Memory: one customer's claim, written by the assistant
Memory is what the assistant writes down about one user so a later conversation can find it again. Three properties define it, and the Spanish preference has all three. It has an owner: this customer, and no one else's chats read it. It has a write path: the assistant (or a job around it) writes the record during or after the conversation in which the customer asked. It has a lifetime longer than the session: it is read at the start of next month's chat.
So memory has an owner, a write path and a lifetime.
Frameworks draw the same boundary. Google's Agent Development Kit (ADK) separates a Session, one ongoing conversation whose Events are its turns and whose session.state holds data for that conversation only, from MemoryService, which takes in information, often from finished sessions, and lets the agent search it later [2]. LangGraph files long-term memories under a namespace that often includes the user's id, and recalls them from any thread [3]. Microsoft's Agent Framework makes the owner explicit: its Python file memory gets a separate folder per session unless you pass a stable scope such as a user id, and only then do sessions share it [4].
When the customer says "reply in Spanish", ADK would first see it as session data, valid for this conversation [2]. It becomes memory only when something writes it to a store a later conversation reads. Memory is a deliberate write, not a side effect of chatting.
Knowledge: shared text the chat reads but never writes
Knowledge is information from outside the conversation, held in a collection the assistant searches for what it needs. Brightline's help pages are a corpus: they belong to the company, every customer gets the same 14 days, and only the editors change them. When a passage reaches the model because it matched the question, it arrives as retrieved evidence.
Telling memory from knowledge
Four questions settle almost every case:
- Whose fact is it: one user's, or everyone's?
- Who may change it: that user and the assistant, or the people who maintain a shared source?
- How long does it live: until the user changes their mind, or until the source is edited?
- How is it read back: by the user's key, or by a search across everything?
The Spanish preference: the customer's, changed by the customer, lives until they say otherwise, read by their key. Memory. The return window: everyone's, changed by editors, lives until the page changes, found by searching "return router". Knowledge.
Ask one question before these four: does a system of record already own the fact? The refund status is about this one customer, yet it is not memory, because the order system owns it and changes it. The same goes for a billing address or a contract plan. A user's own fact belongs in memory only when no system keeps it.
The fourth question is a hint, not a law. LangGraph's store can fetch a memory by its key or search memories by meaning, so being searched does not make something knowledge [3]. Ownership decides.
The rules fit in a few lines of Python:
def home(fact):
if fact["kept_by"]:
return "authoritative state"
if fact["lives"] == "this session":
return "context"
if fact["whose"] == "one customer":
return "memory"
return "knowledge"
FACTS = [
{"name": "refund status, order 8841", "kept_by": "order system",
"whose": "one customer", "lives": "until the order closes"},
{"name": "last few turns", "kept_by": None,
"whose": "one customer", "lives": "this session"},
{"name": "replies in Spanish", "kept_by": None,
"whose": "one customer", "lives": "across conversations"},
{"name": "14-day router return window", "kept_by": None,
"whose": "every customer", "lives": "until the page changes"},
]
for fact in FACTS:
print(f"{fact['name']:<30} -> {home(fact)}")
copies = [
("earlier turn", "pending", False),
("order system", "refunded", True),
]
winner = next(c for c in copies if c[2])
print("answer with:", winner[1], "from", winner[0])refund status, order 8841 -> authoritative state
last few turns -> context
replies in Spanish -> memory
14-day router return window -> knowledge
answer with: refunded from order systemThe order of the checks matters: the owner first, lifetime second, and only then one user versus everyone.
When copies disagree
One fact can sit in several homes at once, and only one copy is authoritative. Follow order 8841. On Monday the assistant reads the order system, gets "pending", and says so; that reply is now a turn in the conversation. On Tuesday the order system processes the refund. On Wednesday the customer asks again, and before the model answers, the application copies the current status into the request as plain text. The model now sees:
earlier turn (Monday): assistant: Your refund on order 8841 is pending.
order system (Wednesday): order 8841 refund_status: refundedThe Monday turn was true when it was written and went stale the moment the refund was processed. The Wednesday line comes from the system that processes refunds and was read just now. The order system wins, and the assistant should say the refund is done.
Memory follows the same rule. A memory record is a stored claim: it can be old, it can be the assistant's own inference, or it can be wrong. When memory or chat text disagrees with the order system or the help pages, the system of record and the help pages win. In production this shapes two decisions. Read live facts from their owner at answer time rather than from an earlier turn or a memory. And never let memory hold the official value of an order, a refund or a policy, because nothing keeps that copy current.
Common mistakes
- Calling every vector store "memory". An embedding index of the help pages is knowledge, though it is searched the way memory can be. LangChain makes the same distinction: semantic memory means stored facts, semantic search is a way to find text by meaning [3]. ADK even calls its memory store a long-term knowledge store [2], so judge by owner and write path, not by the name a framework uses.
- Saving a guess as a fact. The assistant thinks the customer "seems to be on the fibre plan" and writes that to memory; next month it gives fibre advice for a cable line. A guess made for one reply stays in that request, and the plan belongs to the account system.
Sources
- How Claude remembers your project. Anthropic. Checked 24 Oct 2026.
- Conversational Context: Session, State, and Memory (ADK docs). Google (adk-docs). Checked 24 Oct 2026.
- Memory overview (LangGraph/LangChain docs). LangChain (langchain-ai/docs). Checked 24 Oct 2026.
- Context providers (Agent Framework). Microsoft. Checked 19 Nov 2026.
Check yourself
Check yourself
Question 1 of 13
You need a customer's current account balance. Where is the authoritative copy?
Your first check counts towards your result.