Introduction¶
The DeepSeek Harness (DSH) ecosystem emphasizes plugin-based extensibility. A common pain point when building agents is that models gradually lose context across multi-turn conversations or sessions. dsh-layered-memory addresses this issue by introducing a layered long-term memory mechanism, helping agents maintain continuity and personalization across sessions.
Plugin Overview¶
This is a static bundle plugin maintained by Olalaye. After it is installed with the dsh plugin command, it is automatically loaded when Harness starts. It requires zero configuration after installation, and the model automatically gains memory management capabilities. The core value of the plugin is to divide memory into a three-layer structure and use AI to automatically refine and deduplicate it.
Core Architecture¶
The plugin divides memory into three layers, each with independent storage and capacity limits.
- Transient: stores the key points of the current session. It automatically captures user messages via the
agent/pre-stepevent hook, without requiring model intervention. - Episodic: stores the summary of each session. At task completion or when the user says goodbye, it is committed through
memory_commit, automatically preserving the session record. - Semantic: stores long-term facts, preferences, and habits. It is automatically refined by the model and supports precise cross-session recall.
Data is persisted under the ~/.dsh-memory/ directory as JSON files.
Installation and Activation¶
Install it through the DSH plugin manager. No build step is required.
dsh plugin --profile demo add github:Olalaye/dsh-layered-memory
After installation is complete, the model automatically gains four tool functions and a set of system prompts, and can be used without additional configuration.
Model Tools¶
The plugin registers four tools for the model, which can be invoked using natural language.
- memory_recall: retrieves relevant history across layers. It should be prioritized when the user mentions “earlier”, “last time”, or “do you remember”.
- memory_remember: writes semantic facts or transient notes. It is suitable for long-term preferences or habits that the user expresses explicitly.
- memory_commit: commits the current session summary. It preserves episodic records in the episodic layer and distills facts into the semantic layer.
- memory_stats: views the entry counts and storage locations of each layer.
Typical Usage¶
Memory operations can be triggered directly by using natural language in the conversation:
- “Remember: I prefer tables when reporting”
- “From now on, write all documents in Chinese and use ## for level-two headings”
- “What was the conclusion of the X project we discussed last time?”
- “Record this session”
- “Check what I said last time about the Y requirement”
- “Forget the thing I mentioned earlier”
Management Interface¶
This plugin does not provide a React settings page; instead, it provides management capabilities through an HTTP API. The web service listens only on 127.0.0.1 by default.
Management API routes:
- GET
/api/memory/stats: counts entries in each layer. - GET
/api/memory/list: lists memory entries. - GET
/api/memory/search: performs full-text search. - POST
/api/memory/add: manually adds an entry. - POST
/api/memory/update: edits an entry. - POST
/api/memory/remove: deletes an entry. - POST
/api/memory/clear: clears memory.
Sensitive operations such as deletion and clearing must be performed through the HTTP API.
Considerations¶
- Data privacy: Memory data is stored under the user directory (
~/.dsh-memory/). It is personal privacy data and is not part of the repository content. - Deletion limitations: The model tools do not currently provide a deletion entry; deletion or clearing can only be performed through the HTTP API.
- Session counting: After the process is restarted, the session counter is reset, but persisted historical data is not lost.
- Loopback listening: The web service listens only on the local loopback address and is not exposed externally.
References¶
- GitHub repository: Olalaye/dsh-layered-memory
- Community directory: SkillHub