During the development and debugging of DeepSeek Harness (DSH), agents often encounter recurring issues. Explaining the background from scratch every time is inefficient. We need a mechanism that allows the agent to remember problems, solutions, and script paths across sessions, thereby reducing duplicated work. dsh-self-memory is designed to address this issue by enabling structured recording and automatic retrieval, creating an offline, zero-dependency memory loop for experience.
Plugin Overview¶
dsh-self-memory is a DSH plugin maintained by cyanxi69-jpg. It structurally records problems encountered in a session, multiple solutions, script file paths, and the entire process of model calls. After a new session starts, the system automatically retrieves historical solutions and injects them into the context. Through the workflow of “search first, try, mark hit/fail, and write back,” it automatically consolidates and reuses experience.
Core Capabilities¶
- Structured Recording: Structurally stores problems, solutions, script paths, and the entire model-call process.
- Automatic Retrieval and Injection: Automatically retrieves historical solutions and injects them into the context in a new session, supporting hit and failure feedback.
- Zero Dependency and Offline: Runs purely locally, requires no external services, and is available offline.
- External Import: Supports importing existing solutions through interfaces.
- Premise-Aware Retrieval: Returns different solutions based on different preconditions.
- Generalization and Normalization: Automatically generates generalized questions to improve retrieval, and supports keyword normalization and synonym table management.
Installation and Activation¶
Installing the plugin requires adding the local directory to DSH’s plugin configuration.
dsh plugin --profile web add <本目录>
After installation, it can be enabled without restart via hot mounting:
dev_install_package {"dir": "<本目录>"}
After installation, you can verify the plugin status with the following command:
selfmem_status
If the code is updated, run the following command to reload it:
dev_reload_package dsh-self-memory
Typical Usage¶
1. Search Historical Solutions¶
When you need to look up historical experience, use selfmem_search.
selfmem_search {"query":"如何识图"}
2. Record a New Solution¶
When recording a problem, you can specify keyword weights, applicable preconditions, and solution content. For example, record an installation solution for when the network is unavailable:
selfmem_record {"problem":"断网时如何安装插件","solution":"解压本地包 → dsh plugin add <目录> → pnpm install → dev_install_package 热挂载","keywords":{"plugin":1,"network":0.6},"appliesTo":{"network":"no"}}
3. Mark Solution Results¶
After the agent has tried a historical solution, it can provide result feedback. If successful, mark it as a hit; if failed, record the root cause.
selfmem_hit {"query":"断网时如何安装插件","solutionId":"s-…"}
selfmem_fail {"query":"断网时如何安装插件","solutionId":"s-…","rootCause":"…"}
4. External Import¶
If you already have an existing knowledge base, you can import it using selfmem_import.
selfmem_import {"source":"examples/import-demo.json"}
Limitations and Notes¶
- Retrieval Method: Currently supports only keyword, generalized text, and inverted index retrieval; vector semantic retrieval is not yet supported.
- Data Extraction: Although session trajectories are automatically collected, they are not automatically refined into records. Manual invocation of an LLM is usually required for extraction.
- Storage Performance: Records are stored as JSON files. When the number of records reaches the ten-thousand scale, performance may be limited.
Summary¶
dsh-self-memory is a tool focused on localizing and structurally consolidating experience. Through simple command interactions, it helps DSH agents build their own knowledge base and reduces the cost of investigating recurring issues. Its open-source license is MIT, and the project page is available on GitHub.