dsh-memory-vault: Providing Cross-Session Local Long-Term Memory for DeepSeek Harness

Preface

When building agents or long-term collaboration in DeepSeek Harness (DSH), a common pain point is: after starting a new session, the model can only rely on messages in the current window. Deployment parameters agreed upon last time, pitfalls encountered, and project conventions often have to be repeated. Pasting the entire historical context into the prompt each time quickly fills the window; relying solely on the model-side context limit of around 128K also cannot fit the large amount of conversations accumulated on disk all at once.

Below is the community plugin dsh-memory-vault (maintainer xying-lm, category: memory). It automatically deposits key content from users and assistants into a local SQLite database, uses FTS5 for on-demand retrieval and prompt injection, and provides a web panel to view storage usage; it does not depend on npm to install additional packages, and the retrieval side uses Node’s built-in node:sqlite (FTS5 trigram).

What is this

dsh-memory-vault is a bundle plugin for DSH (current package version 0.12.0, license MIT). Its positioning can be summarized as: a cross-session local long-term memory vault—things said and key points answered by the assistant are written into the library file. Before each conversation turn, a small segment of relevant history is recalled based on the query, and the model can flip through pages or read full text in segments via tools when necessary.

It does not expand the hard limit of the model’s context window; what changes is “how much can be retrieved from within the window”: any memory in the vault is theoretically accessible. Single injections are controlled at around one to two thousand characters (configurable). Large capacity (default tier about 5GB) exists as disk storage + serial reading, rather than entering the prompt all at once.

Core Features

Automatic capture and recall

When enabled, conversations enter an in-memory queue through session/event (batched about every 1 second) and are written to SQLite (mem + mem_fts). Before the next user input turn, injection happens through systemPrompt.context:

  • Compression layer (sessionIndex, enabled by default): Only in the first turn of a new session, inject summary points from several past sessions (default max 6 sessions, each around 150 characters).
  • Automatic recall (recall): Each turn retrieves top-k relevant excerpts (default 5, with id=), total characters limited by recallMaxChars etc.

Capture can be configured to include assistant replies (captureAssistant), minimum character count (captureMinChars), and whether to skip subagent sessions (skipSubagent). The injection block is marked with 【长期记忆·自动召回】 to avoid being captured again and forming a snowball effect.

Seven tools (parallel with automatic recall)

Tool Purpose
memory_search Search in long-term memory, supports Chinese full sentences and offset pagination
memory_open Read full text in segments by id (chars controls each page, returns next for continuation)
memory_catalog Vault catalog: entry count, distribution by day, recent sessions, etc.
memory_save Explicitly write a memory entry, optional mode
memory_stats Entry count, usage, quota, tier, etc.
memory_resize Adjust capacity limit (common tiers or 0.05~200 GB custom)
memory_forget Delete by id (irrecoverable)

The README emphasizes: automatic recall is convenient but may miss things; tools require the model to proactively call them but are more precise. Having both paths enabled simultaneously is more stable.

Three memory modes

Mode Lifecycle
long (default) Long-term retention, recallable across sessions
multi Only visible within the session it was written to, cleaned up after about 12 hours
once Deleted from the vault after being automatically recalled once

The default mode for automatic capture is controlled by captureMode; memory_save uses defaultMode when mode is not passed. To the right of the “Full Permissions” input box there is a “Memory Long ▾” session-level switch (Long / Session / Once), which only affects the current session and reverts to the configured default after restart.

Conversation files (threads)

Each thread can correspond to a .md file in threads\ under the vault directory: the first message can automatically create a file, or it can be attached to an old file to continue the conversation. When attaching to an old file, retrieval prioritizes that thread, and threadAutoSend can be configured to continue the last answer from the previous session as a real user message (once per session). Human-readable markdown coexists with the thread foreign key in the vault.

Retrieval and “human-like memory”

Retrieval uses FTS5 trigram (substrings of three or more characters) plus two-character word supplements on the most recent 2000 entries; optional humanMemory does three-factor ranking (relevance × salience × time decay) and associative expansion; factCards consolidates recurring cross-session key points into fact cards and prioritizes their recall. The README clarifies: no vector embeddings, so semantic proximity retrieval for different phrasings is limited.

Web panel

panel is enabled by default, providing read-only viewing and capacity adjustment (resize is a write route) at /memory-vault/* on the host web carrier. It listens on the local loopback address by default.

Installation and enabling

The installation method in the materials is: first obtain the plugin directory, then install it as a bundle in DSH.

git clone https://github.com/xying-lm/dsh-memory-vault.git
plugin_manager install_bundle  target="file:<your clone path>/dsh-memory-vault"

You can also fill in the local path in the GUI “Settings → Plugins → Install Plugin”. After installation, restart DSH (closing the window is not equivalent to quitting the tray process); the plugin is loaded at host startup, with no hot reload.

Runtime environment: package.json requires Node ^22.19.0 || >=24.0.0; optional peer @deepseek-ai/dsh-tools.

Default vault path: Windows is D:\dsh-memory\vault.db; macOS / Linux is ~/.dsh-memory/vault.db, which can be modified via dbPath or the panel “Vault Location” (requires restart after changing the path).

Typical usage

1. Install and turn on the master switch

Ensure enabled, capture, recall are true in the config (all default). When only cross-session history is needed, recallSameSession can be set to false.

2. Rely on automatic recall to continue old topics

Just chat normally; inputs shorter than recallMinQueryChars (default 4) do not trigger retrieval. The first turn of a new session will receive a summary index of past session points (if sessionIndex is enabled).

3. Let the model query the vault precisely

In conversation, ask the assistant to call tools, for example:

  • Use memory_search to change keywords or paginate with offset (the tool returns about 220-character summaries, max 20 entries per call).
  • Use memory_open id=… chars=2400 to read a full entry in segments.
  • Use memory_save to write agreements, preferences, or key decisions, optionally specifying mode: "multi" or "once".

4. Continue the same thread

Attach to an existing .md under threads via the “File” button on the left side of the input box; if threadAutoSend is enabled, the first user-side message of a new session will carry the last answer summary from the previous session (default max about 600 characters, see threadResumeChars).

5. Check usage and adjust capacity

Call memory_stats, or open the web panel; to expand or shrink the vault, use memory_resize or the panel resize. Config items sizePreset / maxGB can also be adjusted in the config file.

Suitable scenarios and notes

Suitable for: Scenarios where you need to retain conversation facts locally long-term, retrieve specific information across sessions (e.g., “the deployment script name mentioned last time”), continue the same thread across multiple sessions, and accept “on-demand reading, serial pagination” rather than whole-vault inference at once.

Not suitable for or boundaries to know: Global statistics and inference across the entire vault are still limited by the window and serial reading; recall for semantically similar different phrasings is weaker than vector solutions; the compression layer is extractive key points and will not do deep summarization for you.

Security and trust: The plugin reads and writes the local database and threads directory with the current DSH process permissions, and exposes panel HTTP routes on the local machine. Before installing, please review the GitHub repository source code and MIT license yourself, confirming that paths and listening addresses comply with your environment policy. The community directory SkillHub plugin page is an independent listing site with no official affiliation with DeepSeek / Quantfire; the DSH ecosystem follows “everything is a plugin”, and whether to enable it is decided locally by you.

Invalid config items will report errors at load time and indicate the key name, without silently using wrong configuration.

Conclusion

dsh-memory-vault places the “searchable scope” into a local large-capacity SQLite, uses compressed indexing, automatic recall, and seven memory_* tools for layered data retrieval, combined with conversation files to continue threads. If you are doing long-term collaboration in DSH, it is worth comparing the README’s configuration table item by item against your own capture, recall budget, and mode requirements.

  • Directory page: https://www.skillhub.cn/plugins/xying-lm/dsh-memory-vault
  • Source code and documentation: https://github.com/xying-lm/dsh-memory-vault
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye