跳到主要内容

记忆读取

源码: memdir/findRelevantMemories.ts | memdir/memoryScan.ts

1. 查找算法

// 查找相关记忆
export async function findRelevantMemories(
query: string,
memoryDir: string
): Promise<Memory[]> {
// 1. 扫描记忆目录
// 2. 关键词匹配
// 3. 按相关性和时间排序
}

2. 记忆老化

memoryAge.ts 实现记忆的时效性衰减机制。旧记忆如果没有被引用会逐渐失去权重。


上一节:记忆写入 | 下一节:06 状态管理