Introduction¶
The design philosophy of DeepSeek Harness emphasizes modularity and extensibility. When building agents with long-term memory, developers often face issues such as intrusive data persistence solutions, difficult knowledge graph maintenance, or low retrieval efficiency. dsh-memory-graph is a plugin built on DSH lifecycle extension points. It provides long-term memory and temporal knowledge graphs through a local SQLite database. It does not modify Harness source code, and uninstalling it removes all tools and UI components.
Plugin Positioning¶
This is a local-first, non-invasive long-term memory and knowledge graph plugin developed by zmh2000829 under the MIT license. It provides auditable and maintainable persistent storage for DSH agents and renders entity graphs in the DSH Web interface.
Core Capabilities¶
The plugin achieves stable memory and knowledge graph operation through the following mechanisms:
- Non-invasive design: It does not rely on Harness source code patches or forked agent loops. After uninstalling the plugin, its tools, listeners, routes, and UI contributions are automatically removed.
- Maintainable graph: It uses canonical names, conflict detection, entity merging/renaming, orphan node discovery, and reference-aware garbage collection to ensure the graph remains usable after long conversations.
- Chinese retrieval support: It uses FTS5 trigram indexes with a short-query fallback mechanism to handle continuous CJK text without relying on whitespace tokenization.
- Hybrid relevance recall: It combines lexical matching, graph proximity, importance, time decay, and explicit access reinforcement for ranking. Semantic recall (OpenAI-compatible embeddings) is disabled by default and available as an optional supplement.
- Per-turn control: The DSH Web interface provides “Default”, “Enable for this turn”, and “Disable for this turn” options, allowing memory strategies to be adjusted dynamically during a conversation. This setting only takes effect for the next turn.
- Fault handling and recovery: It supports recoverable source archiving (with context length limits) and persistent fault handling (if SQLite writes fail, they go to an offline mailbox and are replayed at startup).
Installation and Enablement¶
The current version is installed directly from a GitHub clone. Before installation, ensure the environment meets the Node.js version requirements (^22.19.0 or >=24.0.0).
- Clone the repository and install dependencies:
git clone https://github.com/zmh2000829/dsh-memory-graph.git
cd dsh-memory-graph
npm ci
npm run check
- Link the local checkout to the DSH configuration profile:
dsh plugin --profile web add "$PWD"
dsh web
- Open the DSH Web interface and expand Memory in the sidebar to view the dashboard and knowledge graph.
Usage and Maintenance¶
After installation, the plugin enables automatic recall, automatic turn summarization, and visualization by default. The knowledge graph view is based on a configuration-profile-scoped database rather than the current session, and can be used to inspect associations, duplicated entities, and incorrect relationships.
- Verify installation:
dsh plugin --profile web list dsh-memory-graph
- Upgrade: Because a local checkout link is used, upgrade by pulling the code and revalidating:
cd /path/to/dsh-memory-graph
git pull --ff-only
npm ci
npm run check
- Uninstall:
dsh plugin --profile web remove dsh-memory-graph
Note: Uninstalling only removes the configuration link and **does not** delete the local SQLite database or JSONL backup files.
Notes¶
- Environment dependencies: The plugin depends on the Node.js environment. Before installation, use
dsh --versionanddsh plugin --profile web listto confirm that the CLI and configuration profile are available. - Data security: Data is stored in a local private SQLite database. Ensure the DSH process has read and write permissions.
- Multi-session sharing: The knowledge graph dashboard in the Web interface is based on the global configuration profile database, and all sessions share the same data source. To isolate data, use a separate
pathconfiguration. - Version compatibility: Ensure you use Node.js
^22.19.0or>=24.0.0.