dsh-auto-memory: A Claude Code–Style Automatic Memory Plugin for DeepSeek Harness

Introduction

DeepSeek Harness (DSH) adopts the “everything is a plugin” philosophy, but its default configuration lacks a memory subsystem. The official recommendation is to implement memory functionality through third-party MCP configurations, but this typically requires manual injection and does not provide forgetting policies or cross-session persistence. Your Agent often resets with every new session.

dsh-auto-memory aims to fill this gap. It provides persistent memory capabilities similar to Claude Code, stored in pure file form without any external services or embedding models.

What is it

This is a typed memory file plugin maintained by AskTheWay. By automatically injecting an index file similar to MEMORY.md into the system prompt, it allows the Agent to retain information across sessions.

Core value: A zero-server, zero-embedding, zero-configuration file-level memory system.

Stats: 106 stars, MIT license.

Core features

  1. Automatic injection: The memory index is automatically injected into the system prompt for every request (position 4000). When memory is empty, the injected content is 0 bytes.
  2. Typed memory: Supports four types: user, feedback, project, and reference.
  3. Scope isolation: Provides two scopes, Workspace and User, to prevent information leakage across projects.
  4. Data safety: Supports cross-process locks and orphaned lock self-healing to prevent concurrent write crashes or data corruption caused by Ctrl+C.
  5. No external dependencies: Uses only pure Markdown files for storage, with no dependence on databases or Embedding services.
  6. Update-and-replace semantics: Merges updated facts instead of accumulating duplicate information.
  7. Fixed probe retention: When memory budget is constrained, the retention rate of fixed probes is ≥80%.

Installation and enablement

Before installing, ensure the environment meets the requirements: @deepseek-ai/dsh >= 0.1.5-rc.2, and Node.js version ^22.19 || >=24.

Use the official install command to add the plugin:

dsh plugin --profile demo add dsh-auto-memory

After adding it, enable it in the configuration file and adjust the parameters. Restart the corresponding Profile’s DSH process for the changes to take effect.

Typical usage

Remembering information in conversation

During a conversation, directly tell the Agent what information it needs to remember. The Agent will call the tool to write the memory and reference it in subsequent conversations.

Example instruction:

“Remember: I am a Python backend engineer preparing for job interviews.”

Then ask:

“What do you know about me?”

The Agent will call the memory_read tool and answer based on the memory index.

Using the demo script

The project includes a built-in demo script. You can observe the entire process of memory writing, index construction, injection, and recall without an API Key:

node scripts/demo.mjs

Configuration

The plugin supports overriding default configuration through cordis.patch.yml. The following are some key configuration items:

- id: auto-memory
  config:
    maxBytes: 4096          # 索引注入的字节预算(默认 4096)
    memoryDir: D:/memories  # 记忆文件存储目录(默认 $DSH_HOME/memory)
    enableUserScope: true   # 是否启用用户层作用域
    staleAfterDays: 0       # 超过 N 天未读的记忆是否软隐藏(0 为不隐藏)
    autoSummarize: false    # 是否在会话结束时自动合并记忆
    autoSummarizeMaxMemories: 5  # 自动合并时的最大条目数
    autoSummarizeMaxTokens: 2048 # 合并输出的 Token 上限

How it works

  • Write: The Agent calls the memory_write tool. Names are normalized to [a-z0-9-], and reserved names are rejected. The write process uses an atomic file lock and rebuilds the full index within the lock.
  • Injection: During system prompt assembly, the memory index is dynamically inserted (position 4000). The injected content is re-evaluated for every request and truncated according to the byte budget. If memory is empty, nothing is injected.
  • Audit: Custom session events are not used; all operations go through standard tool/call / tool/result interfaces.

Use cases and caveats

Use cases: Development workflows that require long-term project context maintenance, personal preference memory, and cross-session continuity.

Caveats:

  1. Version requirements: Must be used with @deepseek-ai/dsh >= 0.1.5-rc.2; it is recommended to verify it using official desktop client 0.2.0-rc.2.
  2. Truncation policy: The current memory truncation is based on index order (positional), not on relevance ranking. When there are many memory entries and the budget is approached, the retention rate decreases, but the fixed probe mechanism can ensure ≥80% retention of key information.
  3. File name conflicts: Reserved names are strictly blocked. For example, the file name memory conflicts with MEMORY.md on case-insensitive file systems, so the plugin rejects that write operation.
  4. Special character handling: {{ in memory content is escaped to prevent crashes caused by incorrect model parsing.
  5. Session restrictions: Custom session events are not allowed, as they may cause DSH session recovery failures.

Summary

dsh-auto-memory natively integrates memory capabilities into DeepSeek Harness’s prompt pipeline, implementing lightweight, typed, and secure persistent storage through the file system. It addresses the design deficiency of Agent “forgetfulness” and is suitable for developers who pursue engineered, auditable memory management.

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

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

Xiaoye