Introduction

The DeepSeek Harness (DSH) ecosystem contains about 65 memory plugins, most of which use single-tier storage. When you need to distinguish user, environment, and project contexts and control the memory footprint of each tier, these plugins cannot directly meet the requirement. The dsh-tiered-memory plugin introduces tiered storage and budget management, ported from the memory discipline of Hermes Agent, and is the first plugin in the DSH ecosystem to implement this concept.

Core Features

The plugin implements tiered management through the following capabilities:

  • mem_set: Writes stable facts. Parameters include tier (层级), key, and content. The same key performs an upsert. If the target tier is full, the write is rejected.
  • mem_get: Exact read by key value.
  • mem_query: Semantic query that automatically routes to the corresponding tier (user keywords -> user, environment keywords -> env, project keywords -> project). It returns only when records exist; on no match it returns [] and does not fabricate results.
  • tier_summary: Shows usage and eviction candidates for each tier (cold entries and old entries).
  • mem_delete: Explicit deletion. The model controls eviction, and deletion is not automatic.

Architecture and Logic

The plugin divides memory into three tiers: user, env, and project. Each tier independently manages its character budget. Content is declarative facts, with a default per-entry limit of 400.

When a tier reaches its write capacity, mem_set returns tier full — delete or merge first and blocks the write. Eviction candidates are listed via tier_summary and must be explicitly performed via mem_delete.

Installation and Enablement

In a DSH environment, install the plugin with the following command:

dsh plugin --profile web add "github:leetom314/dsh-tiered-memory#main"

Verification and Testing

The plugin provides a complete test and verification flow:
- Unit tests: Use node --test; line coverage for tiers.js reaches 98.5%.
- Real e2e: Isolated testing is performed via the verify.sh script, which dynamically generates overlay files and does not pollute real memory. Verification includes three-tier writes, correct cross-tier query routing, and closed-loop budget rejection.

Notes

  • This plugin is ported from the memory discipline of Hermes Agent.
  • It is recommended to review the source code and license (MIT) before first use.
  • The plugin runs with the permissions of the current DSH process.