sage-mem 2.30.0 → 2.31.0
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.
- package/README.en.md +3 -7
- package/README.md +3 -7
- package/lib/client.js +34 -1
- package/lib/mirror/mcp.js +6 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
**Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker.**
|
|
14
14
|
|
|
15
|
-
**Current release: `2.
|
|
15
|
+
**Current release: `2.31.0`** — the npm badge above is the dynamic source of truth. **Contract baseline: `1.0.0`** — the first stable release, whose public commitments, the capability boundaries and the list of things it explicitly cannot do are frozen in the
|
|
16
16
|
[frozen contract](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md).
|
|
17
17
|
|
|
18
18
|
If it is useful to you, a Star is the most direct feedback.
|
|
@@ -898,13 +898,9 @@ Or manually delete the `sage-mem` dependency from the profile's `package.json` a
|
|
|
898
898
|
- **`interpolate: false` on the recall context** (2.4.2): a memory body containing double braces made the host throw `malformed prompt variable reference` while assembling the prompt, so the turn failed before the model even started — it looked like "sometimes it chats, sometimes any question fails", depending on which memories that turn happened to recall.
|
|
899
899
|
- **A short-circuit gate in the recall chain** (2.4.3): `system-prompt/assemble` fires on every step, and the old implementation ran the whole "scan → summary scoring → body BM25 → signature" chain before deduplicating. The decision inputs are all available before scoring.
|
|
900
900
|
- **The "open memory folder" entry** (2.4.0): no more hunting for the path in a file manager.
|
|
901
|
-
- **[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)** —
|
|
902
|
-
- **Everything is a plugin, plus Cordis's service / event / fiber model** — file-based memory therefore needs no worker, port, or database;
|
|
903
|
-
- **`ctx.systemPrompt.section` and `agent/pre-step`** — injection and the pre-compaction reminder land on the right seams, instead of a prompt line saying "remember to read the files";
|
|
904
|
-
- **The typert remote protocol** — the type-safe channel between panel and host; the delete guard in 2.21.0 and the rollback guard in 2.22.0 both rely on it to carry "the version you confirmed" over to the host side;
|
|
905
|
-
- **The official docs (AGENTS.md / cordis-api / persistence)** — plugin authors can verify for themselves instead of guessing.
|
|
901
|
+
- **[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)** — the host; everything is a plugin.
|
|
906
902
|
|
|
907
|
-
|
|
903
|
+
The list above follows the order in which each contribution entered the repository. Corrections and omissions are welcome — please open an issue.
|
|
908
904
|
|
|
909
905
|
## Related Projects
|
|
910
906
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
> File-based cross-session memory for DeepSeek Harness — every memory is a plain markdown file you can open, edit and delete. No database, no worker, no port.
|
|
16
16
|
|
|
17
|
-
**当前发布版本:`2.
|
|
17
|
+
**当前发布版本:`2.31.0`** —— 顶部 npm 徽章是动态权威。**契约基线:`1.0.0`** —— 第一个稳定版,公开承诺、能力边界与「明确做不到」的清单冻结在
|
|
18
18
|
[契约冻结](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md)。
|
|
19
19
|
|
|
20
20
|
如果它对你有用,给个 Star 是最直接的反馈。
|
|
@@ -903,13 +903,9 @@ dsh plugin --profile web remove sage-mem
|
|
|
903
903
|
- **注入段声明 `interpolate: false`**(2.4.2):记忆正文里出现双大括号,宿主组装 prompt 时抛 `malformed prompt variable reference`,模型还没开始跑整轮就失败 —— 表现成「有时能聊、有时一提问就挂」,取决于这一轮召回到了哪些记忆。
|
|
904
904
|
- **注入链的短路闸门**(2.4.3):`system-prompt/assemble` 每个 step 都派发,旧实现每一步都把「扫描 → 摘要打分 → 正文 BM25 → 算签名」整条跑完再判重;而判据其实在打分之前就全拿得到。
|
|
905
905
|
- **「打开记忆文件夹」入口**(2.4.0):记忆目录不必再去文件管理器里翻路径。
|
|
906
|
-
- **[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)** ——
|
|
907
|
-
- **一切皆插件 + Cordis 的 service / event / fiber** —— 文件式记忆因此不必自带 worker、端口或数据库;
|
|
908
|
-
- **`ctx.systemPrompt.section` 与 `agent/pre-step`** —— 注入与压缩前提醒能挂在正确的接缝上,而不是靠 prompt 里写「记得读文件」;
|
|
909
|
-
- **typert 远程协议** —— 面板与宿主之间那条类型安全的通道;2.21.0 的删除守卫、2.22.0 的回滚守卫都靠它把「你确认过的那一版」带到宿主侧;
|
|
910
|
-
- **官方文档(AGENTS.md / cordis-api / persistence)** —— 让插件作者能自己查证,而不是猜。
|
|
906
|
+
- **[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)** —— 宿主,一切皆插件。
|
|
911
907
|
|
|
912
|
-
|
|
908
|
+
以上按代码进入仓库的顺序排列。文档若有遗漏或错误,欢迎开 issue 指出。
|
|
913
909
|
|
|
914
910
|
## 相关项目
|
|
915
911
|
|
package/lib/client.js
CHANGED
|
@@ -4391,6 +4391,9 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
4391
4391
|
"ext.endpoint.on": "在听 {url}",
|
|
4392
4392
|
"ext.endpoint.off": "未启动",
|
|
4393
4393
|
"ext.endpoint.readFailed": "读不到状态:{error}",
|
|
4394
|
+
"ext.guide.copy": "复制接入片段",
|
|
4395
|
+
"ext.guide.copied": "已复制 —— 贴进 CLAUDE.md / AGENTS.md / .cursorrules 即可",
|
|
4396
|
+
"ext.guide.body": "## 记忆库(sage-mem)`n`n本机有一个**只读**的记忆库端点:`http://127.0.0.1:{port}/mcp`(MCP 协议)。四个工具:`memory_list` / `memory_search` / `memory_read` / `memory_submit`。`n`n**什么时候用**:`n- 开工前先 `memory_list`,看有哪些已知的项目记忆;`n- 用户提到项目名、模块名或历史决定时,先 `memory_search` 这个词 —— 库里可能已经有当初为什么那样定的记录;`n- 结论落定后再 `memory_submit`;不要提交过程流水与未确认的猜测。`n`n引用时带 name(如 `project_xxx.md`),不要假设文件路径 —— 端点不提供路径。",
|
|
4394
4397
|
"ext.endpoint.error": "起不来:{error}",
|
|
4395
4398
|
"ext.lastExport": "最近一轮:{time} · 写 {written} / 未变 {unchanged} / 删 {deleted}",
|
|
4396
4399
|
"ext.lastExport.never": "最近一轮:还没有导出过",
|
|
@@ -5130,6 +5133,9 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
5130
5133
|
"ext.endpoint.on": "listening on {url}",
|
|
5131
5134
|
"ext.endpoint.off": "not running",
|
|
5132
5135
|
"ext.endpoint.readFailed": "status unavailable: {error}",
|
|
5136
|
+
"ext.guide.copy": "Copy integration snippet",
|
|
5137
|
+
"ext.guide.copied": "Copied — paste it into CLAUDE.md / AGENTS.md / .cursorrules",
|
|
5138
|
+
"ext.guide.body": "## Memory library (sage-mem)`n`nA **read-only** memory endpoint runs on this machine: `http://127.0.0.1:{port}/mcp` (MCP). Four tools: `memory_list` / `memory_search` / `memory_read` / `memory_submit`.`n`n**When to use it**:`n- Before starting work, call `memory_list` to see which project memories already exist;`n- When the user names a project, module, or past decision, `memory_search` that term first — the library may already record why it was decided that way;`n- Call `memory_submit` once a conclusion is settled; do not submit process chatter or unconfirmed guesses.`n`nCite by name (e.g. `project_xxx.md`); do not assume file paths — the endpoint does not expose them.",
|
|
5133
5139
|
"ext.endpoint.error": "failed to start: {error}",
|
|
5134
5140
|
"ext.lastExport": "Last export: {time} · {written} written / {unchanged} unchanged / {deleted} deleted",
|
|
5135
5141
|
"ext.lastExport.never": "Last export: never ran",
|
|
@@ -8488,6 +8494,20 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
8488
8494
|
status && status.mirrorDir
|
|
8489
8495
|
? h("div", { className: "smem-autodream-note", key: "dir" }, t("ext.dir", { dir: status.mirrorDir }))
|
|
8490
8496
|
: null,
|
|
8497
|
+
// 2.31.0:MCP 是客户端驱动的,端点推不进对方的上下文 —— 能做的「被动」只有
|
|
8498
|
+
// 连接时的 instructions 与「用户把它贴进规则文件」。这一行给的是后者。
|
|
8499
|
+
h("div", { className: "smem-row", key: "guide" }, [
|
|
8500
|
+
h("button", {
|
|
8501
|
+
type: "button", className: "smem-btn smem-btn-xs",
|
|
8502
|
+
title: t("ext.guide.copied"),
|
|
8503
|
+
onClick: function () {
|
|
8504
|
+
Promise.resolve(copyPromptText(externalGuideText(ext && ext.port))).then(function (ok) {
|
|
8505
|
+
if (ok === true) setNotice(t("ext.guide.copied"));
|
|
8506
|
+
else setErr(t("ext.intake.err.noClipboard"));
|
|
8507
|
+
}, function () { setErr(t("ext.intake.err.noClipboard")); });
|
|
8508
|
+
},
|
|
8509
|
+
}, t("ext.guide.copy")),
|
|
8510
|
+
]),
|
|
8491
8511
|
status && Array.isArray(status.errors) && status.errors.length > 0
|
|
8492
8512
|
? h("div", { className: "smem-err", key: "errs" }, "⚠ " + status.errors.join(" · "))
|
|
8493
8513
|
: null,
|
|
@@ -8506,7 +8526,20 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
8506
8526
|
notice ? h("div", { className: "smem-ok", key: "ok" }, "✓ " + notice) : null,
|
|
8507
8527
|
]);
|
|
8508
8528
|
}
|
|
8509
|
-
|
|
8529
|
+
/**
|
|
8530
|
+
* 「接入片段」的正文(2.31.0)—— 一段可以直接贴进别的 agent 规则文件的文字。
|
|
8531
|
+
*
|
|
8532
|
+
* 为什么要这个东西:MCP 是**客户端驱动**的,端点没法把记忆推进对方的上下文。
|
|
8533
|
+
* 能做的「被动」只有两档 —— ① 连接时给的 `instructions`(我们已经在用),
|
|
8534
|
+
* ② 用户把它贴进 CLAUDE.md / AGENTS.md / .cursorrules 这类规则文件。
|
|
8535
|
+
* 这一条走的是第二档:不是自动化,是把「什么时候该查记忆」写进对方每一轮都读的地方。
|
|
8536
|
+
*
|
|
8537
|
+
* 只拼文本、不碰网络也不碰磁盘 —— 复制由调用方用 `copyPromptText` 做(它带降级)。
|
|
8538
|
+
*/
|
|
8539
|
+
function externalGuideText(port) {
|
|
8540
|
+
const p = Number(port) > 0 ? Math.trunc(Number(port)) : 7461;
|
|
8541
|
+
return t("ext.guide.body", { port: String(p) });
|
|
8542
|
+
}
|
|
8510
8543
|
/**
|
|
8511
8544
|
* 「外部来件」卡(2.26.0 写侧)—— 别的 agent 提交过来的东西,一条一条等人批。
|
|
8512
8545
|
*
|
package/lib/mirror/mcp.js
CHANGED
|
@@ -88,6 +88,12 @@ const INSTRUCTIONS = [
|
|
|
88
88
|
'可用工具:memory_list(有哪些)/ memory_search(按关键词找)/ memory_read(读全文)/ memory_submit(提交一条记忆或修改建议)。',
|
|
89
89
|
'引用某条记忆时请带上它的 name(如 project_xxx.md),不要假设文件路径 —— 这里不提供路径。',
|
|
90
90
|
'',
|
|
91
|
+
'## 什么时候该用(这三条比工具说明更重要)',
|
|
92
|
+
'- **开工前先看一眼**:接手一个项目或一段不熟悉的上下文时,先 `memory_list` 或 `memory_search` 项目名,比从零猜快得多。',
|
|
93
|
+
'- **听到专有名词先搜**:用户提到某个项目名、模块名、历史决定时,先 `memory_search` 这个词 —— 库里可能已经有当初为什么那样定的记录。',
|
|
94
|
+
'- **结论落定后再提交**:发现自己确认了一条可复用的结论(约定、坑、为什么这么选),用 `memory_submit` 提交;**不要**把过程流水、半成品猜测、或用户没同意的方案提交上来。',
|
|
95
|
+
'- 库里没有的,就说没有。**不要**根据文件名编内容。',
|
|
96
|
+
'',
|
|
91
97
|
'## memory_submit 的格式',
|
|
92
98
|
'- 提交**不会**直接写入用户的记忆库:它进入归并队列,由用户逐条批准。',
|
|
93
99
|
'- kind=new:必填 source / name / description / type / body;type 只能是 project 或 reference,且 name 要以对应的 project_ / reference_ 开头。正文不要自带 frontmatter。',
|
package/package.json
CHANGED