feat(memory): complete M.2-M.5 memory upgrade phases with tests
- M.2: ForgettingCurve, MemoryDecay, MemoryReinforcement (selective forgetting) - M.3: DailyDigestGenerator, ReminderScheduler, ProactiveInformer (proactive reminders) - M.4: MemoryExtractor with LLM-based memory extraction from conversations - M.5: MemoryRecallInjector with token budget control for prompt injection - All phases include comprehensive unit tests (109 tests passing) - Updated checklist.md to mark all tasks complete
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
| `phase-m-1-importance-scoring.md` | 重要性评分系统 |
|
||||
| `phase-m-2-forgetting-system.md` | 遗忘曲线系统 |
|
||||
| `phase-m-3-proactive-reminder.md` | 主动提醒系统 |
|
||||
| `phase-m-4-auto-extraction.md` | 对话自动学习(记忆提取) |
|
||||
| `phase-m-5-recall-injection.md` | 记忆召回注入(对话个性化) |
|
||||
| `checklist.md` | 执行清单 |
|
||||
|
||||
## 推荐阅读顺序
|
||||
@@ -75,6 +77,30 @@ M.3 ─────────────────────────
|
||||
│ 核心文件: services/memory/proactive_reminder.py │
|
||||
│ 依赖: M.1, M.2 │
|
||||
│ 工作量: 5 天 │
|
||||
└────────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
M.4 ──────────────────────────────────────────────────────────────┐
|
||||
│ 对话自动学习 │
|
||||
│ - MemoryExtractor (对话结束后自动提取记忆) │
|
||||
│ - 5 种记忆类型: fact / preference / goal / pain_point / event │
|
||||
│ - 去重:相似度 > 0.85 强化而非新建 │
|
||||
│ │
|
||||
│ 核心文件: services/memory/memory_extractor.py │
|
||||
│ 依赖: M.1 │
|
||||
│ 工作量: 3 天 │
|
||||
└────────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
M.5 ──────────────────────────────────────────────────────────────┐
|
||||
│ 记忆召回注入 │
|
||||
│ - MemoryRecallInjector (发消息时注入相关记忆到 system prompt) │
|
||||
│ - Token 预算控制(默认 800 token) │
|
||||
│ - 按重要性 + 语义相关性排序 │
|
||||
│ │
|
||||
│ 核心文件: services/memory/recall_injector.py │
|
||||
│ 依赖: M.1, M.4 │
|
||||
│ 工作量: 2 天 │
|
||||
└────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
@@ -97,13 +123,22 @@ M.3 ─────────────────────────
|
||||
|
||||
```
|
||||
M.0 → M.1 → M.2 → M.3
|
||||
│ │ │
|
||||
│ │ └── 主动提醒系统
|
||||
│ └── 遗忘曲线系统
|
||||
│ │ │ └── 主动提醒系统
|
||||
│ │ └── 遗忘曲线系统
|
||||
│ │
|
||||
│ ├── M.4 (依赖 M.1,可与 M.2/M.3 并行)
|
||||
│ │ └── 对话自动学习
|
||||
│ │
|
||||
│ └── M.5 (依赖 M.1 + M.4)
|
||||
│ └── 记忆召回注入
|
||||
└── 现状与目标
|
||||
```
|
||||
|
||||
**注意:** M.1 是基础,M.2 和 M.3 都依赖 M.1。
|
||||
**注意:**
|
||||
- M.1 是基础,所有后续阶段都依赖 M.1
|
||||
- M.4 依赖 M.1,可与 M.2/M.3 并行推进
|
||||
- M.5 依赖 M.1 和 M.4(需要有记忆可注入)
|
||||
- **M.4 + M.5 是记忆真正「活起来」的关键管道**:M.4 往记忆库写,M.5 从记忆库读并影响对话
|
||||
|
||||
---
|
||||
|
||||
@@ -114,6 +149,8 @@ M.0 → M.1 → M.2 → M.3
|
||||
| M.1 | `services/memory/importance_scorer.py`, `services/memory/frequency_tracker.py`, `services/memory/emotion_analyzer.py`, `tests/test_importance_scorer.py` | `models/memory.py`, `services/memory_service.py` |
|
||||
| M.2 | `services/memory/forgetting_curve.py`, `tests/test_forgetting_curve.py` | `models/memory.py`, `services/memory_service.py` |
|
||||
| M.3 | `services/memory/daily_digest.py`, `services/memory/reminder_scheduler.py`, `tests/test_proactive_reminder.py` | `services/memory_service.py`, `services/scheduler_service.py` |
|
||||
| M.4 | `services/memory/memory_extractor.py`, `tests/services/test_memory_extractor.py` | `routers/conversation.py`, `services/scheduler_service.py` |
|
||||
| M.5 | `services/memory/recall_injector.py`, `tests/services/test_recall_injector.py` | `routers/conversation.py`, `services/memory_service.py` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user