
When people say "AI agent with memory," many imagine a single vector database and magical retrieval. In practice, this is almost never enough.
In Volna, my Telegram agent, memory is structured as several different layers. Because in a real dialogue, you need to solve three tasks at once: store long-term facts, keep recent context at hand, and avoid clogging the model with unnecessary tokens.
Conventionally, Volna's memory consists of 4 parts:
- Permanent blocks in Letta. These are two basic blocks of about 3,000 characters each.
The first is the user's portrait: who they are, what they do, what is important to them, their interests and stable contexts.
The second is Volna's own profile: communication style, behavioral rules, how she reacts to corrections, and what she considers important in dialogue.
- Archival memory. This is a layer for detailed facts that don't need to be kept in the prompt constantly but are important to find quickly. Search is semantic, with re-ranking by freshness on top, so that an old but similar fact doesn't override a more relevant one.
- Daily episodic log. After each dialogue, the system extracts short facts and writes them into a markdown file. Decisions, preferences, and explicit reactions go there. When a new session starts, only the last 3 days are returned to the context, and only in a compressed form.
- Relationship graph in Neo4j. A network of entities is built separately: people, projects, companies, topics, tools, events. If I mention something familiar in a message, Volna tries to pull up related entities and relationships around it. Essentially, this is a layer not of "fact memory" but of "structure memory."
The key idea is that these layers are mixed into the model differently.
When a session is reset or the context is compressed, Volna reconstructs the picture from scratch. In normal operation, she doesn't drag the entire memory dump but uses a basic cache and the dynamic context of the message.
This is important for both quality and speed. If you always feed the model all the memory at once, it starts drowning in its own past. If, on the other hand, you keep only one short summary, the sense of continuity in communication is lost.
I particularly like how memory update after a response is arranged. It happens asynchronously, in the background. That is, the user has already received the message, while the system simultaneously does several things:
- extracts facts from the exchange,
- appends to the daily log,
- sends the dialogue to Letta for long-term memory update,
- and updates the entity graph.
Moreover, there are several useful constraints. For example, too short exchanges may not be included in fact extraction at all. And the number of facts depends on the dialogue length. This is a simple thing, but it protects memory from junk well.
Another important layer is session snapshots. When a conversation ends, the system saves a short JSON snapshot: summary, last utterances, number of turns, sometimes observations about mood or behavioral patterns. On the next reset, this snapshot can be returned to the context once, giving the feeling that the agent didn't "wake up from a blank slate."
Separately, Volna has a reflection layer on top of memory.
If a question sounds like "how did Vlad's attitude to work change" or "what is his trajectory regarding health," simple search is too weak: it returns pieces, not understanding.
For this, there is
memory_reflect. It first retrieves a set of relevant memories via semantic search, then passes them to the model with a separate task to assemble a coherent narrative from scattered records. The output is a short interpretation of 2-5 paragraphs.And, of course, memory needs maintenance. Otherwise, any memory system quickly turns into a digital closet. Hence, a separate maintenance process.
To put it briefly, Volna's memory is not one prompt, not one database, and not one retrieval. It is routing of different memory types with different lifespans, different costs, and different ways of injection into the context.
❗️❗️❗️❗️❗️❗️❗️❗️ / Not banned in the Russian Federation
Comments
0No comments yet.
Sign in to join the discussion.