Why Vector Databases Fail at Agent Memory (And How We Fixed It)
If you are building an AI agent that runs over long periods (days or weeks), you've likely hit the "Context Window Wall." The standard solution is to take all your chat history, embed it, and shove it into a Vector Database.
But here is the fatal flaw with flat vector retrieval: It doesn't understand time.
If a user says "I live in New York" on Monday, and "I just moved to London" on Friday, a vector database returns both facts. Your agent gets confused and hallucinated.
The Bi-Temporal Fix
In traditional systems engineering, we fix this with a dual-calendar model. Instead of storing flat documents, you extract the state into Subject-Verb-Object (SVO) events and tag them with valid_from and valid_to. When a contradictory fact arrives, you simply close the valid_to bound of the old fact.
To fetch active memory, your agent just queries: WHERE valid_to IS NULL.
Introducing Smriti
We got tired of writing this complex supersession logic, so we built Smriti. It's a completely open-source, Postgres-backed temporal memory engine for AI agents. It handles the SVO extraction and invalidation asynchronously, so your agent's reasoning loop is never blocked.
Check out the repo and let us know what you think!
Top comments (0)