yansera/dsh-living-memoir Plugin Introduction

The DeepSeek Harness (DSH) ecosystem extends functionality through plugins. When building long-running agents, cross-session memory is a core pain point. Traditional memory solutions typically use an append-text approach, which easily leads to document bloat, semantic redundancy, and maintenance difficulties. yansera/dsh-living-memoir solves this problem by storing memory as a set of Markdown files and rewriting the entire memory after each conversation turn, rather than simply appending.

Core Positioning

This is a cross-session memory plugin maintained by developer Yansera and licensed under the MIT license. It does not rely on databases or proprietary formats; instead, it stores memory in local Markdown files, leveraging the host LLM’s capabilities for organization and rewriting.

Installation

Install the plugin using the DSH built-in CLI. Please replace --profile desktop with your actual profile name (e.g., web).

dsh plugin --profile desktop add @yansera/dsh-living-memoir

After installation, you must fully exit and reopen the client so that DSH can load the newly installed plugin code.

Basic Usage

Once installation is complete, a “Living Memoir” (记忆册) entry will appear in the sidebar. Clicking it will occupy the main area.

1. Memory Management

The left side contains categories, while the right side contains entries. The top-left “← Back to Chat” returns to the conversation.

  • Auto-recording: The model automatically calls the tool to write when it determines content in the conversation is worth recording.
  • Manual Entry: Click “Note one” (记一条), or edit the Markdown files directly in the $DSH_HOME/memoir/ directory.
  • Instant Effect: Changes are visible immediately after refreshing the page.
  • Stop Writing: Toggle off “Memory Write” (记忆写入) in the top-right settings; the plugin will no longer read or write.

2. Data Storage

All data is stored in the local directory $DSH_HOME/memoir. The plugin does not initiate any network requests; data remains fully localized.

Working Mechanism

Three-Layer Structure

The memory library adopts a three-layer structure to facilitate categorized management:

  1. Category Layer: One category corresponds to one .md file. Categories are divided by theme, not by information type (e.g., decision or progress).
  2. Section Layer: Usually, one project corresponds to one section.
  3. Entry Layer: One memory corresponds to one line of - content.

Auto-Rewriting

This is the plugin’s core feature. After each conversation turn (or 20 seconds of silence), the background takes “all content of the Living Memoir” plus “the current turn of dialogue” as input and asks the model to output a “rewritten complete Living Memoir.”

  • Foolproofing Mechanisms:
    • Cursors are saved per session; only new content after the last cursor is consumed to prevent repeated rewrites.
    • Failed rewrites are automatically retried.
    • Rewrites are skipped if new content is less than 400 characters, but the cursor advances normally.
    • Requests are queued during concurrent session wrap-ups.
    • Rewriting is rejected if categories cannot be parsed or the total number of entries drops by more than half.
  • Length Limits: Forced organization is triggered if a category exceeds 12 entries or the whole book exceeds 40 entries.

Metadata Annotation

Metadata in the form of HTML comments can be added at the end of each memory entry:

- User requires asking before all downloads and specifying how many GB
  <!-- memoir id=8daa8849 | imp=5 | conf=high | at=2026-10-09 | src=user explicit | pin -->
  • conf (Confidence): high (spoken by user), med (refined from conversation), low (inferred by model). Low-confidence entries are prioritized for deletion during rewriting.
  • pin (Pinned): Entries marked with pin must be preserved as-is during rewriting; keep a maximum of three to five pinned entries.

Configuration

Page Settings

In the top-right gear settings:
* Rewrite Model: Select from the list of registered LLMs on the host; no need to manually fill in Provider and Model ID.
* Reasoning Effort: Disabled by default. Rewriting is organization, not problem-solving; enabling reasoning models wastes output budget.
* Language: Interface language and memory content language can be set separately.

Deployment-Level Configuration

Configure in cordis.patch.yml in the project root directory:

- id: memoir
  name: '@yansera/dsh-living-memoir'
  config:
    memoryDir: ''              # Empty = $DSH_HOME/memoir
    injectIndex: true          # Whether to inject memory into system prompt
    maxInjectEntries: 12       # Maximum entries to inject
    autoDistill: true          # Enable auto-rewriting
    distillDebounceMs: 20000   # Wait time before rewriting (ms)
    distillMinChars: 400       # Minimum characters to skip rewriting
    distillMaxItems: 60        # Total book entry limit
    distillMaxTokens: 8000     # Output budget limit
    distillReasoningEffort: off # Disable reasoning
    memoryLanguage: ''         # Memory content language restriction
    pageEntryLimit: 12         # Entries per category to trigger organization
    bookEntryLimit: 40         # Total entries to trigger organization

Use Cases and Notes

  • Compatibility: Requires DSH >= 0.2.0-rc.2 and < 0.3.0, as well as Node.js >= 20.18.
  • Tool Invocation: The plugin provides three tool functions for the model to use: memoir_note (record), memoir_recall (query), memoir_forget (forget).
  • Plain Text Format: The memory library is plain text, can be opened with any editor, and supports version control.

Plugin Repository: https://github.com/Yansera/dsh-living-memoir

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

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

Xiaoye