MemX – 我的 AI 助手记得我讨厌披萨上的灯笼椒

1作者: mohitbadi5 个月前
和 2025 年的其他人一样,我曾以为“直接套用一个向量数据库”就能创建一个连贯的长期智能体,结果我眼睁睁地看着我的 Python 助手慢慢变成了一个健忘的金鱼,还伴有囤积癖。<p>典型的失败模式:<p>用户(第 1 天):“我最喜欢的编辑器是 VSCode” 用户(第 47 天):“实际上已经换成 Cursor 了” 智能体(第 92 天):“你喜欢 VSCode,对吧?”<p>或者,记忆索引慢慢变成这样:<p>用户喜欢 Python 用户真的非常喜欢 Python Python 基本上就是用户的性格<p>所有这些都具有相同的权重。永远如此。<p>向量搜索擅长相似性,但在当前事实方面却很糟糕。<p>人类的记忆会淡忘旧的观点,并覆盖不好的看法。 我的智能体呢?永远保存着我曾经说过的一切。<p>所以我构建了 MemX 作为一个小实验:如果智能体的记忆实际上具有生命周期会发生什么?<p>比如:<p>重要性信号<p>频率强化<p>重复数据压缩<p>显式更新 / 替换<p>对过时事实的温和衰减<p>技术栈故意很普通:<p>SQLite<p>FAISS<p>一些假装是“记忆操作系统”的评分逻辑<p>一个小例子:<p>from memx import MemX<p>m = MemX()<p>m.add(&quot;用户最喜欢的编辑器:VSCode&quot;) m.add(&quot;用户切换到 Cursor&quot;)<p>m.compress() m.rag(&quot;我应该使用什么编辑器?&quot;)<p>快速基准测试(50 个噪声 + 5 个真实记忆):<p>向量 RAG recall@3: ~0.75 MemX recall@3: ~1.0<p>更长的模拟:<p>10k 次交互 → ~9k 个记忆<p>在我的笔记本电脑上的延迟:<p>10k 个记忆 → ~0.3ms<p>100k → ~3ms<p>1M → ~30ms<p>这并不是要取代向量搜索或成为下一个智能体框架。这只是一个实验,看看如果记忆有生命周期而不是永久的文档存档,智能体的行为是否会更好。<p>好奇其他人如何处理在长期运行的智能体中相互矛盾或不断变化的记忆。<p>代码库: https://github.com/mohitkumarrajbadi/memx<p>(是的,辣椒的事情是真的。智能体仍然会为此争论。)
查看原文
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&#x27;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 &#x2F; 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(&quot;User&#x27;s favorite editor: VSCode&quot;) m.add(&quot;User switched to Cursor&quot;)<p>m.compress() m.rag(&quot;what editor should I use?&quot;)<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&#x27;t trying to replace vector search or be the next agent framework. It&#x27;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:&#x2F;&#x2F;github.com&#x2F;mohitkumarrajbadi&#x2F;memx<p>(And yes, the capsicum thing is real. The agent still argues about it.)