缺陷 / 高 / Agent 引擎
electron/harness/memory/manager.ts
MemoryManager.store 使用:
INSERT OR REPLACE INTO memories (id, content, type, ...) VALUES (?, ?, ?, ...);
但 store 方法每次调用都生成新的 id(nanoid()),所以 INSERT OR REPLACE 永远是 INSERT,REPLACE 子句永不触发。
nanoid()
INSERT OR REPLACE
语义上:
方案 A:明确语义,移除 OR REPLACE
INSERT INTO memories (id, ...) VALUES (?, ...);
方案 B:基于 content hash 去重
-- 添加 content_hash 列 ALTER TABLE memories ADD COLUMN content_hash TEXT; CREATE UNIQUE INDEX idx_content_hash ON memories(content_hash); -- store 时计算 hash,INSERT OR REPLACE 自动去重
方案 B 更完整,能避免重复存储相同内容。
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 高 / Agent 引擎
文件位置
electron/harness/memory/manager.ts问题描述
MemoryManager.store 使用:
但 store 方法每次调用都生成新的 id(
nanoid()),所以INSERT OR REPLACE永远是 INSERT,REPLACE 子句永不触发。语义上:
影响
建议修复
方案 A:明确语义,移除 OR REPLACE
方案 B:基于 content hash 去重
方案 B 更完整,能避免重复存储相同内容。