Introduction¶
In DSH plugin usage, a common problem with long-term memory is that retrieved memories are directly brought into the context, and the model might treat low-confidence, expired, or irrelevant memories as valid clues. dsh-memory-gate addresses the problem of “Retrieved ≠ Injected” by performing CBDC (Claim → Belief → Decision → Consumption) gating before memory enters the context, outputting interpretable use / verify / ignore decisions.
It is designed for DeepSeek Harness developers who need local long-term memory but want to control injection boundaries and retain an audit trail.
What is it¶
dsh-memory-gate is a community memory plugin for DeepSeek Harness, maintained by GIT121995, and licensed under MIT. It is not part of the official DeepSeek project.
The current version is 0.11.2, targeting Harness version 0.1.2-alpha.1, and is compatible with Harness versions 0.1.0-rc.6 and later; runtime requirements are Node.js >=22.5.
It saves memories as interpretable entries and performs authoritative gating before injection. It starts by default in assist mode, injecting at most 3 relevant memories of up to 1200 characters without requiring a second model call.
Core Features¶
Pre-injection Adjudication¶
Before each memory enters the context, the plugin executes CBDC gating:
Claim: Saved as a trackable memory entryBelief: Confidence is formed based on existing informationDecision: Outputsuse,verify, orignoreConsumption: Decides whether to enter the current model call context
This means memories are not “used just because they are retrieved,” but must first undergo adjudication.
Post-use Feedback¶
Feedback after use reversely updates memory quality:
helped: Improves memory usability and learns distinguishing terms from the current query into trigger wordsharmful: Lowers confidence and triggers isolationstale: Marks expiration risk and triggers isolation
Notably, helped feedback only saves distinguishing terms and does not save the original query text.
Near-duplicate Handling¶
When writing, if the term overlap between a new memory and an existing memory in the same scope reaches 60% or more, the old entry is automatically marked as superseded. This helps reduce the problem of similar expressions stacking up into multiple memories.
Scope and Storage¶
The plugin supports three scopes:
sessionworkspaceglobal
The workspace path only saves hash keys.
The storage layer uses local SQLite + FTS5, does not use embeddings, and does not depend on external memory APIs. API Key, Token, passwords, and content resembling private keys will be rejected before being written to the database.
If there is an anomaly with the database or policy, the plugin will not block the Agent, but will simply skip the current memory injection.
Runtime Modes¶
The plugin supports three runtime modes:
shadow: Audit only, no injection into the modelassist: Default mode, injects available memories and retains interpretable informationenforce: More strictly controls injected content
Installation¶
The installation command is as follows:
dsh plugin --profile web add dsh-memory-gate
After installation, it starts by default in assist mode. Memory data is saved by default in:
$DSH_HOME/memory/cbdc.sqlite
If the plugin is uninstalled later, the memory data will remain in that file; to clear it completely, simply delete the file.
Typical Usage¶
Below are common /memory commands:
/memory status
/memory list 10
/memory remember --kind preference 我偏好简洁中文回答
/memory remember --global --kind constraint 不要在回复中暴露凭据
/memory search 简洁中文
/memory explain mem_<uuid>
/memory feedback 1 helped
/memory ok
/memory mine 50
/memory consolidate
/memory forget mem_<uuid>
/memory mode assist
The functions of these commands can be understood as follows:
/memory status: View plugin status/memory list 10: View the last 10 memories/memory remember: Explicitly save a memory/memory search: Retrieve memories by terms/memory explain: View the decision basis for a specified memory/memory feedback: Provide feedback on the effectiveness of a memory/memory ok: Givehelpedfeedback for the most recently injected memory/memory mine: Mine actionable memory clues from historical sessions/memory consolidate: Consolidate near-duplicate memories/memory forget: Remove a specified memory/memory mode: Switch runtime mode
Suitable Scenarios and Notes¶
Suitable for the following scenarios:
- Saving stable preferences, constraints, and long-term information in DSH sessions
- Wanting interpretable adjudication before memory enters the context
- Wanting feedback to influence the confidence of subsequent memories
- Wanting local storage without introducing external memory APIs
Notes before use:
- This is a community plugin and is not part of the official DeepSeek project
- The plugin runs with the permissions of the current
dshprocess; check the source code and MIT license before installing - Synonym and trigger word recall is still lexical-level and is not equivalent to general semantic retrieval
- Traditional to Simplified character mapping covers common characters but does not guarantee coverage of all expressions
- Automatic extraction only identifies obvious expressions like “remember”, “later”, “I prefer”, “always”, and is conservative in nature
- Does not backfill historical sessions before installation, nor does it repeatedly save the full Harness transcript
- Node.js 22 prints an experimental warning for the built-in
node:sqlite, but this does not affect operation
Links¶
GitHub Repository:
https://github.com/GIT121995/dsh-memory-gate
The community directory is a separate site; specific entries are subject to the actual directory. You can search for dsh-memory-gate by name within the directory.