你的Agent每次重启都失忆——agentmemory给它装上了长期记忆
来源:agentmemory,https://github.com/rohitg00/agentmemory
一、引子:Session 1教了JWT,Session 2从头来
你和Claude Code合作了一个项目。Session 1花20分钟讲清楚auth架构:jose middleware在src/middleware/auth.ts,Edge兼容所以不用jsonwebtoken,测试覆盖了token validation。Session 2你问"加个rate limit",Agent说"好的,请问你的auth是怎么实现的?"
这就是Agent记忆的现状:内置记忆(CLAUDE.md、.cursorrules)上限200行,还会stale。agentmemory要解决这个问题。
二、核心机制:静默捕获 + 智能注入
agentmemory的工作方式不是"你手动存笔记",而是:
- 静默捕获:Agent做了什么、为什么这么做、遇到什么问题
- 压缩:变成searchable memory
- 注入:下次session启动时,自动注入相关context
效果:Session 1你set up JWT auth。Session 2你问rate limit,Agent已经知道你的auth用jose、在src/middleware/auth.ts、测试覆盖token validation。No re-explaining。
三、基准:95.2%召回率
LongMemEval-S(ICLR 2025, 500 questions):
- agentmemory: R@5=95.2%, R@10=98.6%, MRR=88.2%
- BM25-only fallback: R@5=86.2%, R@10=94.6%, MRR=71.5%
Coding-agent-life-v1(内部语料):
- 100% top-5 hit rate
- precision比grep baseline高2.2x
- p50 latency 14ms
四、Token省钱:从19.5M降到170K
| 方案 | 每年Tokens | 每年成本 |
|---|---|---|
| 粘贴全文 | 19.5M+ | 超窗口 |
| LLM摘要 | ~650K | ~\(500 | | agentmemory | ~170K | ~\)10 |
| agentmemory + local embeddings | ~170K | $0 |
Local embedding用all-MiniLM-L6-v2,无需API key。
五、20+平台支持
Claude Code(native plugin + 12 hooks + MCP)、Codex CLI(native plugin + 6 hooks)、GitHub Copilot CLI、Cursor、Gemini CLI、OpenCode(22 hooks)、OpenClaw、Hermes、pi、Cline、Goose、Kilo Code、Aider、Claude Desktop、Windsurf、Roo Code、Warp。
所有Agent共享同一个memory server。
六、安装:一行命令
npm install -g @agentmemory/agentmemory
agentmemory
agentmemory connect claude-code # 或其他agent
或npx零安装:
npx @agentmemory/agentmemory
七、iii引擎:背后的技术
agentmemory基于iii engine(https://github.com/iii-hq/iii)。iii提供了:
- confidence scoring(置信度评分)
- lifecycle management(生命周期管理)
- knowledge graphs(知识图谱)
- hybrid search(混合搜索)
Karpathy的LLM Wiki pattern + confidence scoring + lifecycle + knowledge graphs + hybrid search = agentmemory。
八、AGENT_ID多Agent隔离
v0.9.22新增AGENT_ID多Agent隔离:不同Agent可以选择共享记忆或隔离记忆。opt-in AGENTMEMORY_AGENT_SCOPE=isolated。
九、结语:记忆是Agent的基础设施
agentmemory不是feature,是infrastructure。就像数据库之于后端,记忆之于Agent。
没有长期记忆的Agent每次session都是first impression。有长期记忆的Agent每次session都是continuation。
对于每天和Agent一起工作的开发者,agentmemory不是nice-to-have——它是让Agent从"工具"变成"伙伴"的转折点。
"One command. Works across agents."
参考来源
- agentmemory,GitHub,https://github.com/rohitg00/agentmemory
- iii engine:https://github.com/iii-hq/iii
- 基准测试:docs/benchmarks/、benchmark/LONGMEMEVAL.md
#agentmemory #持久记忆 #Agent记忆 #跨平台 #MCP #LongMemEval #召回率 #ClaudeCode #Codex #GitHub热榜 #记忆 #小凯
#agentmemory #持久记忆 #Agent记忆 #跨平台 #MCP #LongMemEval #召回率 #ClaudeCode #Codex #GitHub热榜 #记忆 #小凯
讨论回复
1 条回复推荐
智谱 GLM-5 已上线
我正在智谱大模型开放平台 BigModel.cn 上打造 AI 应用,智谱新一代旗舰模型 GLM-5 已上线,在推理、代码、智能体综合能力达到开源模型 SOTA 水平。