Files
myWiki/raw/articles/atlas-agent-memory-architecture-2026.md

62 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Atlas Agent 记忆架构:三索引 + 混合召回 + 写后提炼"
author: "Atlas Memory System (基于 noamschwartz/atlas-memory-demo)"
source: "微信公众号"
date: "2026"
type: article
tags: ["agent-memory", "elasticsearch", "hybrid-retrieval", "consolidation", "bias"]
---
# Atlas Agent 记忆系统架构全解析
> 深度工程实践Agent 记忆不是 KV 存储问题,是多索引信息检索问题。
## 核心论点
`chat_history.append()` 不是记忆系统——那是日志文件。真正的挑战在三索引episodic/semantic/procedural+ catalog 四种不同生命周期的信息中,用对的衰减曲线和互补的检索通道,在查询瞬间找到对的那几条。
## Atlas 架构
### 三索引 + 公共
| 索引 | 内容 | 衰减源 | 写入频率 |
|------|------|--------|---------|
| episodic | 原始消息+时间戳 | timestamp | 每回合 |
| semantic | 提炼后稳定事实 | last_used_at | consolidation |
| procedural | 多步操作流程 | 豁免(1.0) | consolidation |
| catalog | 公共共享知识 | timestamp | 手动 |
### 检索管线
1. Verbatim Pre-Recall — 用户原话,不经 LLM 改写
2. BM25 + Dense 双通路并行 → RRF 融合 (rank_constant=30)
3. Cross-encoder 重排序 (Jina v2, top-80→top-K)
4. Reranker 失败降级为 RRF 顺序
### Ablation 数据
- **Full**: R@10=0.89
- **Dense-only**: 0.845
- **BM25-only**: 0.708
- **No-Reranker**: -0.238
### 五条代码链路
- write_memory (refresh=True 保证同轮可见)
- recall_memory (混合检索+reranker)
- Verbatim Pre-Recall (绕过 LLM 改写层)
- Consolidation (episodic→semantic/procedural)
- Soft-Supersession (非破坏矛盾处理)
## 三个通用设计原则
1. **衰减曲线是领域性决策**—先定义信息有效周期,再定衰减参数
2. **BM25+vector 互补**—BM25 抓精确 tokendense 抓语义意图,不可互相替代
3. **记忆需要后台提炼+矛盾处理**—consolidation 转化事件为事实supersession 提供非破坏性更新
## 与 GBrain 的对比
| 维度 | Atlas | GBrain |
|------|-------|--------|
| 存储 | ES 搜索引擎 | Markdown+Git |
| 多租户 | ES DLS (集群层) | 应用层 auth |
| 矛盾处理 | Soft-Supersession 链 | Git 版本历史 |
| 衰减 | Per-index gauss | 无显式衰减 |
| 调试透明度 | 仅通过 API | 直接打开文件 |