Introduction¶
There is a specific pain point in DSH (DeepSeek Harness) agent development: the context is cleared after a session ends, and facts previously confirmed, task experience, and environment information will not be automatically retained. dsh-layered-memory is a cross-session long-term memory plugin for DeepSeek Harness (DSH). It writes information worth keeping to files on the disk and retrieves them on demand in subsequent sessions.
What is this¶
The plugin is positioned as a memory plugin for DSH. The repository address is https://github.com/DDDFXYqiming/dsh-layered-memory and it is licensed under MIT.
It provides services around the following capabilities:
- Cross-session long-term memory
- Namespace isolation
- L1 index injection
- L2 environment facts
- L3 task experience
- BM25 full-text search
- Content-level near-duplicate deduplication
- Cross-namespace promotion
- Retry sequence distillation
- Provenance
- Archiving and rollback
- Automatic maintenance
- Progressive tool exposure
The plugin provides a total of 14 memory tools. It runs as a DSH plugin, executing with the permissions of the current dsh process. Before installing, you should check the source code and the license.
Core Capabilities¶
First, let’s look at the tool exposure method. In progressive mode, the Agent calls memory_activate once on demand before these tools enter its tool list.
Below are a few key tools introduced based on verified usage paths:
-
memory_write
Writes fact/sop;evidenceis mandatory. This plugin requires writing only successfully verified information. -
memory_search
Uses BM25 full-text search and includes archived entries. When cross-database search is needed, you can useall_namespaces. -
memory_index
Rebuilds the L1 index automatic segment and retains the[RULES]manual segment. -
memory_promote
Used for cross-namespace promotion, for example, promoting project-local experience to the global default. -
memory_update
Used for the evolution of memories on the same topic. The system does not perform automatic contradiction detection; consistency relies on deduplication,memory_update,memory_maintainmerging candidates, and timeline arbitration. -
memory_maintain
Used for merging candidates and consistency handling during maintenance.
At the write boundary, verified facts can be compressed, migrated, superseded, or archived, but physical discarding is strictly prohibited. The plugin also does not store volatile states such as timestamps, PIDs, or temporary paths.
Installation¶
First, confirm the runtime environment:
Node >=22.19
peerDependencies require @deepseek-ai/cordis >=4.0.0-rc <5 and multiple @deepseek-ai packages
Install from GitHub:
dsh plugin --profile web add github:DDDFXYqiming/dsh-layered-memory
For local development, you can also use the repository directory directly:
dsh plugin --profile web add <this-directory>
Typical Usage¶
The following is a set of reproducible call sequences:
-
If the plugin is in progressive mode, let the Agent call
memory_activatefirst so that this batch of memory tools enters its tool list. -
When memory writing is needed, call
memory_writeto write fact/sop.evidenceis mandatory, and only successfully verified information should be written. -
When searching for memory is needed, call
memory_searchfor BM25 full-text search. The search scope includes archived entries; when cross-namespace search is needed, useall_namespaces. -
When the L1 index needs to be rebuilt, call
memory_index. This operation will rebuild the L1 index automatic segment and retain the[RULES]manual segment. -
When some experience rises from project-local to globally available, call
memory_promoteto promote the project-local experience to the global default.
Development and Testing¶
The development environment can use the following commands:
pnpm test
pnpm test:smoke
Unit tests will import @deepseek-ai/dsh-tools / @deepseek-ai/schemastery, which are built-in packages for DSH.
In the pnpm 11 pre-check environment, it may report ERR_PNPM_FETCH_404 due to DSH private packages. The repository suggests/configured verifyDepsBeforeRun: false.
Use Cases and Notes¶
This plugin is suitable for DSH agent scenarios that need to retain verified facts, task experience, and environment information across sessions, especially for usage that isolates memories for different projects or workspaces by namespace.
Note a few points before using:
- The plugin runs with the permissions of the current dsh process; before installing, check the source code and the MIT license.
- The
evidenceformemory_writeis mandatory; only write successfully verified information. - Does not save volatile states such as timestamps, PIDs, or temporary paths.
- The system does not perform automatic contradiction detection; consistency relies on deduplication,
memory_update,memory_maintainmerging candidates, and timeline arbitration. - Verified facts can be compressed, migrated, superseded, or archived, but should not be physically discarded.
Conclusion¶
The value of dsh-layered-memory lies in condensing verified information in DSH sessions into cross-session memory that is searchable, evolvable, and isolated. The philosophy of the DSH ecosystem is “everything is a plugin.” The community directory is an independent site and has no official affiliation with DeepSeek / Huafang; it should not be written as an official app store.
Repository URL: https://github.com/DDDFXYqiming/dsh-layered-memory.