Introduction¶
In DeepSeek Harness (DSH), when running Agents, the common practice is to rely on the context of the current session: closing the window or switching workspaces means preferences, agreements, and past pitfalls are no longer visible to the model. Stuffing the entire chat history into the prompt wastes tokens and is difficult to retrieve. The community has already adopted a method of creating independent Markdown files for memory and performing mixed retrieval. dsh-memtree, released by maintainer rj-yejianping and categorized as a “Memory” plugin, transplants QwenPaw’s Record -> Import -> Organize -> Connect -> Retrieve -> Expand cycle into a DSH Host plugin: Memory as File, File as Memory—core memory, daily notes, and organized knowledge are all ordinary .md files on disk, and the index is a rebuildable derived state.
The following section explains how to enable this tree in DSH based on positioning, mechanism, installation configuration, and daily usage.
Plugin Positioning¶
dsh-memtree (npm package name dsh-memtree, current version 0.18.4, MIT license) provides long-term memory for DSH: the Agent determines when to flush to disk during the conversation; overnight Auto Dream organizes changed daily notes into digest/; the retrieval side defaults to BM25, and after configuring Embedding, vector and RRF are superimposed, and Wikilink graph expansion is supported. Memory is stored in $DSH_HOME/long-term-memory/ (separated from the workspace), default divided into directories by Agent mode (perPreset: true), and does not create .dsh-memory/ in the project.
Directory Page: https://www.skillhub.cn/plugins/rj-yejianping/dsh-memtree
Source Code: https://github.com/rj-yejianping/dsh-memtree
File Layout and Memory Loop¶
Under the default root path, each enabled mode has its own tree, for example standard/, cordis/:
$DSH_HOME/long-term-memory/
├── standard/
│ ├── MEMORY.md # Small, stable core long-term memory
│ ├── memory/
│ │ ├── 2026-10-21.md # Daily index (containing notes:auto block)
│ │ └── 2026-10-21/主题笔记.md
│ ├── digest/
│ │ ├── personal/ # Identity, preferences, agreements
│ │ ├── procedure/ # Reusable procedures
│ │ └── wiki/ # Facts, principles, mental models
│ └── mem_metadata/ # Index, graph, Embedding cache, dream water level
Compared to QwenPaw, this plugin removes “automatically summarize every 5 user turns”: there is no separate summary model call; the Agent uses memory_write to write notes in the current turn. Auto Dream only processes changed daily notes, not rewriting the daily note body or MEMORY.md.
Long-term knowledge nodes have frontmatter and ## Sources, using Wikilink to point to source notes, for example:
---
name: 新能源汽车产业链
description: 跟踪整车需求、动力电池盈利与上游锂资源的传导关系。
kind: wiki
updated: 2026-10-21
---
# 新能源汽车产业链
需求从整车销量传导到动力电池排产,再影响正极材料和锂资源需求。
## Sources
- [[memory/2026-10-21/主题笔记.md]]
Core Capabilities¶
System Prompt and MEMORY.md Budget¶
The plugin injects a guidance section (file responsibilities, when to memory_search, how to use read to expand) and an optional full MEMORY.md (subject to byte limits) into the system prompt. MEMORY.md defaults to a limit of inject.memoryMdMaxBytes = 4096 bytes; memory_write / memory_edit will reject if it causes exceeding the budget, suggesting writing to memory/<date>/<topic>.md or simplifying first.
Tools and Commands¶
| Tool | Function |
|---|---|
memory_search |
Mixed retrieval of memory/ + digest/, returns path, line number, score, and link; if snippets are insufficient, use read to expand along the path |
memory_dream |
Organizes changed daily notes into digest/ (CREATE / CORROBORATE / REFINE / CORRECT); supports dryRun |
memory_status |
Reports root directory, file count, index snippets, vector status, last organization time |
memory_write |
Create / overwrite / append .md under allowed paths; rebuilds daily index and refreshes retrieval index after writing |
memory_edit |
Precisely replace a segment of text in a memory file (requires unique match) |
The /memory series commands can also be used in the session:
| Command | Function |
|---|---|
/memory / /memory status |
Memory layout and index status |
/memory search <keyword> |
Immediate retrieval |
/memory dream |
Immediate Auto Dream; supports --dry-run, --force |
write / edit in the workspace cannot rewrite the memory tree; memory_write / memory_edit are written by the Host side. Path whitelist includes MEMORY.md, memory/<date>/..., digest/<personal|procedure|wiki>/..., rejecting mem_metadata/ and paths outside the tree.
Retrieval and Auto Dream¶
- BM25 is always available; after configuring OpenAI-compatible Embedding, vector and RRF are enabled. Fallback to BM25 + Wikilink if Embedding fails, with no retrieval errors.
- Auto Dream defaults to organizing at 04:00 local time daily; can be triggered manually via
memory_dream,/memory dream, or configuringautoDream.intervalMinutes.
Panel (Client)¶
The plugin provides a Web client (client.js), which depends on @deepseek-ai/dsh-client-ui-primitives to render Markdown. The panel tabs include Overview, Auto Memory, Memory Organization, Components, Logs, Knowledge Base, Retrieval, and Settings; the Knowledge Base can be browsed by digest category and displays Wikilink associations. After modifying the client side, you need to restart dsh web and refresh the page.
Installation and Enablement¶
The plugin runs with background process permissions. It is recommended to check the source code and license (MIT) on GitHub before installing. The installation method given by SkillHub and README is:
dsh plugin --profile web add dsh-memtree
After installation, it is recommended to verify using a new session:
- Call
memory_status, you should see the root directory and file count. - Let the Agent remember a preference, then verify recall in a new session using
memory_searchor natural language questioning. - Execute
/memory dreamto confirm that daily notes can be organized intodigest/. - Open the panel in Settings -> Long-term Memory; if the client side was just installed, refresh the page.
Configuration Example¶
You can override the long-term-memory plugin configuration in the profile’s cordis.patch.yml, for example:
- id: long-term-memory
name: 'dsh-memtree'
config:
root: long-term-memory
language: zh
search:
maxResults: 8
embeddings:
enabled: true
baseURL: https://api.example.com/v1
apiKeyEnv: MY_EMBEDDING_KEY
model: text-embedding-3-small
Common fields (excerpt, full table in repository README):
| Field | Default Value | Meaning |
|---|---|---|
root |
long-term-memory |
Memory root directory; resolved relative to $DSH_HOME |
perPreset |
true |
Whether to create subdirectories under root by mode |
autoDream.dailyAt |
'04:00' |
Time of daily automatic organization |
inject.memoryMd |
true |
Whether to inject MEMORY.md |
inject.memoryMdMaxBytes |
4096 |
Byte limit for MEMORY.md injection |
inject.edit |
true |
Whether to expose memory_write / memory_edit to Agent |
The “Settings” panel is the preferred entry point for configuration; if Embedding is not configured, mixed retrieval still relies mainly on BM25 + Wikilink.
Typical Usage¶
Recording within conversation (no extra background model)
When the user says “remember” or relevant information worth keeping long-term appears, the Agent organizes key points in the current turn and calls memory_write to write to memory/<YYYY-MM-DD>/<topic>.md. The <!-- notes:auto --> block in the daily index page memory/<YYYY-MM-DD>.md is rebuilt by the plugin; handwritten diaries outside the block are preserved.
Cross-session recall
When involving the user’s past facts, preferences, or decisions, the system prompt guides to memory_search first; if the hit snippet is insufficient, use read to expand the full text along the returned path (relative to the memory tree root).
Nightly or manual organization
Default 04:00 Auto Dream scans for changed notes, performing CREATE / CORROBORATE / REFINE / CORRECT in digest/personal|procedure|wiki. To preview, use memory_dream with dryRun or /memory dream --dry-run.
Maintaining core memory
Only long-term effective agreements and boundaries fit in MEMORY.md; process details and troubleshooting logs should be written in daily topic notes or digest to avoid filling the 4KB budget.
Applicable Scenarios and Notes¶
Suitable for DSH users who need to share personal knowledge, procedures, and wiki-style facts across sessions and workspaces (same mode). Memory is isolated by Agent mode; standard and cordis use separate trees; when perPreset: false, all modes share the same root.
Notes when using:
- Multiple sessions in the same working directory share a memory; different working directories do not (consistent with QwenPaw workspace semantics).
- If not actively writing memory, there are no daily notes to organize, and the overnight dream may be skipped.
- Index is incrementally refreshed before retrieval; building the index for the first time has a one-time overhead if there are many files.
- Vector and Dream may call external APIs; you need to manage
apiKeyEnvand cost-related items (e.g.,autoDream.maxNotesPerRundefaults to 4) in the configuration.
Conclusion¶
dsh-memtree turns long-term memory into a readable Markdown tree, a mixed-retrievable index, and a configurable Auto Dream, allowing DSH Agents to have a knowledge base written by themselves and organized overnight outside the session. Installation and details follow the community directory and repository: