dsh-memory-layered: DSH Double-layer Bounded File Memory

Preface

When running long sessions in DeepSeek Harness (DSH), models often rely solely on the current context; after switching workspaces or starting new conversations, team conventions, project preferences, and unfinished conclusions are easily lost. Common workarounds include manual note-taking, modifying AGENTS.md, or relying on external vector databases—the former is high-maintenance, while the latter is disconnected from the DSH session chain. Here we introduce the community plugin dsh-memory-layered (npm package name @deepseek-ai/dsh-memory-layered): it persists a Global + Per-Project two-layer memory within the Harness using files, maintained by the model but intervenable by the user, complete with character budgets, version rollback, and TTL.

What is this

dsh-memory-layered is a “Memory” category plugin for DSH, maintained by pomelotea-yuzu (the package author field is yuzu-tea-duck). It writes entries injectable into the model into MEMORY.md under $DSH_HOME/memories/, storing metadata, archives, and version snapshots in separate files; for design details, see DESIGN.md in the repository.

The plugin reads and writes local files with the permissions of the current DSH process; please review the source code and license yourself before installing. SkillHub is a community plugin directory and has no official affiliation with DeepSeek / High-Flyer.

Core Features

Two-Layer Memory & Bounded Injection

  • global: Facts and conventions across projects.
  • project:: The current workspace, mapped to the DSH workspaceRegistry.

Each layer has an independent character budget (default global 2000 + project 2000). If the limit is exceeded, writes are rejected, and the model performs consolidation within the current turn (Hermes-style merge/trim); entries that still cannot fit after consolidation are appended to ARCHIVE.jsonl (searchable, not injected, not physically deleted).

Versioning, TTL, and User Intervention

  • A snapshot is taken before every write; /memory undo allows rollback.
  • Temporary facts can have a TTL set; they move to the archive upon expiration.
  • The model writes via the memory tool; you can use the /memory slash command or manually edit MEMORY.md (if external edits cannot round-trip, the write is rejected with a backup, known as drift detection).

Session Search & Web Memory Panel

  • memory search (and /memory search) can search injection layers, archives, and—if configuration permits—DSH session history (ctx.sessionQuery).
  • The Web chat page input box features a memory button; the pop-up displays both Global/Project layers and usage rates.

Session Handoff Summaries

Before switching from a long conversation, you can manually generate a summary in the “Handoff Summary” section of the memory pop-up: the host reads the last handoffTurns (default 20), calls the model via the session router to produce a structured handoff (Title + Goals/Conclusions sections, default total length ≤1500 characters), and writes it to each scope’s handoffs.jsonl without consuming the MEMORY.md budget. New sessions can automatically carry the latest handoff (project layer priority, global fallback), or you can use the manual “Carry” button to pre-fill the input box. Note: Snapshots and handoffs are frozen at the start of the session; you must generate the handoff in the old conversation before starting a new one for it to be automatically carried over.

Storage Layout

The memory root directory defaults to $DSH_HOME/memories/ (can be changed via dir configuration):

$DSH_HOME/memories/
├── global/
│   ├── MEMORY.md
│   ├── memory.meta.json
│   ├── ARCHIVE.jsonl
│   ├── handoffs.jsonl
│   └── versions/
└── projects/<workspace-uuid>/
    └── (same structure)

At the start of a session, a frozen snapshot is injected (a <system-reminder> block containing entries and usage rates for both layers); mid-session writes only modify disk files and do not change the current session’s snapshot prefix, facilitating whole-session KV cache validity.

Installation & Activation

Local link installation (README example path; replace with your local clone directory):

dsh plugin --profile web add "link:D:/dsh_plugin/dsh-memory-layered"

Or via npm:

dsh plugin --profile web add @deepseek-ai/dsh-memory-layered

After installation, restart dsh web and refresh the page; also check if node_modules/@deepseek-ai in the profile is a real directory (README references a note from the hyls9527 repository README). Node requirement: ^22.19 || >=24.

Configuration

Override by plugin id in the profile’s cordis.patch.yml:

- id: memory-layered
  config:
    globalCharLimit: 4000
    nudgeInterval: 0

Common fields (defaults according to README):

Field Default Meaning
memoryEnabled true Toggle switch
globalCharLimit 2000 Global layer character budget
projectCharLimit 2000 Project layer character budget
nudgeInterval 10 Reminder interval after how many turns without writing; 0 disables
versionsKeep 100 Number of version snapshots to keep
recallLimit 10 Default number of results returned by search
recallSessionHistory true Whether search includes session history
handoffEnabled true Handoff summary toggle
handoffCharLimit 1500 Max characters for handoff summary
handoffMaxKeep 10 Number of handoff entries to keep per scope
handoffTurns 20 Number of recent turns to extract when generating
handoffAutoCarry true Whether to automatically carry the latest handoff in new sessions

To make the session history part of memory search effective, if DSH’s session-query-sqlite defaults to openAt: never, it will silently downgrade; you can enable it in the profile patch:

- id: session-query-sqlite
  config:
    path: ':memory:'
    openAt: first-search

Typical Usage

Three Entry Points

Entry Point Who Action
memory tool Model add / replace / remove / batch / archive / search
/memory command You list / undo / drop / set-ttl / search (direct execution, does not go to model)
Manual MEMORY.md edit You Any edit; effective if it round-trips

/memory Commands

/memory list [global|project]
/memory undo [n]
/memory drop <id|substring>
/memory set-ttl <id|substring> <1d|7d|ISO date>
/memory search <query>

Saying “remember…” in the conversation can also trigger the model to call the memory tool. The write flow is: Budget check → Atomic disk write; if the limit is exceeded, consolidation happens in the current turn. If a single turn fails to consolidate more than 3 times, it forces a stop (ERR_CONSOLIDATION_LIMIT).

Use Cases & Notes

Suitable for: Developers who need to maintain “cross-project conventions + single repository context” long-term in DSH Web, want the model to autonomously organize memory, and want the ability to undo, set TTLs, search archives, and access session history.

Limitations (Known items from README):

  • Single directory, single process set; multiple agents requiring separate memories need multiple plugin lines with different dirs.
  • No prompt injection scanning; trusts local memory files (similar to trusting AGENTS.md).
  • nudge is based on turns, not wall-clock time.
  • Injection form is a persistent user message, not a system prompt segment (external plugins cannot register new event vocabularies).

For error codes such as ERR_OVER_BUDGET, ERR_DRIFT, ERR_UNREADABLE, etc., see the “Error Codes” table in the repository README.

Conclusion

dsh-memory-layered turns DSH memory into a two-layer, bounded, version-rollback-able file system, connecting to slash commands, search, Web panels, and session handoffs. It is suitable for persistent context featuring “model curation + human backstop” within the Harness ecosystem. For more details, see the SkillHub Directory Page and the GitHub Repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye