向量记忆分区(memoryScope)
状态:已实现
源码:py_tauri_works/src/services/agent/memoryScopeUtils.ts、longTermMemoryService.ts、agentMemoryService.ts
Rust 向量库:py_tauri_works/src-tauri/src/agent_memory/
设置 UI:设置 → 系统设置 → 向量记忆 → 分区管理(MemoryScopePanel.vue)
长期向量记忆按 memoryScope 字符串隔离。同一 scope 内的 memory.search / 隐式注入 / Host Bridge 读写彼此可见;不同 scope 默认不交叉检索。
分区格式
构造规则(源码):
metadata 中每条向量记忆 JSON 含 memoryScope 字段,检索时按 scope 过滤。
谁决定本轮用哪个 scope?
挂接配置存储:
挂接取值:null / 未配置 = 连接隔离;__works_root__ = Works 主私域;pd_xxx = 子私域 id。
详见 私域数据模型。
设置页:分区管理
路径:设置 → 系统设置 → 向量记忆(需先下载/就绪向量组件)。
向量索引保存在本机用户目录;云同步的是记忆文本与元数据(desktop/{userId}/memory/meta.json),换机后需重新 embed。
向量后端
开发构建(import.meta.env.DEV)下可在系统设置切换 backend。
Host Bridge 与分区
外部软件 clientId 须与 register 一致;挂接后隐式记忆写入子私域 scope 而非 host:*。
Git Desk 成对别名(Dev/正式)在查询挂接时可兼容,但客户端仍应发送登记 id。见 软件连接 API。
Tauri 命令(向量库)
前端通过 agentMemoryService 调用,常用 Rust 命令包括:
完整列表见源码 src-tauri/src/agent_memory/ 与 agentMemoryService.ts。