diff --git a/examples/mcp-memory/README.i18n.yaml b/examples/mcp-memory/README.i18n.yaml index f2b9153850..b69766153c 100644 --- a/examples/mcp-memory/README.i18n.yaml +++ b/examples/mcp-memory/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write examples/mcp-memory/README.md -README.md: e0ca7ee4f18d0d8612f8e2ad5b3ba28ac15b2479 -README.zh.md: e5af09a98c8386697acde43b5f3db5438d90d69d +README.md: 97d7da66bad3b7b4a14d54a94788108b3831ccc4 +README.zh.md: 5d7c19ae76f10b795dc8e1b39c768851921b0703 diff --git a/examples/mcp-memory/README.md b/examples/mcp-memory/README.md index e0ca7ee4f1..97d7da66ba 100644 --- a/examples/mcp-memory/README.md +++ b/examples/mcp-memory/README.md @@ -22,14 +22,25 @@ The stdio bridge deliberately removes ambient credential-shaped and `DSH_*` vari ## Enable one -Use a stable user id across sessions, then pass one overlay to DSH: +Pass one overlay to DSH: ```sh -export DSH_MEMORY_USER_ID=alice dsh --config "$PWD/examples/mcp-memory/memorix.cordis.yml" ``` -Replace the filename with `mcp-reference-memory.cordis.yml` or `engram.cordis.yml`. The path may point to a copied file anywhere on disk. No memory server is present in the shipped composition, so omitting `--config` keeps all three disabled. +Replace the filename with `mcp-reference-memory.cordis.yml` or `engram.cordis.yml`. Those two examples also accept `DSH_MEMORY_USER_ID` for stable per-user storage. The path may point to a copied file anywhere on disk. No memory server is present in the shipped composition, so omitting `--config` keeps all three disabled. + +Without a repository checkout, download the selected overlay directly: + +```sh +mkdir -p "${DSH_HOME:-$HOME/.dsh}" +curl --fail --location \ + --output "${DSH_HOME:-$HOME/.dsh}/memory.cordis.yml" \ + https://raw.githubusercontent.com/deepseek-harness/deepseek-harness/master/examples/mcp-memory/memorix.cordis.yml +dsh --config "${DSH_HOME:-$HOME/.dsh}/memory.cordis.yml" +``` + +Replace `memorix.cordis.yml` in the URL with either of the other filenames to select it. Review a downloaded overlay before running it: Cordis configuration can contain executable `!!js` expressions. To keep the selection in personal configuration, merge the chosen file's single `insert` patch into `$DSH_HOME/config.yaml` (normally `~/.dsh/config.yaml`). Do not copy over an existing file: it may already contain unrelated personal patches. @@ -39,11 +50,10 @@ To keep the selection in personal configuration, merge the chosen file's single ```sh npm install --global memorix@1.3.0 -export DSH_MEMORY_USER_ID=alice dsh --config "$PWD/examples/mcp-memory/memorix.cordis.yml" ``` -Memorix works in local heuristic mode without an LLM or embedding service. Configure optional providers in Memorix's own `~/.memorix/config.toml` or project `memorix.toml`. The example keeps Memorix's Git-project identity from the DSH working directory and maps `DSH_MEMORY_USER_ID` to a private `MEMORIX_DATA_DIR`. +Memorix works in local heuristic mode without an LLM or embedding service. Configure optional providers in Memorix's own `~/.memorix/config.toml` or project `memorix.toml`. The example keeps Memorix's Git-project identity from the DSH working directory and uses Memorix's own `~/.memorix/data` default. Set `MEMORIX_DATA_DIR` before starting DSH to override it. ### MCP Reference Memory @@ -77,7 +87,7 @@ This is additive guidance only. The examples do not replace DSH's system-prompt ## Verify write, fresh-session recall, and use -Use one unique value, the same provider scope, and the same `DSH_MEMORY_USER_ID` throughout: +Use one unique value and keep the provider's storage scope unchanged throughout: 1. In DSH session A, ask: `Remember that my validation drink is lapsang-.` Confirm the model called the provider's write tool and the tool returned success. 2. Create DSH session B in the same running Host. Do not copy session A's conversation. Ask: `What is my validation drink? Check memory.` Confirm the model called the provider's search or recall tool and returned the value. diff --git a/examples/mcp-memory/README.zh.md b/examples/mcp-memory/README.zh.md index e5af09a98c..5d7c19ae76 100644 --- a/examples/mcp-memory/README.zh.md +++ b/examples/mcp-memory/README.zh.md @@ -22,14 +22,25 @@ stdio 桥接器在启动子进程前会主动移除环境中名称类似凭据 ## 启用一个 -在多个会话间使用一个稳定的用户 id,然后将一份 overlay 传给 DSH: +将一份 overlay 传给 DSH: ```sh -export DSH_MEMORY_USER_ID=alice dsh --config "$PWD/examples/mcp-memory/memorix.cordis.yml" ``` -请将文件名替换为 `mcp-reference-memory.cordis.yml` 或 `engram.cordis.yml`。该路径可以指向磁盘任意位置的一份复制文件。交付组合不包含任何记忆服务器,因此不传 `--config` 就会让这三项全部保持关闭。 +请将文件名替换为 `mcp-reference-memory.cordis.yml` 或 `engram.cordis.yml`。另外两份示例也接受 `DSH_MEMORY_USER_ID`,用于稳定的逐用户存储。该路径可以指向磁盘任意位置的一份复制文件。交付组合不包含任何记忆服务器,因此不传 `--config` 就会让这三项全部保持关闭。 + +如果本地没有仓库 checkout,可直接下载所选 overlay: + +```sh +mkdir -p "${DSH_HOME:-$HOME/.dsh}" +curl --fail --location \ + --output "${DSH_HOME:-$HOME/.dsh}/memory.cordis.yml" \ + https://raw.githubusercontent.com/deepseek-harness/deepseek-harness/master/examples/mcp-memory/memorix.cordis.yml +dsh --config "${DSH_HOME:-$HOME/.dsh}/memory.cordis.yml" +``` + +若要选择另外任一配置,请将 URL 中的 `memorix.cordis.yml` 替换为对应文件名。运行下载的 overlay 前,请先审阅其内容:Cordis 配置可以包含可执行的 `!!js` 表达式。 如果要把所选配置保存在个人配置中,请将对应文件中的单个 `insert` patch 合并到 `$DSH_HOME/config.yaml`(通常是 `~/.dsh/config.yaml`)。不要覆盖已有文件,其中可能已经包含无关的个人 patch。 @@ -39,11 +50,10 @@ dsh --config "$PWD/examples/mcp-memory/memorix.cordis.yml" ```sh npm install --global memorix@1.3.0 -export DSH_MEMORY_USER_ID=alice dsh --config "$PWD/examples/mcp-memory/memorix.cordis.yml" ``` -Memorix 无需 LLM(大语言模型)或 embedding 服务,即可在本地启发式模式下运行。请在 Memorix 自己的 `~/.memorix/config.toml` 或项目 `memorix.toml` 中配置可选提供方。该示例沿用 DSH 工作目录中的 Git 项目标识,并将 `DSH_MEMORY_USER_ID` 映射到独立的 `MEMORIX_DATA_DIR`。 +Memorix 无需 LLM(大语言模型)或 embedding 服务,即可在本地启发式模式下运行。请在 Memorix 自己的 `~/.memorix/config.toml` 或项目 `memorix.toml` 中配置可选提供方。该示例沿用 DSH 工作目录中的 Git 项目标识,并使用 Memorix 自身的默认目录 `~/.memorix/data`。若要覆盖该目录,请在启动 DSH 前设置 `MEMORIX_DATA_DIR`。 ### MCP Reference Memory @@ -77,7 +87,7 @@ dsh --config "$PWD/examples/mcp-memory/engram.cordis.yml" ## 验证写入、新会话召回和使用 -请在整个过程中使用一个唯一值、相同的提供方范围和相同的 `DSH_MEMORY_USER_ID`: +请在整个过程中使用一个唯一值,并保持提供方的存储范围不变: 1. 在 DSH 会话 A 中提出:`Remember that my validation drink is lapsang-.`。确认模型调用了提供方的写入工具,并且工具返回成功。 2. 在同一个仍在运行的 Host 中创建 DSH 会话 B。不要复制会话 A 的对话。提出:`What is my validation drink? Check memory.`。确认模型调用了提供方的搜索或召回工具,并返回该值。 diff --git a/examples/mcp-memory/memorix.cordis.yml b/examples/mcp-memory/memorix.cordis.yml index 4253262d12..c993581eae 100644 --- a/examples/mcp-memory/memorix.cordis.yml +++ b/examples/mcp-memory/memorix.cordis.yml @@ -9,6 +9,3 @@ command: memorix args: [serve] cwd: !!js process.cwd() - env: - MEMORIX_DATA_DIR: !!js >- - process.env.MEMORIX_DATA_DIR ?? (() => { const path = process.getBuiltinModule('node:path'); const os = process.getBuiltinModule('node:os'); const crypto = process.getBuiltinModule('node:crypto'); const configured = process.env.DSH_HOME; const root = configured !== undefined && configured.trim().length > 0 ? configured : path.join(os.homedir(), '.dsh'); const user = process.env.DSH_MEMORY_USER_ID?.trim() || 'default'; const scope = crypto.createHash('sha256').update(user).digest('hex').slice(0, 16); return path.join(path.resolve(root), 'mcp-memory', 'memorix', scope) })()