MemX – 我的AI助手记得我讨厌披萨上的甜椒。
和2025年其他人一样,我曾以为“只需在其上加一个向量数据库”就能创建一个连贯的长期智能体,但我看到我的Python助手慢慢变成了一个健忘的金鱼,甚至还有囤积癖。
经典的失败模式:
用户(第1天):“我最喜欢的编辑器是VSCode”
用户(第47天):“其实我换成了Cursor”
智能体(第92天):“你喜欢VSCode,对吧?”
或者,记忆索引慢慢变成这样:
用户偏好Python
用户真的非常偏好Python
Python基本上就是用户的个性
所有这些权重相同,永远如此。
向量搜索在相似性方面表现出色,但在当前真相方面却很糟糕。
人类的记忆会淡化旧观点并覆盖错误看法。
而我的智能体?是我所说过的一切的永久档案。
因此,我构建了MemX作为一个小实验:如果智能体的记忆实际上有生命周期,会发生什么?
诸如:
重要性信号
频率强化
重复压缩
显式更新/替代
过时事实的温和衰减
技术栈故意简单:
SQLite
FAISS
一些伪装成“记忆操作系统”的评分逻辑
小示例:
```python
from memx import MemX
m = MemX()
m.add("用户的最爱编辑器:VSCode")
m.add("用户切换到Cursor")
m.compress()
m.rag("我应该使用什么编辑器?")
```
快速基准测试(50个噪声 + 5个真实记忆):
向量RAG召回@3: ~0.75
MemX召回@3: ~1.0
更长的模拟:
10,000次交互 → ~9,000个记忆
在我的笔记本上的延迟:
10,000个记忆 → ~0.3毫秒
100,000 → ~3毫秒
1,000,000 → ~30毫秒
这并不是想要取代向量搜索或成为下一个智能体框架。它只是一个实验,看看如果记忆有生命周期而不是永久文档档案,智能体的表现是否会更好。
我很好奇其他人在长期运行的智能体中如何处理矛盾或不断发展的记忆。
代码库:
https://github.com/mohitkumarrajbadi/memx
(是的,关于辣椒的事情是真的。智能体仍然对此争论不休。)
查看原文
Like everyone else in 2025 who thought “just slap a vector DB on it” would create a coherent long-term agent, I watched my Python sidekick slowly turn into a forgetful goldfish with hoarding issues.<p>Classic failure mode:<p>User (day 1): “My favorite editor is VSCode”
User (day 47): “Actually switched to Cursor”
Agent (day 92): “You love VSCode, right?”<p>Or the memory index slowly becoming this:<p>User prefers Python
User REALLY prefers Python
Python is basically the user's personality<p>All equally weighted. Forever.<p>Vector search is great at similarity, but terrible at current truth.<p>Human memory fades old opinions and overwrites bad takes.
My agent? Eternal archive of everything I ever said.<p>So I built MemX as a small experiment: what happens if an agent’s memory actually has a lifecycle?<p>Things like:<p>importance signals<p>frequency reinforcement<p>duplicate compression<p>explicit updates / superseding<p>gentle decay for outdated facts<p>Stack is intentionally boring:<p>SQLite<p>FAISS<p>some scoring logic pretending to be a “memory OS”<p>Tiny example:<p>from memx import MemX<p>m = MemX()<p>m.add("User's favorite editor: VSCode")
m.add("User switched to Cursor")<p>m.compress()
m.rag("what editor should I use?")<p>Quick benchmark (50 noise + 5 real memories):<p>Vector RAG recall@3: ~0.75
MemX recall@3: ~1.0<p>Longer simulation:<p>10k interactions → ~9k memories<p>Latency on my laptop:<p>10k memories → ~0.3ms<p>100k → ~3ms<p>1M → ~30ms<p>This isn't trying to replace vector search or be the next agent framework. It's just an experiment in whether agents behave better if memory has a lifecycle instead of being a permanent document archive.<p>Curious how others handle contradictory or evolving memories in long-running agents.<p>Repo:
https://github.com/mohitkumarrajbadi/memx<p>(And yes, the capsicum thing is real. The agent still argues about it.)