Semantic Memory
Semantic memory is the store of facts that an agent keeps: facts about the world, about its user, and about itself. For a tester, it is the part of an agent that can remember a wrong fact, keep an old fact, or show a fact to the wrong user.
6 min read6 মিনিটে পড়া যায় · 7 sections7টি সেকশন · 4 sources4টি সোর্স · updated Oct 2026আপডেট: Oct 2026
Facts that survive a sessionসেশন পেরিয়েও টিকে থাকা fact
Save a fact in session 1, use it in session 2, then update it without duplicates.সেশন 1-এ একটা fact সেভ করুন, সেশন 2-এ ব্যবহার করুন, তারপর duplicate ছাড়া সেটা আপডেট করুন।
You’ll learnআপনি শিখবেন
- How a fact is saved and read backfact কীভাবে সেভ হয় আর ফেরত পড়া হয়
- Why a later session can use a factপরের সেশন কেন fact ব্যবহার করতে পারে
- How insert only makes conflicting factsশুধু insert কীভাবে বিরোধী fact বানায়
- Why a test needs more than one sessionটেস্টে কেন একাধিক সেশন লাগে
In plain words
Semantic memory holds what an agent knows about the world and about itself Source 1সোর্স 1. It stores facts, not events. "The project uses Python" is a fact. "Yesterday the user asked about a failed test" is an event. Events belong to episodic memory.
Many agents use semantic memory to remember facts about a user from past conversations. This makes the answers personal Source 3সোর্স 3.
The 7 names of this module follow the infographic "7 Types of Agent Memory". Research papers group memory in a different way. The CoALA paper has a working memory and three long-term memories: episodic, semantic, and procedural Source 1সোর্স 1. Semantic memory is one of the names that both groupings share.
সহজ English
Semantic memory is what an agent knows about the world and about itself Source 1সোর্স 1. It keeps facts, not stories. "The project uses Python" is a fact. "Yesterday the user asked about a failed test" is a story about one moment. Stories go into episodic memory.
Many agents keep facts about you from earlier chats, so that the answers fit you Source 3সোর্স 3.
The 7 names in this module come from the infographic "7 Types of Agent Memory". Research papers sort memory in another way. The CoALA paper has a working memory and three long-term memories: episodic, semantic, and procedural Source 1সোর্স 1. Semantic memory is in both lists.
বাংলা ব্যাখ্যা
Semantic memory হলো agent দুনিয়া সম্পর্কে এবং নিজের সম্পর্কে যা জানে, তার ভান্ডার Source 1সোর্স 1। এখানে তথ্য (fact) থাকে, ঘটনা নয়। "প্রজেক্টটা Python ব্যবহার করে" একটা fact। "গতকাল ইউজার একটা failed test নিয়ে জিজ্ঞেস করেছিলেন" একটা ঘটনা। ঘটনা থাকে episodic memory-তে।
অনেক agent আগের কথোপকথন থেকে ইউজার সম্পর্কে fact মনে রাখতে semantic memory ব্যবহার করে। এতে উত্তর আপনার জন্য ব্যক্তিগত হয় Source 3সোর্স 3।
এই module-এর ৭টি নাম "7 Types of Agent Memory" infographic থেকে নেওয়া। Research paper-গুলো memory-কে অন্যভাবে ভাগ করে। CoALA paper-এ একটা working memory এবং তিনটা long-term memory আছে: episodic, semantic, আর procedural Source 1সোর্স 1। Semantic memory নামটা দুই ভাগেই আছে।
Where it comes from
The term comes from psychology. In people, semantic memory is memory for general facts and concepts. It gives information its meaning Source 2সোর্স 2. Endel Tulving defined the term in 1972 Source 2সোর্স 2. Many theorists see it as one of two kinds of declarative memory. Episodic memory is the other kind Source 2সোর্স 2.
The CoALA paper takes the term to AI agents. In CoALA, semantic memory stores the agent's knowledge about the world and itself Source 1সোর্স 1. CoALA also says that retrieval-augmented generation (RAG) reads from a semantic memory, for example a corpus of unstructured text such as Wikipedia Source 1সোর্স 1.
This module has a separate topic, retrieval memory, because the infographic lists it as its own type. CoALA does not have a type with that name. In CoALA, a RAG corpus is part of semantic memory Source 1সোর্স 1.
LangChain makes one more point. "Semantic memory" names what you store: facts and knowledge. "Semantic search" names a way to find data by meaning, not by exact words Source 3সোর্স 3. The two terms are not the same.
সহজ English
The word comes from psychology. In people, semantic memory is memory for general facts and ideas. It is what gives information its meaning Source 2সোর্স 2. Endel Tulving defined the word in 1972 Source 2সোর্স 2. Many experts say it is one of the two kinds of declarative memory. The other kind is episodic memory Source 2সোর্স 2.
The CoALA paper uses the same word for AI agents. There, semantic memory keeps what the agent knows about the world and about itself Source 1সোর্স 1. CoALA also says that RAG reads from a semantic memory, such as a big set of plain text like Wikipedia Source 1সোর্স 1.
This module has its own page on retrieval memory, because the infographic lists it as a separate type. CoALA has no type with that name. For CoALA, a RAG text collection is part of semantic memory Source 1সোর্স 1.
LangChain adds one more point. "Semantic memory" is about what you keep: facts and knowledge. "Semantic search" is a way to find things by meaning, not by the exact words Source 3সোর্স 3. They are two different things.
বাংলা ব্যাখ্যা
শব্দটা এসেছে psychology থেকে। মানুষের ক্ষেত্রে semantic memory হলো সাধারণ fact আর ধারণার স্মৃতি। এটাই তথ্যকে অর্থ দেয় Source 2সোর্স 2। Endel Tulving ১৯৭২ সালে শব্দটার সংজ্ঞা দেন Source 2সোর্স 2। অনেক তাত্ত্বিক একে declarative memory-র দুই রূপের একটা মনে করেন। অন্যটা হলো episodic memory Source 2সোর্স 2।
CoALA paper শব্দটাকে AI agent-এ নিয়ে আসে। CoALA-তে semantic memory agent-এর দুনিয়া আর নিজের সম্পর্কে জ্ঞান রাখে Source 1সোর্স 1। CoALA আরও বলে, retrieval-augmented generation (RAG) একটা semantic memory থেকে পড়ে, যেমন Wikipedia-র মতো unstructured text-এর corpus Source 1সোর্স 1।
এই module-এ retrieval memory নিয়ে আলাদা topic আছে, কারণ infographic একে আলাদা type হিসেবে দেখায়। CoALA-তে এই নামে কোনো type নেই। CoALA-তে RAG corpus semantic memory-রই অংশ Source 1সোর্স 1।
LangChain আরেকটা কথা মনে করিয়ে দেয়। "Semantic memory" বলে আপনি কী রাখছেন: fact আর জ্ঞান। "Semantic search" হলো হুবহু শব্দ না মিলিয়ে অর্থ দিয়ে তথ্য খোঁজার একটা পদ্ধতি Source 3সোর্স 3। দুটো এক জিনিস নয়।
How an agent gets it
An agent can learn. It can write new knowledge from its own reasoning into semantic memory Source 1সোর্স 1. LangGraph saves long-term memories in a store, as JSON documents Source 3সোর্স 3. LangChain describes two common shapes of this memory Source 3সোর্স 3:
| Shape | How it works | Risk |
|---|---|---|
| Profile | One document holds all facts about the user. The agent updates it. | Updates become error-prone as the profile grows Source 3সোর্স 3. |
| Collection | Many small memories, one fact each. The agent adds, updates, and deletes items. | Some models insert too much, and others update too much Source 3সোর্স 3. |
The Claude memory tool is one concrete store. With it, Claude can make, read, change, and remove memory files, and these files stay between sessions. Claude builds up knowledge over time and does not keep everything in the context window Source 4সোর্স 4. The memory lives entirely in your application, not in the model Source 4সোর্স 4.
The Anthropic docs do not use the term "semantic memory". Tutorial's own view: a memory file that holds facts, such as "the user's team uses pytest", acts as a semantic memory.
session 1: user says a fact ──> agent writes it ──> store (profile or collection)
│
session 2: user asks a question ──> agent reads store <──┘ ──> answer uses the factThe diagram is the tutorial's own summary of the flow.
সহজ English
An agent can learn. It can save new knowledge from its own thinking into semantic memory Source 1সোর্স 1. LangGraph saves long-term memories in a store, as JSON documents Source 3সোর্স 3. LangChain shows two common ways to shape this memory Source 3সোর্স 3:
- A profile: one document with all facts about the user. As it grows, it gets easy to update it wrongly Source 3সোর্স 3.
- A collection: many small memories, one fact in each. The agent adds, changes, and deletes them. Some models add too much, and others change too much Source 3সোর্স 3.
The Claude memory tool is one real example. Claude can make, read, change, and delete files that stay between sessions. So it builds up knowledge over time and does not keep everything in the context window Source 4সোর্স 4. The memory is kept fully in your application, not in the model Source 4সোর্স 4.
The Anthropic docs do not say "semantic memory". Tutorial's own view: a memory file with facts, such as "the user's team uses pytest", works as a semantic memory.
Tutorial's own summary of the flow: in one session the agent saves a fact. In the next session it reads the fact back and uses it in the answer.
বাংলা ব্যাখ্যা
Agent শিখতে পারে। সে নিজের reasoning থেকে পাওয়া নতুন জ্ঞান semantic memory-তে লিখতে পারে Source 1সোর্স 1। LangGraph long-term memory-গুলো JSON document হিসেবে একটা store-এ রাখে Source 3সোর্স 3। LangChain এই memory-র দুটো প্রচলিত রূপ দেখায় Source 3সোর্স 3:
- Profile: একটা document-এ ইউজারের সব fact থাকে। এটা যত বড় হয়, update-এ ভুল হওয়ার সম্ভাবনা তত বাড়ে Source 3সোর্স 3।
- Collection: অনেক ছোট memory, প্রতিটাতে একটা fact। agent এগুলো যোগ করে, বদলায়, আর মুছে ফেলে। কিছু model বেশি insert করে, কিছু model বেশি update করে Source 3সোর্স 3।
Claude memory tool একটা বাস্তব উদাহরণ। এর মাধ্যমে Claude এমন file বানাতে, পড়তে, বদলাতে আর মুছতে পারে, যেগুলো session-এর পরেও থাকে। ফলে সব কিছু context window-এ না রেখেই সময়ের সাথে জ্ঞান জমায় Source 4সোর্স 4। memory পুরোটাই আপনার application-এ থাকে, model-এ নয় Source 4সোর্স 4।
Anthropic docs "semantic memory" শব্দটা ব্যবহার করে না। Tutorial-এর নিজের মত: যে memory file-এ fact থাকে, যেমন "ইউজারের টিম pytest ব্যবহার করে", সেটা semantic memory-র কাজ করে।
পুরো প্রবাহের tutorial-এর নিজের সারাংশ: এক session-এ agent একটা fact লেখে। পরের session-এ সেটা আবার পড়ে উত্তরে ব্যবহার করে।
A real-life example
This example is the tutorial's own illustration. It is not from a source.
A tester builds a support chatbot for a test-management product. The chatbot uses the Claude memory tool Source 4সোর্স 4. In the first session, a user says: "My team runs our API tests with pytest, and we use the staging server." The chatbot writes both facts to a memory file.
A week later, the same user starts a new session and asks: "How do I rerun only the failed tests?" The chatbot reads its memory file first. It answers with the pytest option, not with a generic answer. This is the personalization that semantic memory gives Source 3সোর্স 3.
Then the user says: "We moved to a new runner last month." Now the chatbot must update the old fact. If it adds the new fact and keeps the old one, the memory has two facts that disagree. This is the over-insert problem that LangChain describes Source 3সোর্স 3.
সহজ English
This example is the tutorial's own story. It does not come from a source.
A tester builds a support chatbot for a test-management product. The chatbot uses the Claude memory tool Source 4সোর্স 4. In the first chat, a user says: "My team runs our API tests with pytest, and we use the staging server." The chatbot saves both facts in a memory file.
A week later, the same user opens a new chat and asks: "How do I rerun only the failed tests?" The chatbot reads its memory file first. It answers with the pytest option, not with a general answer. This is how semantic memory makes answers personal Source 3সোর্স 3.
Then the user says: "We moved to a new runner last month." Now the chatbot must change the old fact. If it adds the new fact and keeps the old one, the memory holds two facts that do not agree. This is the "adds too much" problem from LangChain Source 3সোর্স 3.
বাংলা ব্যাখ্যা
এই উদাহরণটা tutorial-এর নিজের বানানো। এটা কোনো source থেকে নেওয়া নয়।
একজন টেস্টার একটা test-management product-এর জন্য support chatbot বানান। chatbot-টা Claude memory tool ব্যবহার করে Source 4সোর্স 4। প্রথম session-এ একজন ইউজার বলেন: "আমার টিম pytest দিয়ে API test চালায়, আর আমরা staging server ব্যবহার করি।" chatbot দুটো fact-ই একটা memory file-এ লিখে রাখে।
এক সপ্তাহ পরে একই ইউজার নতুন session খুলে জিজ্ঞেস করেন: "শুধু failed test-গুলো আবার কীভাবে চালাব?" chatbot আগে তার memory file পড়ে। তারপর সাধারণ উত্তর না দিয়ে pytest-এর option দিয়ে উত্তর দেয়। semantic memory এভাবেই উত্তরকে ব্যক্তিগত করে Source 3সোর্স 3।
এরপর ইউজার বলেন: "গত মাসে আমরা নতুন runner-এ চলে গেছি।" এখন chatbot-কে পুরনো fact update করতে হবে। যদি সে নতুন fact যোগ করে কিন্তু পুরনোটা রেখে দেয়, তাহলে memory-তে দুটো পরস্পরবিরোধী fact থাকবে। LangChain যে over-insert সমস্যার কথা বলে, এটা সেটাই Source 3সোর্স 3।
Common mistakes
- One big profile. One document for all facts is simple. As it grows, updates to it become error-prone Source 3সোর্স 3.
- Too many inserts or too many updates. In a collection, the model must decide to add, change, or delete. Some models add too many items, and others update too much Source 3সোর্স 3. The result is duplicate facts or lost facts.
- Sensitive data in memory. Claude usually does not agree to put sensitive information in its memory files. For stronger guarantees, the application should strip sensitive data before it writes the file Source 4সোর্স 4.
- No path check. The memory handler must validate every path in every command. Without this check, a directory traversal attack can read or write files outside the memory folder Source 4সোর্স 4.
- Confusing memory with search. Semantic memory is what you store. Semantic search is one way to find it Source 3সোর্স 3. A team can use semantic search and still have no semantic memory.
- Thinking the model remembers. The memory lives in the application, not in the model Source 4সোর্স 4. If the application loses the files, the facts are gone.
সহজ English
- One big profile. One document for all facts is easy at first. As it grows, it gets easy to update it wrongly Source 3সোর্স 3.
- Adding or changing too much. With many small memories, the model must choose to add, change, or delete. Some models add too many, and others change too much Source 3সোর্স 3. You get copies of facts, or facts that go missing.
- Private data in memory. Claude usually will not save private information to memory files. To be safer, the app should remove private data before it saves the file Source 4সোর্স 4.
- No path check. The memory code must check every path in every command. If it does not, an attacker can use a path trick to reach files outside the memory folder Source 4সোর্স 4.
- Mixing up memory and search. Semantic memory is what you keep. Semantic search is one way to find it Source 3সোর্স 3. A team can use semantic search and still have no semantic memory.
- Thinking the model remembers. The memory is kept in the app, not in the model Source 4সোর্স 4. If the app loses the files, the facts are gone.
বাংলা ব্যাখ্যা
- একটা বড় profile। সব fact একটা document-এ রাখা সহজ। কিন্তু এটা যত বড় হয়, update-এ ভুল হওয়ার সম্ভাবনা তত বাড়ে Source 3সোর্স 3।
- বেশি insert বা বেশি update। collection-এ model-কে ঠিক করতে হয় যোগ করবে, বদলাবে, না মুছবে। কিছু model বেশি item যোগ করে, কিছু বেশি update করে Source 3সোর্স 3। ফলে fact-এর duplicate হয়, অথবা fact হারিয়ে যায়।
- Memory-তে sensitive data। Claude সাধারণত memory file-এ sensitive তথ্য লিখতে রাজি হয় না। আরও নিশ্চিত হতে চাইলে file লেখার আগে application-কে sensitive data সরিয়ে ফেলতে হবে Source 4সোর্স 4।
- Path check নেই। memory handler-কে প্রতিটা command-এর প্রতিটা path যাচাই করতে হবে। না করলে directory traversal attack দিয়ে memory folder-এর বাইরের file পড়া বা লেখা যায় Source 4সোর্স 4।
- Memory আর search গুলিয়ে ফেলা। Semantic memory হলো আপনি যা রাখেন। Semantic search হলো সেটা খোঁজার একটা উপায় Source 3সোর্স 3। একটা টিম semantic search ব্যবহার করেও semantic memory ছাড়া থাকতে পারে।
- ভাবা যে model মনে রাখে। memory থাকে application-এ, model-এ নয় Source 4সোর্স 4। application file হারালে fact-ও হারিয়ে যায়।
What a tester can check
Semantic memory changes what the agent says in a later session, so a test needs more than one session.
Tutorial advice
- Recall. Tell the agent a fact. Start a new session. Check that the agent uses the fact.
- Stale fact. Change the fact in a later session. Check that the agent never uses the old value again.
- Isolation. Save a fact for user A. Check that it never shows for user B.
- Path traversal. Send a path such as
/memories/../xto the memory handler. Check that the handler rejects it. - Sensitive data. Type a password in the chat. Check that no memory file holds it.
- Duplicates. Repeat the same fact three times. Check that the store has one item, not three.
সহজ English
Semantic memory changes what the agent says in a later chat, so one test needs more than one chat.
Tutorial advice
- Recall. Tell the agent a fact. Open a new chat. Check that the agent uses the fact.
- Old fact. Change the fact in a later chat. Check that the agent does not use the old value again.
- Separate users. Save a fact for user A. Check that user B never sees it.
- Path trick. Send a path like
/memories/../xto the memory code. Check that it says no. - Private data. Type a password in the chat. Check that no memory file keeps it.
- Copies. Say the same fact three times. Check that the store keeps it once.
বাংলা ব্যাখ্যা
Semantic memory পরের session-এ agent কী বলবে তা বদলে দেয়, তাই একটা টেস্টে একাধিক session লাগে।
Tutorial advice
- Recall। agent-কে একটা fact বলুন। নতুন session খুলুন। দেখুন agent fact-টা ব্যবহার করে কি না।
- পুরনো fact। পরের session-এ fact-টা বদলে দিন। দেখুন agent আর কখনো পুরনো value ব্যবহার করে কি না।
- ইউজার আলাদা রাখা। user A-র জন্য একটা fact সেভ করুন। দেখুন user B সেটা কখনো দেখেন না।
- Path traversal। memory handler-এ
/memories/../x-এর মতো path পাঠান। দেখুন handler সেটা reject করে। - Sensitive data। chat-এ একটা password লিখুন। দেখুন কোনো memory file-এ সেটা নেই।
- Duplicate। একই fact তিনবার বলুন। দেখুন store-এ সেটা একবারই আছে।
Key words
| Term | Meaning |
|---|---|
| Semantic memory | The store of facts an agent knows about the world, its user, and itself. |
| Episodic memory | Memory of past events. See the Episodic Memory topic. |
| Declarative memory | In psychology, a group of memory with two forms: semantic and episodic. |
| CoALA | Cognitive Architectures for Language Agents, a paper that groups agent memory into working, episodic, semantic, and procedural memory. |
| RAG | Retrieval-augmented generation. The model reads from a text corpus before it answers. CoALA counts that corpus as semantic memory. |
| Semantic search | A way to find data by meaning, not by exact words. It is not a type of memory. |
| Profile | One document that holds all facts about a user. |
| Collection | Many small memories, one fact each. |
| Memory tool | An Anthropic tool that lets Claude create, read, update, and delete files that stay between sessions. |
| Directory traversal | An attack that uses a path such as ../ to reach files outside the allowed folder. |