Introduction¶
When developing agents in DeepSeek Harness (DSH), a common pain point is losing context after a session ends. The dsh-tool-memory plugin introduced below ports the Hermes Agent memory mechanism to the DSH platform and uses plain-text storage with snapshot injection to solve the problem of maintaining cross-session memory for agents.
What Is This¶
This is a memory plugin for DeepSeek Harness, maintained by sikwoxy. It provides bounded, plain-text, cross-session memory capabilities. Its core value is injecting long-term memory into the system prompt as a frozen snapshot, enabling the LLM to leverage historical information in new sessions.
Core Features¶
- Frozen Snapshot Injection: At the start of a session, the plugin injects memory into the system prompt as a snapshot, ensuring new sessions can read history.
- Six Tools: Provides the
memory_add,memory_replace,memory_remove,memory_batch,memory_show, andmemory_refreshtools. - Automated Background Consolidation: Every N user messages triggers an isolated sub-agent review to automatically consolidate information worth remembering long-term.
- Data Security Mechanisms: Includes lock files, atomic writes, drift protection (rejecting content that cannot be round-tripped), and threat scanning (blocking injection/jailbreak attacks and similar threats).
- File Support: Supports
MEMORY.md(agent notes) andUSER.md(user profile).
Installation and Activation¶
Run the following command inside the deepseek-harness environment to install it:
dsh plugin add dsh-tool-memory
Typical Usage¶
The plugin registers 3 system-prompt sections and 6 tools, which can be invoked directly using natural language.
Basic Operations:
1. Add a memory:
memory_add content='记住:这个项目的文档任务用反向工作流'
- Replace a memory:
memory_replace old_text='codex CLI' new_content='codex CLI v0.148'
- Remove a memory:
memory_remove old_text='临时备注'
- Refresh the snapshot (takes effect after manually editing the file):
memory_refresh
Configuration and Files:
The root path, character budget, and background review parameters can be configured in cordis.patch.yml at the profile or bundle layer. Memory files are located by default at $DSH_HOME/memories and formatted as a plain-text list of entries, with entries separated by \n§\n.
Use Cases and Notes¶
This plugin is suitable for DSH application scenarios that require maintaining contextual information over the long term. Before installing, review the source code and license.
- Prefix Cache Optimization: Write operations do not modify the system prompt from the start of the session (the frozen snapshot), preserving the LLM prefix cache.
- When It Takes Effect: After manually editing
MEMORY.md, you must callmemory_refreshfor the changes to take effect in the current session. - Version Dependency: Depends on DeepSeek Harness 4.0.1 and related toolkits.
Conclusion¶
By separating memory management from system prompting, this plugin simplifies state maintenance for agents. For more details, refer to the GitHub repository: https://github.com/sikwoxy/dsh-tool-memory