Foreword¶
DeepSeek Harness (DSH) itself does not have a memory plugin. When a new session starts, the model knows nothing about conventions established in previous sessions, pitfalls encountered, or your preferences. This plugin fills that gap, allowing DSH to share background facts across sessions.
There is a hard constraint by design: No extra cost for “remembering”. It does not call any LLM for summarization, scoring, or adjudication. All read and write operations are based on the local file system and pure string matching.
What Is This?¶
This is a DSH plugin developed by linshenyuan, categorized as “Memory”.
It stores memories as Markdown files and does not invoke any additional LLM. The plugin handles deduplication, conflict detection, audit logs, and the settings panel; the model only needs to decide “what to write” and “when to write” through tool calls.
Core Features¶
-
Cross-session long-term memory
Memories are persisted in the local file system, and new sessions can read content from old sessions. -
Pure local string matching
Reads and writes do not involve LLM calls. Deduplication is based onsha256hashing, and keyword retrieval is based on local string matching (NFKC normalization). -
Multi-dimensional retrieval
Supports reading memories byscope(project/user/both),topic(exact match), andkeywords(full-text keywords). -
Conflict detection and adjudication
When a new entry with a different conclusion appears under the sametopic, it is marked[Pending adjudication]and frozen until adjudicated manually or via the settings panel. -
Audit logs
Records all operations—save, deduplication, conflict, update, and rejection—inruns.jsonl, and supports self-checking the audit log sequence at startup. -
Settings panel management
Provides four views: Browse, Usage, Conflicts, and Audit. Supports modifying the memory limit online and adjudicating conflicts.
How It Works¶
The plugin injects memory into the context through a three-layer structure:
-
L1 · Rules section (persistent system prompt)
A fixed system prompt that tells the model where the memory store is located, when it should write, and how to nametopics. It is inserted at index 150 of the system prompt (betweenDEPLOYMENT_PERSONA_PREFIXandPLAN_POLICY) as background facts rather than policy. -
L2 · Read on demand
Memory is no longer injected in bulk at session start. The model calls thememory_readtool when background information is needed. Supports combining three retrieval methods:
-scope: limits the scope.
-topic: exact matches a topic.
-keywords: full-text keyword search (supports separation by spaces, commas, enumeration commas, and semicolons), returned in descending order of total score. -
L3 · Conditional reminder
Only when multiple non-memory files have been modified cumulatively without any memory write is a reminder injected, prompting the model that “it should have been recorded but has not been”.
Installation and Activation¶
The plugin is installed and activated through DSH’s plugin mechanism.
Note: The provided materials do not explicitly include a specific dsh plugin add command; it usually needs to be managed through the plugin directory or configuration files.
After activation, the plugin automatically generates memory files in the DSH workspace (such as MEMORY.md).
Typical Usage¶
- Saving memory
The model calls thememory_savetool to write content.
// 示例:写入一条关于缩进风格的项目记忆
{
"topic": "indent-style",
"content": "项目统一使用 2 空格缩进",
"mode": "update"
}
mode supports update (replacing an old entry) and append (supplementing information).
- Reading memory
The model calls thememory_readtool on demand.
// 示例:读取项目作用域下 topic 为 "indent-style" 的记忆
{
"scope": "project",
"topic": "indent-style"
}
- Management panel
In DSH’s settings panel, find the “Memory” navigation item to view memory usage, category distribution, the conflict list, and audit logs.
Applicable Scenarios and Notes¶
This plugin is suitable for workflows that require long-term maintenance of project context, preference settings, or technical conventions.
Notes:
- The plugin runs within the current DSH process and uses an in-process locking mechanism to serialize read and write operations, preventing file overwrites.
- Conflicts are frozen by default and require manual adjudication, preventing the model from being disrupted by contradictory information.
- The plugin is under the MIT license and can be freely used and modified.
Conclusion¶
dsh-memory solves DSH’s lack of persistent memory by using the local file system to implement zero additional cost cross-session memory. For more details, see:
- GitHub repository
- Skill directory page