Preface¶
In DeepSeek Harness (dsh), if cross-session information relies solely on the context window, it is easily lost once a new session starts: project preferences, historical lessons, user agreements, etc., need to be repeatedly explained. Existing approaches usually involve manually maintaining notes or repeatedly pasting background information in prompts; the former depends on manual organization, while the latter easily consumes a large number of tokens and interferes with caching.
DSH’s plugin ecosystem emphasizes extending capabilities through plugins. The community directory is an independent site, not the official DeepSeek / Huanfang app store. Below is an introduction to dsh-memory provided by Towzai: a cross-session memory plugin for dsh.
What is this¶
dsh-memory is a DeepSeek Harness plugin, MIT licensed, with the package name @towzai/dsh-memory and the repository Towzai/dsh-memory.
It solves the problem of discontinuous memory between dsh sessions: it writes memory to a YAML file, retrieves and injects it as needed in subsequent sessions, and preserves complete details for viewing.
The plugin defaults to using local ollama and embedding models; if ollama is not available, it degrades to pure keyword retrieval.
Core Features¶
- Provides six tools:
remember,recall,view,list,forget,pin. - Memory is stored in a YAML file, with the default file being
memory.yaml. recallsupports hybrid retrieval of keywords + localollamaembeddings, using RRF fusion.- The default embedding model is
qwen3-embedding:0.6b, which can be overridden via the environment variableDSH_MEMORY_EMBED_MODEL. - Titles are prioritized during injection: you first see the titles with
idin the session, and the full content is expanded viaview. - Supports two levels of injection:
sessionandauto.session-level fixed memories are injected once at the first step of the session and carried along with history thereafter;auto-level memories are retrieved by topic and do not pollute the fixed memory injection set. - Injected memories carry the source label prefix
Retrieved memories from the memory store (not conversation history)to avoid being mistaken for conversation history. - Retrieval matching includes general word downweighting, a keyword hit requirement of at least 2 words, and a retrieval gate to skip test sentences.
- Data safety features include a serial write queue, corrupted file isolation backup, atomic writes, and
mtimecache invalidation.
Installation and Enabling¶
First, install from GitHub:
dsh plugin --profile <name> add github:towzai/dsh-memory
You can also use a local path:
dsh plugin --profile <name> add ./dsh-memory
The README also lists the npm package method (if published):
dsh plugin --profile <name> add @towzai/dsh-memory
If prepare is rejected by pnpm during the first install from git, add the following to the profile’s pnpm-workspace.yaml as prompted:
allowBuilds:
'@towzai/dsh-memory': true
The plugin depends on a local ollama instance and an embedding model. The default model is qwen3-embedding:0.6b, which can be overridden by DSH_MEMORY_EMBED_MODEL. If ollama is not available, it automatically degrades to pure keyword retrieval.
Typical Usage¶
Below are the responsibilities of the tools provided by the plugin:
-
remember: Saves memory, with fields includingcontent,title,category,tags,importance,forceInject,injectLevel,source. -
recall: Hybrid retrieval of keywords + embeddings to get top-N results. -
view: Expands the full content of a memory byid. -
list: View a list of titles, supporting filtering by category, tags, and importance;fullallows viewing the full text. -
forget: Soft delete memory, marking it asretiredwhile preserving history. -
pin: TogglesforceInject, used to keep behavioral rules constantly resident.
The general structure of a memory looks like this:
- id: MEM-20260814-001
title: "Summary title (auto-derived if missing)"
content: "..."
category: preference | project | lesson | fact
tags: [tag1, tag2]
importance: high | normal | low
created: 2026-08-14
updated: 2026-08-14
source: user | agent | conversation
retired: false
forceInject: false
injectLevel: session | auto
vector: [...]
Here, vector is the embedding automatically calculated during writing, used for semantic retrieval.
Applicable Scenarios and Notes¶
Suitable for scenarios in dsh where user preferences, project agreements, historical lessons, or fixed behavioral rules need to be retained across sessions. If relying on local ollama semantic retrieval, ensure the local instance and model are available; if only keyword retrieval is needed, it can run without ollama.
It is recommended to check the source code and dependencies before use, as plugin code runs under the permissions of the current dsh process. The plugin is MIT licensed; code should be reviewed according to team standards before installation and distribution.
Notes:
- Memory files are private data; it is recommended to add them to
.gitignoreand do not commit them to the repository. - Switching the embedding model will invalidate stored vectors; dimension mismatches will be detected and alerted.
- The plugin was developed for dsh
v0.1.0-rc.5; thepeerDependenciesversion range may need adjustment as dsh upgrades. - The npm installation method depends on whether the package has been published; if using the npm method, please refer to the actual release status.
Conclusion¶
dsh-memory integrates “remember, retrieve, view, and manage” into dsh’s tool invocation chain, using YAML files to carry memory and using title prioritization and two-level injection to control context usage.
Directory Page:
- https://www.skillhub.cn/plugins/Towzai/dsh-memory
GitHub:
- https://github.com/Towzai/dsh-memory