How to Add Memory to AI ChatBot
Adding memory to an AI chatbot allows it to recall information from previous interactions, personalise responses, and build context over time. ChatBotKit provides two complementary approaches: the dedicated Memory ability for dynamic, conversational recall, and datasets for structured knowledge bases. This tutorial covers both so you can choose the right approach for your use case.
Approach 1: Using the Memory Ability (Recommended)
The Memory ability (memory/*) is ChatBotKit's built-in mechanism for giving a chatbot dynamic, searchable memory. Unlike datasets, which store static knowledge, memories are created and retrieved at runtime during conversations - the bot itself decides what to remember and when to recall it.
Step 1: Create a Blueprint and Add Memory Abilities
- In ChatBotKit, open the Blueprint Designer and start with a blank blueprint.
- Add a bot and a skillset.
- From the ability catalogue, add the following abilities to the skillset:
- Search Memories (
memory/search[contact]) - lets the bot search past memories for the current user - Create Memory (
memory/create[contact]) - lets the bot save new information about the current user - List Memories (
memory/list[contact]) - lets the bot review recent memories
- Search Memories (
The [contact] scoped variants are ideal for chatbots that serve many individual users, because each user's memories are stored separately. If you want a shared memory space for all users of a bot, use the [bot] scoped variants instead.
Step 2: Write a Memory-Aware Backstory
In the bot backstory, instruct the bot to actively use its memory abilities. For example:
Clear backstory instructions are important because they guide the bot to use the memory abilities proactively rather than waiting to be explicitly asked.
Step 3: Build and Test
- Click Build to save the blueprint.
- Open Collabo, ChatBotKit's built-in testing environment.
- Tell the bot something to remember, such as: "My name is Alex and I prefer concise responses."
- In a follow-up message, ask: "What do you know about me?"
- The bot should recall the previously stored memory and reference it in its reply.
Memory Scopes
| Scope | Ability prefix | When to use |
|---|---|---|
[contact] | memory/*[contact] | Per-user memory (recommended for most chatbots) |
[bot] | memory/*[bot] | Shared memory across all users of a bot |
| (user) | memory/* | Account-wide memory (advanced use cases) |
Approach 2: Using Datasets (Structured Knowledge)
Datasets are the right choice when your chatbot needs to recall structured, pre-loaded knowledge - such as FAQs, product information, or support articles - rather than remembering things dynamically during conversations. Datasets work well as a static knowledge base that complements the dynamic Memory ability.
Step 1: Create a Dataset
- Navigate to Datasets in your ChatBotKit dashboard and click Create Dataset.
- Give your dataset a descriptive name (for example, "Product FAQ" or "Customer Support Knowledge Base").
- Click Create to save it.
Step 2: Add Records
Records are individual pieces of information stored in the dataset. Add records manually by clicking Create Record within your dataset, or import them in bulk using the Import feature, which supports common document formats.
You can also add records programmatically using the ChatBotKit Node SDK or the REST API - useful for keeping the dataset in sync with an external knowledge source.
Step 3: Connect the Dataset to Your Bot
Connect the dataset to your bot by selecting it in the bot's configuration settings. Once connected, the chatbot automatically searches the dataset during conversations to find relevant information and include it in its responses.
Choosing the Right Approach
| Memory Ability | Dataset | |
|---|---|---|
| Best for | Personalised recall, facts the user shares during chat | Pre-loaded knowledge, FAQs, reference material |
| Updated by | The bot itself, during the conversation | You (manually or via API/import) |
| Per-user isolation | Yes, with [contact] scope | No - shared across all users |
| Searchable | Yes, via semantic search | Yes, via semantic search |
For most conversational AI agents, combining both works best: use a dataset for domain knowledge and the Memory ability for personalised, dynamic recall.
Troubleshooting
The bot is not saving memories. Check that the memory/create[contact] ability is included in the skillset and that the backstory explicitly instructs the bot to save memories when appropriate.
Memories from previous sessions are not being recalled. Make sure the memory/search[contact] or memory/list[contact] ability is in the skillset and the backstory tells the bot to search memories at the start of each conversation.
The bot is recalling the wrong user's memories. Confirm you are using the [contact] scoped abilities. Account-wide memory abilities (without a scope suffix) share memory across all users, which is rarely the desired behaviour for a multi-user chatbot.