Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 143 additions & 67 deletions docs/design/architecture.md

Large diffs are not rendered by default.

68 changes: 37 additions & 31 deletions docs/design/vision.md

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions docs/features/common/F01-memory-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| 项 | 值 |
|---|---|
| 日期 | 2026-07-07(初版)/ 2026-07-03(落地修订) |
| 日期 | 2026-07-16 |
| 影响范围 | src/common/type_def/memory.py、src/common/type_def/memory_codec.py、src/construction/layer_annotator.py、src/construction/layer_annotator_impl/、src/construction/evolver_impl/orchestrating_evolver.py、src/construction/index_builder_impl/、src/construction/base.py、src/construction/bootstrap.py、docs/specs/S05-construction.md、docs/specs/S07-common.md |
| 测试基线 | `tests/unit/construction/test_layer_annotator.py`(10 passed)、`tests/unit/construction/test_layers_index.py`(10 passed)、全量 `tests/` 426 passed / 54 skipped |
| Refs | — |
Expand All @@ -21,7 +21,7 @@ architecture §4 定义了长时记忆的纵向抽象分层:低抽象事实/

落地前的状态(已克服):`MemoryUnit` 只有 `segments`/`content` 合并视图,L0/L1 不在数据结构中;构建管线不产出 L0/L1;索引只基于 `unit.content`。

本特性已落地 **MemoryUnit 内建内容层 + 构建层标注 + 层级索引记录**,召回/披露端消费尚未接入(见已知遗留)。纵向抽象级别不在本特性中建模。
本特性已落地 **MemoryUnit 内建内容层 + 构建层标注 + 分层索引记录 + 分层召回与披露**。纵向抽象级别不在本特性中建模;跨 `MemoryUnit` 的树结构也不属于本特性

## 决策

Expand Down Expand Up @@ -353,14 +353,9 @@ L0/L1/L2 分别落独立 Milvus collection,共用同一维度与 COSINE 度量
- `loads` 读回构造 `ContentLayers`,缺失取空串(老数据无迁移读出)。
- 未知字段继续忽略,保持向前兼容。

## 后续扩展:层级展开
## 后续扩展:树结构

本特性只处理同一 unit 内的 L0/L1/L2 内容层。若后续要支持目录、主题、聚类等父子结构,需要另立 feature:

1. 引入 `parent_id` / `parent_uri` 或主题节点。
2. 支持父节点摘要命中后展开子节点。
3. 支持父子分数传播和收敛策略。
4. 支持按预算从父级概要升级到子级全文。
本特性只处理同一 unit 内由 `DisclosureLevel` 表达的 L0/L1/L2 压缩度;它不表示跨 unit 的父子关系。跨 `MemoryUnit` 的树结构、父命中后展开、分数传播与树级 token 预算已在 [F07-memory-tree.md](F07-memory-tree.md) 中完成设计,目前尚未实现。

## 拒绝的方案

Expand All @@ -376,9 +371,9 @@ L0/L1/L2 分别落独立 Milvus collection,共用同一维度与 COSINE 度量

拒绝。L2 等于 `unit.content`,重复存储会造成 segments 与 layers.l2 的一致性问题。

### 方案 D:本次引入父子层级展开
### 方案 D:本次引入树结构展开

拒绝作为本次范围。父子层级展开需要新增主题/目录节点、父子关系、分数传播和展开策略,超出同一 `MemoryUnit` 内容层的边界。
拒绝作为本次范围。该决定保留为 F01 的历史范围取舍:树结构展开超出同一 `MemoryUnit` 内容层的边界。树结构现已由 [F07-memory-tree.md](F07-memory-tree.md) 独立完成设计,但仍未实现

## 验证

Expand All @@ -395,7 +390,7 @@ L0/L1/L2 分别落独立 Milvus collection,共用同一维度与 COSINE 度量
- [ ] delete/lifecycle 转换不修改 layers,PURGE 删除真源与索引(未落地)
- [x] VectorIndexBuilder 为 L0/L1/L2 建层级记录,metadata 含 `content_layer`(分表、store None 跳过)
- [x] FulltextIndexBuilder 为 L0/L1/L2 建层级文档,metadata 含 `content_layer`(分表、store None 跳过)
- [x] Recaller 聚合层级命中到 `unit_id`,多路多层级经 Fuser RRF 聚合(已实施,§6)
- [x] Recaller 聚合层级命中到 `unit_id`,同通道多层命中按 MaxP 聚合(已实施,§6)
- [x] TruncatingDiscloser 优先读 layers,空值回退原截断逻辑(已实施,§6)
- [x] StructuredDiscloser 优先读 layers,空值回退原结构化逻辑(已实施,§6)
- [x] RetrievedItem 三层一次性填充(abstract/overview/content,已实施,§6)
Expand All @@ -407,7 +402,7 @@ L0/L1/L2 分别落独立 Milvus collection,共用同一维度与 COSINE 度量
原始 unit 无 layers。后续接 write 路径时再实现。
2. **update/delete 路径未接**:update 不会自动重标注(layers 随版本语义继承/清空);delete 不
修改 layers。后续接 update 路径时实现 patch 触发重标注。
3. **父子层级展开未实现**:本次只做同一 unit 的 L0/L1/L2 内容层,不做目录/主题节点展开
3. **树结构展开未实现**:本次只做同一 unit 的 L0/L1/L2 内容层;跨 unit 的结构设计见 [F07-memory-tree.md](F07-memory-tree.md)
4. **KeywordLayerAnnotator 质量有限**:规则标注无法保证 LLM 级语义浓缩,hot path 接受该折衷。
5. **抽象粒度字段未建模**:低/中/高抽象分层仍由 `tier/tags/metadata/provenance` 间接表达;如需
一等字段,应另立纵向抽象分层 feature。
Expand Down
Loading