Introduction

The agent in DeepSeek Harness (DSH) relies only on the current conversation context by default. Once the conversation window is closed or the session is switched, previous interaction history is lost. dsh-persist uses the file system to store memory in layers and supports on-demand injection, solving the problem that an agent “loses memory when switching conversations.”

Core Features

This plugin provides the following core capabilities:
* Conversation-specific memory: Each conversation has its own independent memory files, inaccessible to other conversations and not interfering with them.
* Selective injection: A new conversation has zero injection by default. Only after checking the required content in the memory tab is the corresponding memory added to the context.
* Project memory sharing: Conversations under the same working directory can share project memory, while different named projects are isolated.
* Vault semantic retrieval: Vector search based on the bge-m3 model, supporting recall of memories by semantics; automatically falls back to keyword search if no API key is configured.
* Auto recall (tri-state mode): The automatic retrieval feature in the memory tab provides three modes: Off (default), Smart (local rule filtering), and LLM judgment (calls the model to decide whether retrieval is needed, automatically falling back to Smart on failure).
* Memory tab: A visual tab at the top of the conversation, supporting memory editing, checking injection settings, and real-time preview.
* All plain text: All memories are stored in Markdown format under the ~/.dsh-memory/ directory, human-readable, manually editable, and easy to back up.
* Bundle: A standard DSH bundle, installed via the dsh plugin command.

Installation and Enablement

The installation process includes two steps: install the plugin and restart DSH.

  1. Run the installation command in the terminal:
    dsh plugin --profile web add dsh-persist
  1. Restart DSH to load the plugin:
    dsh --profile web

The plugin is ready to use after installation. To enable semantic retrieval, apply for a free SiliconFlow API Key and set the environment variable SILICONFLOW_API_KEY.

Usage

Basic Operations

After installation and restart, open any conversation and a “Memory” tab will appear at the top. By default, no content is injected; you need to manually check the blocks to be injected.

The Agent can also actively read and write memories through the memory tool. The scope parameter of the tool determines the read/write scope:
* scope="conversation": Write/read the current conversation memory (default).
* scope="project": Write/read the project memory of the current working directory.
* scope="global": Write/read global keyed memories.

Semantic Vault Operations

Vault is used to store content that requires semantic retrieval, supporting operations such as add, delete, import, and export:

memory(vaultOp="add", content="...")
memory(vaultOp="delete", query="...")
memory(vaultOp="import")

Code Examples

Let the Agent remember content or query memories:

// 写入对话记忆
memory(action="add", scope="conversation", content="用户偏好使用空格缩进")

// 写入项目记忆(同目录其他对话可共享)
memory(action="add", scope="project", content="构建脚本位于 build.ps1")

// 写入全局键值对
memory(action="add", scope="global", key="user-name", content="小明")

// 查询对话记忆
memory(action="list")

Applicable Scenarios and Notes

  • Applicable scenarios: Agent development that requires long-term context retention and cross-session experience reuse, as well as users who need to organize a personal knowledge base.
  • Environment requirements: The host environment Node.js version must be >= 22.6 (24+ recommended).
  • Privacy and security:
    • After enabling semantic search (SILICONFLOW_API_KEY), message content is sent to SiliconFlow for vectorization.
    • Enabling LLM judgment mode sends messages to the specified model provider.
    • The API route /dsh-memory/api/* allows loopback access only by default; to allow remote access, set DSH_MEMORY_ALLOW_REMOTE=1.
  • Data migration: The plugin was formerly named dsh-memory; the storage path and routes are unchanged, so old data does not need migration.

Conclusion

dsh-persist provides DSH agents with controllable long-term memory capabilities through layered storage and plain-text formatting. The plugin is available on GitHub and SkillHub.