Introduction¶
DeepSeek Harness (DSH) uses a plugin-based architecture. When handling long-running tasks, conversational context can easily be lost, causing the model to repeatedly explain background information and forget previous decisions. dsh-plugin-memory is designed to solve this problem. It enables the conversational model to “remember as it works” during task execution, persisting information worth retaining long-term into Markdown files and automatically injecting it into new sessions. This plugin is maintained by justhalfbit and follows the MIT License.
Installation and Activation¶
Before installing, make sure DSH 0.1.2 or later is installed and that pnpm is available in your system PATH.
- Use the official installation command:
dsh plugin --profile web add github:justhalfbit/dsh-plugin-memory
Restart `dsh web` for the changes to take effect.
- Memory data is stored by default in the
~/.dsh/memorydirectory. When uninstalling, the plugin preserves data under this directory; delete it manually if you want to clean it up.
Core Features¶
This plugin provides the following capabilities:
- Two-tier memory structure: A main memory file (stores Facts, Decisions, Lessons, and Preferences) and topic files (store in-depth notes).
- Model remembers as it works: Supports three proactivity levels (Conservative / Balanced / Proactive), and the model can proactively invoke tools to save information.
- Background silent distillation: Optionally silently extracts memories after a conversation ends, without generating tool cards. Suitable for unattended long-running tasks.
- Project isolation: Uses the working directory as the granularity unit and encodes directory names with hashes to prevent conflicts.
- Pure Markdown storage: Data is readable, hand-editable, and can be included in version control.
- Settings panel: Supports configuration via browser UI cards and
settings.yaml, with hot updates fully supported. - Comprehensive guardrails: Includes mechanisms such as de-duplication by content hash, entry count limits, and pruning order (manually added entries are evicted last).
Storage Structure and Injection Mechanism¶
Memory files are stored under the ~/.dsh/memory/projects/ directory. Each project corresponds to a subdirectory named by a path hash, containing:
memories.md: The main memory file, storing categorized entries.topics/*.md: Topic files, storing in-depth notes.
The injection mechanism uses progressive disclosure:
1. Main memory: Injected in full into the system prompt, subject to a character budget limit.
2. Topic index: Only file names and summaries are injected; the full text is loaded on demand.
3. Deduplication: Based on the SHA-1 of the rendered body to prevent duplicate injection and improve KV Cache efficiency.
Tools and Configuration¶
The plugin provides 7 core tools:
memory_save: Save an item.memory_search: Keyword search.memory_forget: Delete an item.memory_read: Read a topic file.memory_write_topic: Create or overwrite a topic file.memory_delete_topic: Delete a topic file.memory_list: List all items and topics.
Configuration items support hot updates and can be configured via the browser interface or the memory section in ~/.dsh/settings.yaml. Main fields include:
enabled: Master switch.proactivity: Proactivity level.autoDistill: Whether to enable background distillation.injectBudgetChars: Character budget for injected prompts.distillMinChars: Minimum character count to trigger distillation.cooldownTurns: Number of distillation cooldown turns.maxEntriesPerCategory: Maximum number of entries per category.
Notes¶
When using this plugin, note the following limitations:
- Concurrent writes: Concurrent cross-process writes to the same project use a “last writer wins” weak guarantee; writes within a process are strictly serialized.
- Session isolation: Memories are shared per project and are not isolated by session. Any session of the same project can rewrite entries from other sessions.
- Distillation permissions: Automatic distillation can only add entries and rewrite/delete
autoentries it created; it cannot rewritemanualentries. - Error handling: Distillation failures in a given window are not retried. This is an intentional cost-control strategy.