dsh-user-memory: User-written Hierarchical Long-term Memory Injection into DSH System Prompts

Preface

In DeepSeek Harness (DSH), a common approach for long-term collaboration involves repeatedly pasting preferences, rules, or project background, or relying on notes outside the conversation. Such practices either consume context or cannot be consistently followed by the model. The community plugin dsh-user-memory (maintainer XinzeQing, GitHub XinzeQing/dsh-user-memory) injects user-authored hierarchical memory into a fixed section of the system prompt, and provides a Chinese GUI panel for viewing and editing; the AI does not write memory on its own — writes only occur after the user saves or explicitly asks the AI to modify files.

What Is This

dsh-user-memory is a host-type plugin for DSH: it participates in every conversation turn after the profile is loaded. It injects a system prompt segment between the Harness identity and the persona settings (order = -500), whose content is composed of several Markdown files under <DSH_HOME>/memory/; an optional second segment (order = -490) carries temporary memory, with its own budget separate from long-term memory. The plugin has zero dependencies and uses only Node built-in modules. The current package version is 0.7.2, licensed under MIT.

Core Features

Two-Layer Memory and File Layout

Long-term memory answers “who the user is and how the AI should act,” corresponding to the following directory structure (<DSH_HOME> defaults to %USERPROFILE%\.dsh):

<DSH_HOME>\memory\
├── rules-must.md      MUST follow (hard rules)   ← injected
├── agent.md           Behavior settings         ← injected
├── profile.md         User profile              ← injected
├── rules-should.md    SHOULD follow (optional)   ← injected
└── log.md             Change log                ← not injected

The injection order is: MUST follow → Behavior settings → User profile → Optional. <!-- --> comments are never injected; if a section has a title but no body, the entire section is omitted. The default total character budget maxChars is 6000; when memory remains unchanged, the system prompt is byte-for-byte identical, which benefits prompt caching.

Temporary memory (disabled by default, tempMemory: false) is stored in <DSH_HOME>\temp-memory.json, used for cross-conversation handoffs (handoff), stage goals (stage), and waiting items (waiting). The AI calls temp_memory only when the user explicitly requests a write; after archiving via temp_memory_done, injection stops. The default tempMaxChars is 1200, which does not compete with the long-term memory budget.

Read-Only at Runtime and Pending-Confirmation Gate

Except for user actions, the plugin is read-only at runtime: no automatic collection, automatic summarization, background writeback, or network access.

If the AI needs to propose a long-term memory change, it may only call memory_suggest (which does not write the memory file, but records a pending entry in <DSH_HOME>\memory-suggest.json). After the user clicks “Adopt” in the “Pending Confirmation” tab of the panel, the AI will receive the <MEMORY_SUGGESTION_ACCEPTED> notification in the next conversation turn, then finalize the wording, write the file, and call memory_suggest_done for bookkeeping. Clicking “Ignore” discards the proposal. Before adopting, the user may fill in “Supplementary notes” (up to 1000 characters); if they conflict with the AI’s original text, the supplementary notes take precedence.

Tool Purpose Writes memory file?
memory_suggest Propose an entry (limited to the five filenames above, body max 4000 chars) No
memory_suggest_done Record after processing completes No
temp_memory({kind,title,body}) Write a temporary memory entry Only writes temp-memory.json
temp_memory_done({id,note}) Archive temporary memory Same as above

GUI Panel

After restarting DSH, a “Long-term Memory” entry appears in the left sidebar. Tabs include: MUST follow / Behavior settings / User profile / Optional / Change log; when tempMemory: true is enabled, a Temporary memory tab appears additionally; Pending confirmation is always pinned last. After editing, clicking “Save this section” takes effect immediately without restart. A “Auto-capture memory” toggle at the top corresponds to autoCapture (see configuration below); the toggle writes to <DSH_HOME>\.autocapture, which takes priority over config.autoCapture in the profile.

Installation and Activation

The installation method described in the documentation is: in the profile’s package.json, use link: to point to the plugin directory (not a copy). After installation, the dependency resides at <DSH_HOME>/profiles/<profile>/node_modules/dsh-user-memory. Each profile must be installed separately.

// <DSH_HOME>/profiles/<profile>/package.json
"dsh-user-memory": "link:<plugin directory>"

Insert the plugin and configure it in the profile’s bundle patch (cordis.patch.yml):

- insert:
    - id: user-memory
      name: 'dsh-user-memory'
      config:
        enabled: true     # false = disable injection, do not uninstall
        dir: ''           # empty = <DSH_HOME>/memory
        maxChars: 6000    # total injection budget (including preamble and truncation notice)
        autoCapture: false  # true = enable "memory capture reminder"
        tempMemory: false   # true = add a "temporary memory" segment
        tempMaxChars: 1200  # budget only for the temporary memory segment

After modifying the patch, restart DSH for the changes to take effect in the composition; modifying only memory file contents does not require a restart.

Note: The config: block in the profile is replaced as a whole, not merged key by key. When overriding, you must write all of enabled / dir / maxChars / autoCapture / tempMemory / tempMaxChars at once; otherwise, unspecified keys will fall back to built-in defaults.

Typical Usage

  1. Direct editing: Modify files under memory/ via the panel or a text editor; after saving, the next conversation turn will include the new content.
  2. Verbally asking the AI to remember: When the user says “remember…”, the AI should first show a diff, then write to disk after the user confirms.
  3. Batch organization: When the user says “organize memory”, the AI aggregates and likewise reviews before writing.
  4. Temporary memory: The AI only calls temp_memory when the user expresses intents such as “write temporary memory / note it in temporary memory / handoff memory / switch session to execute / continue in the next conversation”; upon completion, temp_memory_done archives it.
  5. Optional suggestion flow: When autoCapture is set to true (or the panel toggle is enabled), a fixed “memory capture reminder” is appended at the end of the injected segment, reminding the AI to propose suggestions via memory_suggest at appropriate times; writes still require user adoption.

Use Cases and Caveats

Suitable for: DSH users who want preferences, hard rules, user profiles, and Agent behavior settings to stably appear in the system prompt of every turn, with write authority entirely retained by the user; those who need cross-session handoff documents or stage-wise to-do items without long-term pollution of main memory can enable tempMemory.

Important to note:

  • The plugin runs under the permissions of the current DSH process; before installation, you should review the GitHub source code and MIT license yourself, and only link it into your profile after confirming acceptance.
  • “MUST follow” constrains the model only through prompt positioning and wording — it is not a technical guarantee; rules should be specific, verifiable, and as concise as possible.
  • After modifying the plugin’s index.js or client.js, you must restart the App; modifying memory files does not require a restart.
  • Uninstalling the bundle does not delete <DSH_HOME>\memory\; data and code are separated.
  • The community directory SkillHub plugin page has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem philosophy is “everything is a plugin”, and the facts in this article are based on the repository README and package.

Conclusion

dsh-user-memory turns long-term memory into a system prompt section that is user-editable, budgeted, and cacheable, and separates AI proposals from actual writes via a pending-confirmation area; temporary memory optionally handles cross-conversation working sets. For further details on implementation and self-testing commands, refer to the GitHub repository README.

  • Directory page: https://www.skillhub.cn/plugins/XinzeQing/dsh-user-memory
  • GitHub: https://github.com/XinzeQing/dsh-user-memory
羽毛球分组比赛记分
小程序二维码

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

Xiaoye