Introduction¶
In DeepSeek Harness (DSH) development scenarios, the model context window is limited, and memory after a conversation ends often cannot be retained. Manually maintaining context is cumbersome and easily loses key information. The dsh-local-memory plugin provides cross-session memory persistence through the local file system.
This plugin is maintained by caopu16 and is a memory-type plugin. Its core value is: automatically capturing a summary of each conversation turn, injecting recent memory into the current context, and providing a keyword-based retrieval tool so the model can actively recall historical information when needed.
Core Features¶
The plugin mainly provides three capabilities:
-
capture (Capture)
After each conversation turn ends (turn/end), the user and assistant dialogue is summarized into markdown bullet format and appended to the.memsearch/memory/YYYY-MM-DD.mdfile under the project directory. -
inject (Injection)
At the first step of each conversation turn, it automatically injects a memory snapshot for the most recentinjectDaysdays (default is 2 days). This allows the model to instantly obtain short-term context when handling new topics. -
memory_search (Retrieval)
Provides thememory_searchtool, supporting pure JavaScript keyword matching. Unlikeinject, which is limited to recent entries, this tool can search all historical daily files, allowing the model to actively retrieve information when a topic may predate the injection window.
Installation and Enablement¶
The official recommendation is to install it using DSH’s plugin command.
# 已安装 dsh CLI 时
dsh plugin --profile web add github:caopu16/dsh-local-memory
# 从 deepseek-harness 源码运行时
cd /path/to/deepseek-harness
pnpm dsh plugin --profile web add github:caopu16/dsh-local-memory
After installation, you must restart DSH and start a new session; only then will the memory_search tool appear in the tool list. Already open sessions will not automatically receive new tools.
Configuration¶
After the plugin is installed, it is mounted by the bundle’s included cordis.patch.yml. If you need to override the default configuration, you can patch the same entry in ~/.dsh/profiles/web/cordis.patch.yml:
- id: local-memory
name: 'dsh-local-memory'
config:
injectDays: 3
searchMaxResults: 10
provider: ''
model: ''
The main configuration items are described below:
| Configuration Item | Default Value | Description |
|---|---|---|
captureEnabled |
true |
Whether to capture summaries of new conversations |
injectEnabled |
true |
Whether to inject memory at step 1 of each turn |
searchEnabled |
true |
Whether to register the memory_search tool |
injectDays |
2 |
How many daily files to look back when injecting |
searchMaxResults |
20 |
Maximum number of turn blocks returned per search |
captureMaxChars |
24000 |
Maximum number of characters from a single turn’s raw text sent to the summarizer |
summarizeMaxTokens |
1200 |
Maximum number of tokens for summaries |
Typical Usage¶
In normal conversations, the plugin runs automatically without manual intervention. capture is responsible for recording, and inject is responsible for supplementing context.
When a topic involves content from days ago (beyond the injectDays window), the model can proactively call the tool:
memory_search(query: "flyway V22", top_k: 5)
The system traverses all historical daily files, scores results based on keyword and substring matching, and returns results including the date, turn title, and body snippet.
Technical Implementation and Ecosystem¶
This plugin is implemented using pure JavaScript and plain text, with no native dependencies. This means it does not depend on pymilvus, numpy, or the memsearch CLI, and therefore is not affected by local CPU architecture limitations (such as not meeting the x86-64-v2 baseline).
In terms of ecosystem, it remains compatible with the opencode memsearch plugin, sharing the .memsearch/memory/ directory and anchor format. The two can read from each other without overwriting each other.
Project Structure¶
The project structure is as follows:
~/dsh-local-memory/
├── src/
│ ├── index.mjs # 插件入口
│ ├── capture.mjs # 摘要与写入
│ ├── inject.mjs # 记忆读取与注入
│ └── search.mjs # 关键词检索
├── lib/ # 构建产物
├── cordis.patch.yml # DSH 补丁声明
└── package.json