dsh-memory README

The project's README from github.com/seriousz158/dsh-memory. As one markdown file: README.md.

dsh-memory

dsh-memory is a local, Git-backed long-term-memory plugin for DeepSeek Harness (DSH).

It adds one persistent setting, a safe settings-page workflow for clearing memories, and an optional idle-session synchronizer. The host plugin injects memory guidance only when memory.enabled is true; the UI plugin lets a user inspect the repository state, toggle the setting, and clear learned memory through a deliberate two-step confirmation.

What it does

Capabilities

This README describes stable user-facing behavior. Release-by-release implementation details are intentionally kept out of this page; see CHANGELOG.md and the GitHub releases for historical changes.

Local Git-backed memory

Safe synchronization and recovery

Read path

DSH settings integration

The settings UI provides the memory toggle, repository status, recent-sync state, preview actions, rollback, and deliberate clear confirmation. It does not expose the filesystem root or execute Git directly.

Compatibility

v0.9.2 keeps the DSH 0.1.0-rc.6 peer-compatibility range and has been tested and locally integrated with a consistently pinned 0.1.0-rc.7 graph:

Component Supported version
DSH runtime peer range @deepseek-ai/dsh@^0.1.0-rc.6 (rc.6 and rc.7)
Recommended/tested runtime 0.1.0-rc.7
Clean-room development test graph DSH client packages 0.1.0-rc.7
Node.js 22.x
Python 3.11.x
Git a local executable available on PATH
Operating system macOS is the supported/tested integration target

The package uses DSH's Cordis loader interfaces. The rc.7 graph is the reproducible development and integration baseline because the registry's rc.6 transitive peer graph cannot be installed by plain npm ci; this does not change the host/UI packages' declared rc.6 runtime peer range. DSH rc.8 and later releases are unverified until they pass this repository's test suite.

Install

The repository root is also a public DSH bundle named dsh-git-memory. It contains the host plugin, the settings-page client bundle, and its dsh.bundle patch, so one install activates both halves:

# GitHub source install (works before or without an npm publication)
dsh plugin --profile web add github:seriousz158/dsh-memory

This project is distributed through GitHub source installs and GitHub Releases. It is not published to npm.

Restart the selected DSH profile after installing. The bundle does not include any memory data, session logs, credentials, or the local .dsh directory.

Source checkout (development / local integration)

Clone the repository and install its reproducible development/runtime dependencies:

git clone https://github.com/seriousz158/dsh-memory.git
cd dsh-memory
# Use the pinned runtime that this v0.8.4 integration was tested with.
npm install --global @deepseek-ai/[email protected]
dsh --version
npm ci --ignore-scripts

The two workspace implementation packages remain private; only the root dsh-git-memory bundle is publishable. This keeps the internal host/UI package names stable while avoiding the already-occupied unscoped dsh-memory npm name.

Install the two local packages into your DSH profile. The installer defaults to ~/.dsh. If you use a non-default DSH or memory path, keep the same values in the environment that installs, starts, validates, and synchronizes DSH:

./integrations/dsh/install.sh

# Example for a non-default DSH home and memory repository:
export DSH_HOME="$HOME/.config/dsh"
export DSH_MEMORY_ROOT="$HOME/Documents/dsh-memory-data"
./integrations/dsh/install.sh
# Start DSH from this configured environment as well.

The installer creates only these DSH-profile links and the two required Cordis entries:

<DSH_HOME>/profiles/node_modules/dsh-memory
<DSH_HOME>/profiles/node_modules/dsh-memory-ui

It also initializes a missing memory root as a private local Git repository. For an existing complete memory repository, it verifies the layout and restores owner-only permissions; it does not delete or rewrite learned memory, session history, credentials, other plugins, or unrelated cordis.patch.yml entries. See installation details before using a custom memory root.

Restart the DSH host after installation. In DSH Settings, find 长期记忆 and leave the switch on to enable recall for the next model call.

Storage layout

By default the host uses:

<DSH_HOME>/storages/memory

with DSH_HOME defaulting to ~/.dsh. An operator can set DSH_MEMORY_ROOT to a different local absolute path. It must be present for the installer, every DSH host launch, explicit initializer run, and optional synchronizer run; a one-time installation assignment does not configure future LaunchAgent jobs. The web UI cannot submit or change a filesystem path.

The initialized repository contains:

summary.md      short, stable navigation and preferences
handbook/       reusable knowledge
rollouts/       per-session extraction results
archive/        superseded entries
scripts/        transcript filter helper
.last-sync      optional synchronizer watermark

Settings and API

The only persisted setting is:

memory:
  enabled: true

The local UI talks only to the fixed memory remote service:

memory.getSettings()
memory.setEnabled({ enabled: boolean })
memory.status()
memory.legacyRecords()
memory.migrateLegacy({ dryRun: boolean })
memory.clear({ confirmation: "DELETE_MEMORY" })

status() reports metadata such as empty, dataFileCount, targetDirty, and recoverable; it never returns the memory body. Full request/response contracts and stable error codes are in docs/api.md.

Clear memory safely

The settings UI intentionally requires two acknowledgements:

  1. Click 删除记忆, read the affected paths, then click 继续.
  2. Enter exactly 删除记忆, then click the final confirmation.

The clear operation is designed for recoverable day-to-day resets, not guaranteed privacy erasure. Before it changes any target memory path, it preserves a recovery point: for a clean repository this is the existing pre-clear HEAD, while dirty target paths are captured in a dedicated checkpoint commit. The clear commit is then created directly on that recovery point. The operation leaves .git, README.md, helper scripts, directory structure, and .last-sync intact so future sessions can learn again without reprocessing historical logs.

Use Git history inside the local memory repository to recover a checkpoint. For privacy-sensitive deletion requirements, remove relevant local backups and follow your organization's retention policy; Git history alone is not a secure-erasure mechanism.

Optional idle-session sync

The optional synchronizer is separate from the settings UI:

./integrations/dsh/dsh-memory-sync

It skips work when memory.enabled is false, and it skips active sessions. It needs a user-installed dsh executable (or an explicitly selected DSH_BIN), rather than invoking npx --yes. It defaults to workspace-write; wider privileges are never a repository default. The LaunchAgent template explicitly sets the default DSH and memory paths; edit both assignments before loading it when your installation is custom.

The session filter redacts common credential shapes and home-directory prefixes before a transcript reaches the memory-extraction model. This is defense in depth, not a promise that every secret format is detectable. Review privacy and recovery before enabling unattended sync.

Development

Run the full, local-only suite:

npm ci --ignore-scripts
npm test

Tests use temporary Git repositories and synthetic fixtures. They must not require a DSH account, start Chrome, launch a LaunchAgent, read the current user's memory/session folders, or make a paid model request.

Before opening an issue or pull request, run:

npm test
zsh tools/secret-scan.sh

See CONTRIBUTING.md, SECURITY.md, and the release checklist.

Privacy promise

This repository contains code, tests, templates, and examples only. It must never contain any real DSH memory, session log, credential file, browser profile, or user-specific DSH configuration. If you believe sensitive data was committed, treat it as exposed, rotate affected credentials, and follow SECURITY.md.

License

MIT © 2026 seriousz158.

dsh-memory (seriousz158/dsh-memory)

Searching Database…

这是什么?dsh-memory 是一个面向 DeepSeek Harness(DSH)的本地、基于 Git 的长期记忆插件。它把记忆注入模型的上下文,并提供一个设置页界面来查看、开关和清除这些记忆。
这是一个插件还是两个独立的部分?它以一个名为 dsh-git-memory 的公开 DSH 包发布,其中打包了宿主插件(把记忆注入模型调用)和 UI 插件(设置页),一次安装即可同时启用两部分。
怎么把它安装到我的 DSH 配置里?从 GitHub 源码检出或 GitHub Release 安装 dsh-git-memory 包(它没有发布到 npm),运行安装器(它会链接到 ~/.dsh 并添加 Cordis 条目),然后重启 DSH 配置,并在 DSH 设置的“长期记忆”下打开开关。
安装之前我的机器上需要有什么?需要 Node.js 22.x、Python 3.11.x,以及 PATH 中的本地 git 可执行文件;它面向 DSH 运行时的 peer 依赖范围 ^0.1.0-rc.6,并针对 rc.7 做过测试。
它在 Windows 或 Linux 上也能运行吗?不能,macOS 是明确唯一受支持且经过测试的集成目标;DSH rc.8 及之后的版本在通过本仓库的测试套件之前也未经验证。
我的记忆数据会离开我的电脑吗?不会。记忆只存放在本地 Git 仓库中,没有托管服务或云端向量数据库,而且源码仓库本身被要求绝不包含真实记忆、会话日志或凭据。
插件如何为一次模型调用找到相关记忆?memory.search() 和 memory.context() 采用混合检索:将派生的 SQLite FTS5 索引(trigram 加 CJK 二元组/词项)与词法评分和精确子串优先相融合,如果索引缺失、过期或损坏,则回退到普通扫描。
如何清除记忆又不会意外丢失全部内容?设置界面要求两次刻意的确认(点击确认,然后输入确切的删除短语),并且在触碰 summary.md、handbook/、rollouts/ 或 archive/ 之前总会创建 Git 恢复检查点,因此你可以通过 Git 历史恢复;这是可恢复的重置,不是安全擦除的保证。
可选的空闲会话同步是做什么的?一个无头同步器可以在私密、隔离的工作区中只处理空闲的本地会话日志,默认授予工作区写入权限;它从不安装 DSH 本身,且只转发列入白名单的一组环境变量。
除模型之外还有别的能读取记忆数据吗?UI 只与固定的本地记忆状态端点通信,可以报告文件数量和脏/可恢复状态等元数据,但绝不会返回实际记忆内容,也不允许 Web UI 更改文件系统路径。
Size
0.6 MB
Stars
179
Age
1mo
Commits · 90 Days