Skip to content
Giving an AI assistant a memory, without keeping everything

Giving an AI assistant a memory, without keeping everything

· Bert Altena

A language model forgets everything after the conversation. A memory of short lessons solves that, as long as you decide what goes in, how it reaches the question and what happens when a lesson stops being true.

A language model has no memory. Every conversation starts at zero. Whatever an AI assistant seems to remember, it is given again with every question, as part of its instructions.

You only notice this once you really use one. On Monday you explain that a particular lake is rented by the week and not by the night. On Wednesday it makes the same mistake again. Not because it is stupid, but because nobody passed it along.

On a booking platform I work on, there has been an internal AI chat in the admin for a while now. Over the past weeks it has been given a memory. This is how that works, and above all which choices make the difference.

Lessons instead of chat history

The obvious solution is to keep everything and send the old conversations along. That works badly. A conversation is mostly rough work, it is full of customer names and e-mail addresses, and after a month it no longer fits anywhere.

What happens here is different. After a correction or an explanation, the assistant records a lesson itself: one short sentence with a fact, in a table of its own, with a category. "This lake is only rented by the week, Saturday to Saturday." Below the answer it says that it has remembered something, so you can see what is being kept.

Two rules keep this clean. The server refuses a lesson that contains an e-mail address or a phone number, whatever the assistant tries. And an administrator reviews the lessons on a screen of their own. What is correct gets more weight. What is wrong is marked as such. Deleting is not possible; more on that below.

From the heaviest lessons to the best fitting ones

By now there are more than 5,600. They do not all fit into one set of instructions.

The first version did the obvious thing: the lessons with the highest priority first, until a budget of 16,000 characters was full. The assistant could look up the rest itself, but only if it searched with exactly the right word. In practice it often missed a lesson about a specific lake, even though the lesson was there.

Now, for every question, the system first searches all lessons for the ones that fit best. It looks at the words of the question and of the earlier questions in the conversation. Rare words weigh heavily, common words lightly, and a word is also found inside a compound. Those best fitting lessons go along first, up to 8,000 characters. After that come the heaviest, as before, without duplicates.

The difference is that the memory moves with the question. Ask about a lake in France and it gets what it knows about that lake, not the fifty most general rules of the system.

Forgetting is not allowed, ageing is

A memory that only grows starts to contradict itself. Prices change, a rule is adjusted, an old way of working disappears. Then there are two lessons that contradict each other, and the model picks one.

Deleting is not the answer. A lesson that is wrong today sometimes explains why a booking from last year looks the way it does. So there is archiving, with evidence.

The assistant may archive a lesson itself, but only under conditions the server checks. In the same answer it must have looked up the lesson and read a second source: the code, the handbook or a setting. It names that source in its reason. Without that evidence, the archiving is refused and logged. A lesson the team has confirmed cannot be archived by the assistant.

An archived lesson no longer counts as a fact of today. If it does fit a question, the assistant receives it as a lesson from the past, with the date and the reason. An administrator sees when and why it happened, and restores it with one click.

Merging, with a test

The second problem is repetition. At one point there were more than a hundred variants of the same question: does this calendar notice block one fishing spot or the whole lake?

At the assistant's own suggestion there is now a merge round. It proposes which lessons can become one and writes the new lesson. A proposal is dropped if the new lesson is not shorter than the old ones together, or if it looks like personal data. A separate second call then checks, old lesson by old lesson, whether everything really is in it. Only the old lessons that are covered are absorbed; the rest keep counting.

Here too nothing is thrown away. A merged lesson no longer counts, but it is still there, greyed out, with a pointer to the new one.

Learning without using up your subscription

Besides the conversations, the assistant also learns on its own, at a low pace. It reads through the whole system: the code, the bookings, the mail conversations, the handbook. When it is done, it starts again with what it read longest ago, with what it knows now.

That is a lot of reading, and it runs on the same subscription as the daytime work. The provider does not report usage, so the system measures it itself. Every call records how much text went out and came back, in windows that follow the limits of the subscription. When a limit notice arrives, the system knows where the ceiling is.

By default, learning may use 70 percent of that ceiling. Above that, it waits until the window has passed. The work of the staff is never slowed down, and a question in the chat always comes before a learning block. A slider in the admin makes learning faster or slower.

It is an estimate in characters, not an exact count. But it does what it should: learning does not eat the capacity you need during the day.

What I take from this

Three things apply, I think, to any company that wants to give an AI assistant a memory.

Keep facts, not conversations. You can check a one-sentence lesson. You cannot check an hour-long conversation.

Let the server guard the rules, not the prompt. "Do not store personal data" in a prompt is a request. A refusal in the code is a lock.

Deleting is almost never the right answer. Archiving with a reason keeps the memory honest, and you can always see why something was once the case.

The memory is a few weeks old and still grows every day. You can see what else is on the platform in the portfolio. If you want something like this for your own system, let me know through the contact page.

Frequently Asked Questions

Does an AI assistant remember what you tell it by itself?
No. A language model starts every conversation from scratch. Whatever it seems to remember is handed to it again with every question. So you build the memory yourself: you decide what is kept and what is passed along with a question.
Why not simply keep every conversation?
Because a conversation is mostly rough work and often contains personal data. Short lessons are brief, checkable facts without personal data. You can review them, find them again and archive them when they no longer hold.
What does a memory like this cost?
The memory itself is a table in your own database. The cost is in reading and learning, because every call to the model counts. That is why learning gets a fixed share of the limit, 70 percent by default, and the work of the staff always comes first.
Chat met ons