---
title: "用 DSH Memento 管理分层、可审批的长期记忆"
seo_title: "DSH Memento 配置：可审批、可审计的跨会话记忆"
description: "在 DeepSeek Harness（DSH）中安装 Memento，配置工作区与全局记忆、写入审批、审计和冻结快照，并清理 SQLite 数据。"
canonical: https://52dsh.com/tutorials/perrylink-dsh-memento-install-config/
authors: ["52DSH 编辑部"]
published_at: 2026-08-22
updated_at: 2026-08-22
verified_on: 2026-08-22
maintenance_status: community
verification_level: source_reviewed
risk_level: high
plugin_id: perrylink-dsh-memento
tutorial_kind: plugin_configuration
related_plugin_url: https://52dsh.com/plugins/perrylink-dsh-memento/
---

# 用 DSH Memento 管理分层、可审批的长期记忆

在 DeepSeek Harness（DSH）中安装 Memento，配置工作区与全局记忆、写入审批、审计和冻结快照，并清理 SQLite 数据。

为 DSH 提供有字符预算、分用户/Agent 与全局/工作区层级、可审批和可审计的跨会话记忆，并把冻结快照注入后续会话。

如果你的目标是配置可审批、可审计且分层的 DSH 跨会话记忆，本教程会说明如何在 DeepSeek Harness（DSH）中准备、安装、配置、验证和回退 dsh-memento。本文锁定作者仓库提交 `6a87b7e67ac5`；已复核固定提交的原始资料，未进行运行实测。

> 对应插件：[查看 dsh-memento 的功能、权限与兼容性说明](/plugins/perrylink-dsh-memento/)。先确认它适合你的工作流，再执行安装。

## 先确认是否适合你

- **分类**：知识与记忆
- **风险等级**：high
- **核验证据**：source_reviewed
- **兼容性边界**：插件版本 0.4.3，要求 Node.js 22.19 或 24+，peer 依赖明确覆盖 DSH Session/Tools 0.1.0-rc.8 至 <0.2.0；本站完成固定提交静态审阅，未运行长期迁移、双进程并发、跨平台权限或记忆投毒测试
- **主要权限关注**：注册 memory/memory_recall 工具、命令和只读 Web 面板，读写本机 SQLite 记忆库并向系统提示词注入冻结记忆；默认写策略 ask，也可配置 auto 直接一次放行或 off

如果你准备在重要工作区使用，先阅读插件详情页的权限和数据流说明；“源码已审阅”或“资料已整理”都不等于安全认证。

## 安装前准备

1. 安装 Node.js 22.19、Node.js 24 或项目当前声明支持的更高版本，并确认 `pnpm` 可用。
2. 使用独立的 `web` Profile 和可丢弃测试工作区，不直接连接生产目录。
3. 备份当前 Profile 配置，并记录安装前的 `--dump-config` 输出。
4. 核对固定来源中的外部服务、账号、运行时和平台限制。
5. 作者资料未显示明确的插件专属环境变量；如果运行时要求凭据，不要根据同类插件猜测变量名。

## 安装 dsh-memento

52DSH 使用目录中记录的精确安装目标，避免直接跟随可能变化的默认分支：

```bash
npx --yes @deepseek-ai/dsh@0.1.1-rc.2 plugin --profile web add github:PerryLink/dsh-memento#6a87b7e67ac5
```

GitHub 源码插件如果被 pnpm 拦截构建脚本，先检查终端提示的具体包和脚本。只在 `web` Profile 中放行确实需要的构建项，不要全局放行未知依赖。

作者文档还出现了以下命令。它们用于核对功能或开发流程，不应替换上面的锁定安装命令，也不要一次全部执行：

- `dsh plugin --profile web add "github:PerryLink/dsh-memento#main"`
- `dsh plugin --profile web add dsh-memento`
- `dsh --profile web --dump-config | grep -A3 'id: memento'`

## 插件专属配置

固定提交中包含配置或设置章节。下面只保留能够追溯到作者文档的字段和片段。

**本类插件的最小权限设置：**把存储目录和允许读取的来源限制在独立测试路径，先导入少量不含敏感信息的文档。

### 作者配置片段（README.zh.md）

来源：[固定提交中的 README.zh.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.zh.md)。复制前先替换占位符并删除不需要的权限。

```sh
# 1. install the bundle into your profile
dsh plugin --profile web add "github:PerryLink/dsh-memento#main"

# or from npm (published releases)
dsh plugin --profile web add dsh-memento

# 2. restart and verify the row
dsh --profile web --dump-config | grep -A3 'id: memento'
```

### 作者配置片段（docs/adapters-guide.md）

来源：[固定提交中的 docs/adapters-guide.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/docs/adapters-guide.md)。复制前先替换占位符并删除不需要的权限。

```js
// your-plugin/adapters/my-format.mjs
export const myFormatAdapter = {
  id: 'my-format',               // lowercase kebab-case, unique in the registry
  name: 'My format',
  description: 'Converts my-format exports to protocol entries and back.',
  version: '1.0.0',
  importFormats: ['my-format-v1'],   // labels shown by /memory adapters
  exportFormat: 'my-format-v1',

  // payload -> protocol entry inputs. Pure data conversion ONLY:
  // never call a model for extraction or summarization.
  adapt(payload) {
    // return { entries: [{ track, scope, text, source?, tags?, workspaceKey?, agentKey? }] }
  },

  // protocol entries -> your format (JSON-safe value)
  export(entries) {
    // return your format document
  },
}
```


## 配置验证与成功结果

1. **确认 Bundle 已加载**

   ```bash
   npx --yes @deepseek-ai/dsh@0.1.1-rc.2 --profile web --dump-config
   ```

   期望结果：组合配置中出现 `dsh-memento` 或仓库声明的 Bundle 名称。

2. **启动 Web Profile**

   ```bash
   npx --yes @deepseek-ai/dsh@0.1.1-rc.2 web
   ```

   期望结果：DSH Web 正常启动，浏览器控制台和终端没有持续重复的插件加载错误。

3. **执行插件专属最小任务**

   写入一条可识别的测试内容，再从新会话检索它并核对原始来源。

   期望结果：检索结果包含测试内容且能追溯来源；删除测试数据后不再返回该内容。

## 第一次使用

- 导入一篇测试 Markdown，询问标题和一个明确事实，并核对引用位置。
- 只验证一个核心能力，保存输入、输出和日志；确认无异常后再扩大权限或数据范围。

## 数据、权限与凭据

**数据流：**模型、命令或适配器提出的记忆变更 → ask/auto/off 写入门与审批审计 → 权限 0600 的本机 SQLite → 按会话 cwd、轨道与层级筛选的冻结快照 → 后续 Agent 系统提示词；召回还可匹配近期本机会话历史。

**权限关注：**注册 memory/memory_recall 工具、命令和只读 Web 面板，读写本机 SQLite 记忆库并向系统提示词注入冻结记忆；默认写策略 ask，也可配置 auto 直接一次放行或 off

**数据存储：**作者资料没有形成统一存储结论。测试时检查 web Profile、工作区、用户目录以及所连接的外部服务，并记录新增文件或远端数据。

真实 Token、API Key、Cookie 和账号 ID 不应写进 Git 仓库、网页截图或公开 Issue。测试结束后撤销临时凭据。

## 卸载、回退与清理

1. 停止正在运行的 DSH Web。
2. 从同一个 Profile 移除插件：

   ```bash
   npx --yes @deepseek-ai/dsh@0.1.1-rc.2 plugin --profile web remove dsh-memento
   ```

3. 再次运行 `--dump-config`，确认对应 Bundle 已消失。
4. 检查测试工作区、插件声明的数据目录和外部服务，手动删除测试数据并撤销测试凭据。卸载依赖不会自动删除这些数据。

## 常见问题

### 安装成功但页面或命令没有出现

先运行 `--dump-config` 确认 Bundle 已进入 `web` Profile，再重启 DSH Web 并硬刷新浏览器。不要通过反复扩大权限来解决加载问题。

### 插件运行后没有得到预期结果

把问题缩小到本页的最小验证任务，检查作者文档要求的变量、外部服务和平台限制。保存终端错误原文，并核对当前安装目标是否仍对应本页固定提交。

作者固定资料中未识别到独立故障章节。遇到插件特有错误时，应先停止 DSH、保留日志并回退插件。

## 固定来源证据

以下资料是本文配置结论的依据：

- [README.zh.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.zh.md)
- [README.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.md)
- [SECURITY.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/SECURITY.md)
- [README.es.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.es.md)
- [README.pt.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.pt.md)
- [README.hi.md](https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.hi.md)

继续查看：[返回 dsh-memento 插件详情页](/plugins/perrylink-dsh-memento/)，重新核对兼容性、权限、同类插件和来源状态。

## 原始来源

- https://github.com/PerryLink/dsh-memento
- https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.zh.md
- https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.md
- https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/SECURITY.md
- https://github.com/PerryLink/dsh-memento/blob/6a87b7e67ac5487598c591b5f17204aa30496dc5/README.es.md
