Memory for AI: why chatbots forget and agents don’t
How an AI agent’s memory works — search by meaning, a graph of connections and a library of skills — shown on a multi-agent system for financial analysis, and how to start your own.

In this articleContext is not memory, it is working memory
Imagine spending an hour explaining a task to a new employee. They nod, understand everything and come up with a brilliant idea. You go to lunch, come back — and they look at you as if for the first time: “And you are? Have we met?”
That is your favourite chatbot. I manage assets and build a multi-agent AI system for financial analysis. Here is how our team solved this problem and why memory, of all things, turned AI from an entertaining conversation partner into a worker you can trust with money. I will show how our memory is built, with real numbers. No formulas.
Context is not memory, it is working memory
When you write to a bot, it does not “remember” your conversation. It rereads it — in full, every time.
Everything the model “remembers” sits in the context window, a working space of limited size. It is measured in tokens, pieces of words. The first ChatGPT had a window of roughly 3,000 words. Whatever went past the edge did not “turn into experience”; it simply disappeared.
Hence the rule: context is working memory; memory is what survives closing the tab.
Financial analysis runs into this limit harder than most fields. A company’s document archive does not change after the fact, but the market changes every second: prices, trades, orders, news, central bank rates, company results. A model without access to live data and without memory of the past is like an analyst locked in a room with no internet but a ten-year-old economics textbook. A great mind with nothing to say.
Memory is three different mechanisms
When we built the system, it turned out that “memory” is not one thing but at least three.
Search by meaning: a vector database
Ordinary search looks for words: the query “dividends” finds documents containing the word “dividends”. A vector database searches by meaning. It turns every text into a long list of numbers — a vector — and texts with similar meaning get similar vectors. The query “when did the company have supply problems” finds a paragraph about “logistics disruptions” even though they share no words.
Before answering, the agent writes its own query to the database, pulls out a few of the best-matching fragments and puts them into its context. It then answers based on them. This technique is called RAG (Retrieval-Augmented Generation) — generation grounded in retrieved data.
Connections between facts: a knowledge graph
A vector database answers “find something similar”, but it does not understand connections. The record “signal X led to a loss on trade Z” and the record “trade Z was opened under strategy S” are two separate texts, and search by meaning will not link them.
Connections need a knowledge graph: entities — companies, strategies, mistakes, decisions — and the relationships between them: “led to”, “used”, “contradicts”. We use LightRAG, a hybrid of vector search over texts with a graph of connections on top. That lets the agent answer questions like “which of our strategies suffered from the same type of mistake?”. Neither a chatbot nor a pure vector database can answer that.
Skills: a library of procedures
The most underrated level. Besides facts, an agent can accumulate procedures — proven ways of solving typical tasks. For us these are text files with skills: how to format a report, how to check data, how to talk to another agent. A new skill is easy to add: an agent or a person describes a method that worked, the file goes into the library, and from then on any agent on the team can find it by meaning and use it.
The result is growth like a human specialist’s: facts, then an understanding of connections, then skills.
Where memory is worth money: the story of one mistake
Finance is an ideal testing ground for AI memory because every mistake has a price. Here is a case from our practice.
We were training a neural network to predict price movements and built features for it based on Smart Money Concepts, a methodology popular with traders about “who is behind the market”. We ran it on 35 instruments over 10 years of history. The signal strength (IC, information coefficient) averaged 0.15 — the level of the best factors at the world’s hedge funds. Already picturing yourself on a magazine cover?
Fortunately, we have a verification stage. It showed that the error was in the code that prepared the features, not in the neural network. The code that “identified strong levels” in the market was looking several bars ahead: the features were calculated from days that had not yet happened in reality. This is classic lookahead bias — data leaking from the future. The neural network was learning honestly, from copied answers. After a fix that took one evening, the signal dropped from 0.15 to an honest zero. The network itself was not to blame: this is an ordinary data preparation mistake, and ordinary verification catches it.
So why does memory matter here? We fixed the code once. But we train models constantly, and new ones are written regularly, including by the agents themselves. So the lesson is recorded in the knowledge base: leakage is possible, this is what it looked like, here is a checklist for verifying any new data pipeline. Every agent or person who starts on new features gets this warning first.
A mistake gets fixed in an evening. Protection against repeating it is memory. In finance a forgotten lesson is not an embarrassment but a loss, so memory here is not a convenience but insurance.
How ours is built: the numbers
A library of texts
Our vector database (Qdrant) is organised like a library with themed shelves. Each collection has its own topic, holding vectors of dimension 768 — a common size for models that turn text into numbers. The actual shelves:
- Bloomberg market news — 47,137 vectors;
- macro calendar (rates, results, events) — 31,008;
- Bloomberg politics news — 2,196;
- Bloomberg technology news — 1,732;
- CNBC — 1,906;
- Russian market news from the broker Finam — 974;
- the fund’s log of trades and decisions — 32;
- Federal Reserve reports — 31;
- separate collections for macro analysis, trading hypotheses and the error log.
In total more than 85,000 text fragments, tagged by meaning and searchable in milliseconds. When an agent needs to understand what happened in the market under similar conditions, it does not scroll through a feed; it writes a query and gets a digest drawn from tens of thousands of documents. That is the difference between a bot and an analyst with a library.
Live data
In finance, memory is not only text. There is a layer of data that updates in real time:
- market data through our own pipeline: quotes, orders and trades for hundreds of stocks and futures, updated every few seconds. Ask “what is happening with Sber right now” (Russia’s largest bank) and the agent gets the latest price and the nearest bid and ask levels in a single call;
- a Redis data bus: more than 2,000 keys with quotes, history, macro indicators and signals — a shared desk for all the agents;
- a historical archive: years of price and trade data for testing any hypothesis.
The graph and services
LightRAG turns the same body of text into a graph of connections: companies, events, strategies, mistakes, decisions. A separate service turns text into vectors. All of this runs locally for us, in a few Docker containers.
Who uses it
A team of 19 agents works on top of the shared memory, each with its own role:
- analysts: a macroeconomist (rates, inflation, central banks) and specialists in equities, bonds, currencies, commodities and crypto;
- the technical block: a technical analysis specialist, a neural-network forecaster, a Smart Money Concepts specialist, an options analyst;
- risk and execution: a risk manager (limits, stress tests), a portfolio manager, a scalper;
- infrastructure: a news analyst (market sentiment), a “why-asker” who looks for explanations of market moves, a machine learning strategy researcher, a knowledge base specialist and a “marketer” for reports and dashboards.
I am the auditor and coordinator. Each agent is an ordinary language model connected to the shared memory and its own tools. No magic: the same model that answers you in the browser, but with a library, skills and access to live data.
What it delivers every day
The memory architecture turns a bot that answers questions into a system of continuous analysis. With no person at the keyboard, it does the following:
- watches the market: checks the US market every 30 minutes and once an hour compiles a summary of the main indices, gold, oil and currencies, compared with history and scanned for anomalies;
- spots anomalies: volume spikes, unusual moves in individual assets, gaps between price and news — and pulls similar episodes from the past out of memory;
- reads the news: three news streams (Bloomberg, CNBC, Russian sources) flow into the vector database in real time, and the agents check them against open positions and the macro context;
- debates: before important macro events the agents hold overnight debates on the shared bus — each brings an analysis based on the shared memory, critics check one another against their own sources, and the final document lands on a person’s desk;
- reports: writes summaries in the morning and evening — what happened, which hypotheses were confirmed, which lessons to record in the database.
None of these functions required writing “yet another neural network”. The system is assembled from standard blocks: a vector database, a knowledge graph, a data bus and ordinary language models. What is new here is not the models but the memory around them.
Build an agent with memory: three levels
You do not need a team of engineers.
Level 1 — 15 minutes. Upload your documents to NotebookLM or to a Claude project. That is RAG without a single line of code: the bot answers from your materials, not from the “average internet”.
Level 2 — an evening. Install Qdrant (one Docker command), split your texts into fragments, put them into the database and connect search to any language model via MCP. That is already your own memory system: it searches by meaning and keeps everything you put into it. If you do not want to assemble the memory layer yourself, look at ready-made options such as Mem0.
Level 3 — a weekend. Add a folder of skills — text instructions the agent loads for each task. And build a habit: every mistake becomes a record of “what we did — what we found — how to check from now on”. One such record is worth ten pages of notes.
The simplest step you can take today: make the first entry in your own knowledge base — “What I learned in the last month but am already starting to forget”. That file will survive closing the tab.
A tool or a colleague
A chatbot without memory is a brilliant conversation partner with amnesia. An agent with memory is a colleague who remembers agreements, past pitfalls and proven solutions, and gets smarter every week.
The difference between them is not the budget or access to “the most powerful model”. Models today rent for cents. The difference is whether the system has memory built in: a library of knowledge, connections between facts and accumulated skills. And that is within reach of one person with a laptop — in finance, where a mistake costs money, and in any other field.
Anton is an asset manager building a multi-agent AI system for capital management (QuantumStocks). He writes about using AI in finance in practice.
What a context window is and why it runs out is explained in detail in our article on how AI handles long conversations. The easiest way to start a company knowledge base is with one working question, and MCP helps connect search to a model.
If you are building a system with AI agents and want to decide which knowledge and procedures it should keep between tasks, you can discuss it with Simplit in a free 30-minute meeting. Discuss your task
Sources
- «Память для ИИ: почему чат-бот забывает, а агент — нет» · Anton (QuantumStocks), pimenov.ai
- Qdrant — documentation · qdrant.tech
- LightRAG · github.com
- NotebookLM · notebooklm.google
- Mem0 · mem0.ai
Finished reading? Mark the step — your path progress will update.