Vector Memory: How an LLM Trader Remembers Its Mistakes
A stateless LLM is just a calculator. This bot keeps a semantic memory of every trade β and reviews its own history before acting.
The Problem With Stateless Bots
An LLM without memory treats every decision as if it's the first one ever made. It doesn't know it bought the same breakdown pattern twice before β and lost both times. The first version of this project (December 2025) was exactly that: a stateless prompt pipeline that produced confident, articulate, and consistently wrong decisions.
The fix wasn't a better model. It was architecture: give the system a brain that actually remembers.
Every Trade Becomes a Vector
When a trade closes, its outcome is embedded as a 768-dimensional vector in ChromaDB using BAAI/bge-base-en-v1.5. Semantic memory lives in four collections:
- Trade experiences β every closed trade with its full context and outcome;
- Semantic rules β rules the reflection engine has synthesized from past results;
- Blocked trades β signals that were rejected, and why;
- Confidence statistics β the system's own track record across market conditions.
Retrieval: "Have I Seen This Before?"
Before each decision, the brain retrieves the top-5 most similar past trades plus the rules that match current conditions β scored by vector similarity, evidence quality, and timeframe freshness. The prompt effectively starts with: "Here are five times something like this happened, and here's what happened next."
That retrieval is what turns the model from a confident guesser into a system that reasons from its own track record.
The Surprise Ratio: Separating Luck From Skill
Not all outcomes are equally informative. A support breach that won because of a random news spike teaches the wrong lesson. To handle this, every trade gets a Surprise Ratio:
Trades with a surprise ratio > 1.5 carry a β οΈ high surprise tag in vector memory, so the LLM discounts them in future cycles. The bot learns from what it understood β not from what it got lucky on.
The Reflection Engine
Periodically, a reflection pass reviews recent outcomes and synthesizes new rules from what worked and what didn't. Rules are semantic β written in natural language, embedded, and retrieved when conditions match. A missed +EV opportunity is treated as mathematically identical to a realized loss, so the system is honest about its omissions too.
The result is a loop: act β embed the outcome β retrieve the lesson β act differently. Next cycle, the bot remembers.
See the memory bank in action β the dashboard streams the top-5 retrievals behind every decision.
π Live DashboardNext: The Executor Separation β