@a9i5k4/dsh-auto-memory 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +7 -6
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -324,10 +324,11 @@ class MemoryEngine {
324
324
  }
325
325
  lines.push('\n[记忆写入纪律 — 必须遵守]')
326
326
  lines.push('- 会话开始:若任务与历史工作/历史决策相关,先回顾以上记忆;**遇到不熟悉的代码、领域或项目时,主动调用 memory_recall 检索本机所有 AI 工具的历史记忆(CodeBuddy/Claude Code/Codex 等会话),不要凭空猜测**。')
327
- lines.push('- 新工作区(无历史日志/笔记):主动用 memory_recall 探索本机历史,判断该项目是否曾在其他 AI 工具中工作过;也可调用 memory_external 查看并接入外部记忆。')
327
+ lines.push('- 新工作区(无历史日志/笔记):主动用 memory_recall 探索本机历史,判断该项目是否曾在其他 AI 工具中工作过;也可调用 memory_external 查看并接入外部记忆;检索时在正文中说明"我先查一下之前的记录"。')
328
328
  lines.push('- 完成实质性工作后立即调用 memory_log 追加今日日志(append-only,绝不覆盖):建/改应用、修 bug、写文档、重构、技术选型、用户约定或偏好。')
329
329
  lines.push('- progress 与 memory 一起写:写日志的同时,把有跨会话长期价值的内容一并写入记忆——跨项目规则 → memory_user,仅本项目 → memory_note;两者在同一轮完成,互不冲突、不遗漏。')
330
330
  lines.push('- 只记录有跨会话长期价值的;不记临时信息(搜索结果、临时路径、工具报错)。')
331
+ lines.push('- **记忆操作对用户可见**:调用 memory_log/note/user/reflect 更新记忆时,在同一轮回复的正文中(非工具调用内部)用一句话向用户明文说明——"正在更新哪份文档、加入什么内容";调用 memory_recall/memory_external 检索时,也在正文中说明检索了什么、找到了什么,让用户直观看到记忆在工作。')
331
332
  lines.push('- 用户明确要求长期记住:跨项目规则 → memory_user;仅本项目 → memory_note。')
332
333
  lines.push('- 定期调用 memory_maintain 归档 30 天前日志;不存密钥,除非用户明确要求。')
333
334
  lines.push('- 记忆仅作补充,不替代正常回复与交付物。')
@@ -432,8 +433,8 @@ class MemoryEngine {
432
433
  }
433
434
  }
434
435
  } catch (e) {}
435
- if (!out.length) return '未找到与 "' + query + '" 相关的记忆。'
436
- return out.join('\n')
436
+ if (!out.length) return '[记忆检索] 查询 "' + q + '" —— 未找到相关记忆。'
437
+ return '[记忆检索] "' + q + '":\n' + out.join('\n')
437
438
  }
438
439
 
439
440
  // ---------- 反思 ----------
@@ -924,7 +925,7 @@ export function apply(ctx, config) {
924
925
  const entry = '- ' + nowHm() + ' ' + String(args.note).trim()
925
926
  const body = await engine.appendText(logPath, entry)
926
927
  if (date === todayStr()) { engine.state.logText = body; engine.state.logPath = logPath; engine.state.loadedAt = Date.now() }
927
- return '已追加到 ' + logPath + '\n' + entry
928
+ return '已更新记忆文档: ' + logPath + '\n' + entry
928
929
  }),
929
930
 
930
931
  defineTool('memory_note', '更新当前项目长期笔记 .dsh-memory/MEMORY.md(本项目专属的约定、决策、架构要点)。action=append 追加一段(自动带日期标题);action=replace 整体替换(需先基于注入内容或 memory_recall 结果给出完整新内容)。', {
@@ -942,7 +943,7 @@ export function apply(ctx, config) {
942
943
  body = await engine.appendText(p.notesPath, '\n## ' + todayStr() + '\n' + content)
943
944
  }
944
945
  engine.state.notesText = body; engine.state.loadedAt = Date.now()
945
- return '已更新 ' + p.notesPath
946
+ return '已更新项目笔记: ' + p.notesPath + '\n追加内容:\n' + content
946
947
  }),
947
948
 
948
949
  defineTool('memory_user', '更新用户级记忆 ~/.dsh/memory/MEMORY.md(跨所有项目的长期规则/偏好,用户明确要求记住时用)。action=append 追加;action=replace 整体替换。', {
@@ -960,7 +961,7 @@ export function apply(ctx, config) {
960
961
  body = await engine.appendText(p.userFile, '\n## ' + todayStr() + '\n' + content)
961
962
  }
962
963
  engine.state.userText = body; engine.state.loadedAt = Date.now()
963
- return '已更新 ' + p.userFile
964
+ return '已更新用户级记忆: ' + p.userFile + '\n追加内容:\n' + content
964
965
  }),
965
966
 
966
967
  defineTool('memory_recall', '检索记忆:本地记忆文件(每日日志、项目笔记、用户级记忆、反思)关键词匹配 + 历史 DSH 会话全文检索(如部署启用)。用户提到过去的做法/讨论/决定而当前上下文没有时调用,查询必须自包含。', {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@a9i5k4/dsh-auto-memory",
3
3
  "description": "DSH 自动记忆插件:三层记忆(用户级/项目笔记/每日日志)自动注入与检索、每日反思、可视化面板与设置页,支持继承其他 AI 工具的记忆。",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {