dsh-simple-memory: Connecting Markdown memory directory to DSH

Introduction

When running agents in DSH, project conventions, user preferences, and pitfalls encountered are often scattered across conversations, requiring re-explanation in every new round. Some users maintain Markdown memories themselves using Obsidian or a .memory directory within their projects. However, the host does not automatically know “which files to read” or “when to remind the model to read supplementary materials.” The following is an introduction to dsh-simple-memory (Category: Memory) by maintainer liu-zhengdong: it connects your existing Markdown memory directory to DSH in a read-only manner, keeps an index resident in the runtime context every round, and allows the model to read the full text on demand. The plugin does not write to disk or modify your files.

What is this?

dsh-simple-memory connects your own maintained Markdown memory directory (Obsidian vaults, .memory project memories, etc.) to the DeepSeek Harness. The behavioral contract is ported from pi-memory (preserving the meaning of frontmatter, byte-based budgets, exclusion of entire sources, literal keyword reminders, etc.), while the injection mechanism is rewritten according to the DSH plugin interface. The current repository version is 0.2.0, licensed under MIT; the package declaration is compatible with DSH 0.2.0-rc.2. Community directory page: skillhub.cn/plugins/liu-zhengdong/dsh-simple-memory; Source code: github.com/liu-zhengdong/dsh-simple-memory.

Core Features

Index Injection

Top-level entries from the memory root are injected into the runtime context: each entry provides a name and the description from its frontmatter; the repository root path is written only once in the “Memory Repository” section, and subfolders are listed by name only. Entries with defaultopen: true include the full text, while others provide only a summary; deeper levels are not injected into the context by default. Rendered text is not injected redundantly if it matches the previous snapshot; the injection is resent only when memories are modified, the working directory changes, or the plugin is upgraded.

Repository Contract and Write Reminders

Each source section begins with a “Memory Repository” description: absolute paths, what conclusions are worth writing, how to write them, and the function of each frontmatter field; this is provided even if the directory is empty, helping the model know where to write the first entry. This text does not occupy YAML configuration; changing the wording requires modifying src/memory.ts.

At the first step of every round, a user snapshot is appended to remind the model to proactively write long-term conclusions into the memory repository, listing the absolute paths of each repository; this is not repeated in subsequent steps of the same round. This can be disabled via the configuration proactive: false.

Keyword Reminders and On-demand Reading

When literal phrases in keywords within the frontmatter match user input or model text, a user snapshot is appended at the current step providing the path, allowing the model to read the full text itself; the same memory is reminded only once per round. The plugin does not parse or validate [[paths]] in the index body; the decision to read them is judged by the model.

Read-only and Security Boundary

The plugin does not write to the memory directory or configuration files; cache exists only in memory. Project memories share the same trust boundary as AGENTS.md, requiring no separate “trust project” action like in pi-memory.

Differences from pi-memory (Brief)

pi-memory dsh-simple-memory
Index Injection Tail of Pi system prompt simple-memory section in DSH runtime-context snapshot
Keyword Reminders Tail of system prompt (next round) User snapshot appended via agent/pre-step (effective at current step)
Configuration memory.json in agent directory cordis.patch.yml in profile
Commands /memory set, /memory clear write config Read-only; config via YAML or desktop form

Installation and Activation

The plugin runs with the permissions of the current DSH process; it is recommended to read the repository source code and MIT license before installation. This package is not published to npm, so add dsh-simple-memory will fail; please use GitHub or a local path.

# From GitHub
dsh plugin --profile <profile> add github:liu-zhengdong/dsh-simple-memory

# Local checkout (for development)
dsh plugin --profile <profile> add /abs/path/to/dsh-simple-memory

The package declares dsh.bundle.patch; after adding, the package name will be appended to the profile’s dsh.profile.bundles. You can verify if the configuration is mounted:

dsh --profile <profile> --dump-config | grep -B2 -A6 dsh-simple-memory

Configuration

Configuration is written in the profile’s cordis.patch.yml. The patch replaces the entire config block without deep merging; please write all fields when overriding:

Field Default Description
directory "" Global memory directory, absolute path or starting with ~; empty means no global source
projectSources true Discover .memory layer by layer from the working directory up to the git root
reminders true Remind when keywords match user input or model text
proactive true Remind once per round: write long-term conclusions into the memory repository
maxContextBytes 262144 Upper limit for single memory text injection (UTF-8 bytes, 1 KiB–16 MiB)

Example:

- id: simple-memory
  config:
    directory: ~/Obsidian/Memory
    projectSources: true
    reminders: true
    proactive: true
    maxContextBytes: 262144

Changing the configuration triggers a hot replacement of the plugin; generally, no DSH restart is needed. On the desktop client, you can edit the five fields above in Settings → Plugins → Memory, the plugin page dsh-simple-memory configuration area, or the “Configure” button on the right side of the plugin list; directory supports “Select Directory…”. Saving writes to the same profile’s cordis.patch.yml.

Memory File Format

Only .md files are included; files starting with . and symbolic links are skipped. Each source level scans only direct children of the root directory; subfolders are listed as entries.

---
description: Choice of interface fonts; read before starting layout-related tasks (Indexed)
defaultopen: true          # Optional: Full text enters default context (prompted to split if over 8 KiB)
keywords:                  # Optional: Literal phrases; reminds upon match
  - font
  - font stack
---

Body text...

Parsing failures, frontmatter overflow, or source budget exceedances will be explained in the /memory output; they will not be silently truncated. Entire sources exceeding the budget will be excluded.

Commands

Available in hosts with a command interface (headless mode has no command interface):

Command Function
/memory Directory, source count, injected KiB, indexed entries, non-injected sources, and reminders
/memory preview Text injected in this round (index) and non-injected sources
/memory help Usage

Commands are read-only; for configuration changes, use the desktop client or YAML.

Use Cases and Notes

Suitable for: Developers who already have Obsidian or .memory habits, want DSH to automatically carry a memory index every round, and do not want the plugin to modify files.

Limits (Excerpt): Default single injection limit is 256 KiB (configurable); single frontmatter limit is 64 KiB; defaultopen full text exceeding 8 KiB is still injected but prompts for splitting; keyword index limit is 16 MiB / 100,000 entries.

Known Limitations:

  • Read-only, no write-back: Does not organize memories for you, nor automatically extract from conversations.
  • keywords is literal substring matching (case-insensitive for English, exact for Chinese), not semantic retrieval.
  • During DSH assembly, variable interpolation is performed on {{name}}; {{ in index text will be rewritten to avoid errors in the whole round caused by unregistered variables.
  • Injected index text enters the model context; please be mindful of whether the memory directory contains sensitive paths or content.

Conclusion

dsh-simple-memory connects Markdown memory directories to DSH in a read-only manner: resident index, on-demand full text reading, keyword and current-round write reminders, with configuration residing in the profile’s cordis.patch.yml. The DeepSeek Harness ecosystem emphasizes “Everything is a plugin”; the community directory skillhub.cn has no official affiliation with DeepSeek or Hunyuan. For further details and example directories, see GitHub: github.com/liu-zhengdong/dsh-simple-memory.

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

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

Xiaoye