在 DeepSeek Harness (DSH) 的使用中,会话通常是独立的,Agent 很难跨对话保留上下文。dsh-memory 插件为此提供了解决方案,它将所有会话连接到一个共享的持久存储中。

这是一个 DSH 插件,由 joyiok 维护。它为所有会话(web、headless 等)创建一个共享记忆库,存储在 $DSH_HOME/storages/dsh-memory.json。所有会话都可以读取和写入同一份数据。

Core Features

Shared Memory Store

Sessions from web, headless, and any working directory read from and write to the same data. This means information written by an Agent in one session can be directly retrieved in later sessions.

Agent Tools

The plugin provides four core tools:
* memory_add: Write a shared memory entry.
* memory_search: Search by content, tags, or category.
* memory_list: List memories.
* memory_remove: Delete a memory by id.

The Agent will automatically search memories first in a new session and actively store facts worth remembering.

Web Sidebar

In the web interface, there is a Memory button in the lower-left corner. The panel opened after clicking it supports viewing, searching, adding, and deleting memories.

Atomic Writes

The plugin implements atomic writes using temporary file + rename, ensuring safe cross-process writes; when reading, it detects external updates based on file modification time.

Installation

cd /home/joy/Documents
dsh plugin --profile web add /home/joy/Documents/dsh-memory-plugin
dsh plugin --profile headless add /home/joy/Documents/dsh-memory-plugin

After installation, restart dsh web:

dsh web

Verification: run dsh --profile web --dump-config. The configuration should include the following:

# == dsh-memory
- id: memory
  name: dsh-memory

Typical Usage

Let the Agent Remember

You can directly tell the Agent what to remember. The Agent will call the tool to store it in the shared store.

用户:记住:我们的正式语言是中文,token 预算每月 5000 万
Agent:调用 memory_add(content: ..., tags: ["preference", "budget"])

Let the Agent Recall

In a new session, the Agent can retrieve memories before answering.

(新会话)
用户:我们之前说过 token 预算多少?
Agent:调用 memory_search(query: "预算") 后回答

Web Panel Operations

Click the Memory button in the lower-left corner of the web interface:
1. Enter content in the input field.
2. Separate tags with commas (for example: work, todo).
3. Click save.
4. You can search for and delete memories in the list.

Tool Parameters

Tool Parameters Description
memory_add content required; tags / category optional Write a shared memory entry
memory_search query required; limit optional Search by content / tags / category
memory_list category / tags / limit optional List memories
memory_remove id required Delete a memory by id

Configuration

Configuration can be overridden in the profile’s cordis.patch.yml:

- id: memory
  config:
    file: /path/to/shared-memory.json   # 默认 $DSH_HOME/storages/dsh-memory.json
    maxContentChars: 20000              # 单条记忆最大字符数
    defaultSearchLimit: 20
    maxToolLimit: 100

To disable the plugin, add the following to the configuration:

- id: memory
  disabled: true

Notes

  • Sensitive Information: Memory content is visible to all sessions. Do not write sensitive information such as secrets or passwords.
  • File Corruption: If the JSON file is corrupted, the plugin will back up the corrupted file as dsh-memory.json.corrupt-<ts> and start over.

Summary

dsh-memory bridges the gaps between DSH sessions by providing a shared, persistent context layer. It enables the Agent to proactively store and retrieve information without manual intervention.