viya-memory: A Local Long-Term Memory Plugin for DeepSeek Harness

Introduction

The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When developing agents or chatting with DSH, context windows are limited and long-term memory is essential. viya-memory is a DSH host plugin. It does not rely on an external database; instead, it materializes memory as Markdown files and stores them directly in your local Obsidian vault. This means the data is entirely yours and naturally supports Obsidian’s graph view, backlinks, and search.

Plugin Overview

viya-memory is a single-file, zero-build, zero-external-dependency plugin (it only relies on @deepseek-ai/schemastery, which ships with DSH). It provides seven tools that the model can invoke and persists cards as Markdown + YAML frontmatter + backlinks. The author is MengXinSu, and the license is MIT.

Installation and Activation

Run the following command in the terminal to install:

dsh plugin --profile <你的 profile 名> add github:MengXinSu/dsh-viya-memory

After installation, you must configure the library path; otherwise, the first tool call will fail. After changes to host plugins, restart DSH for them to take effect.

Configuration

Add the following configuration to DSH’s profile configuration file (usually cordis.patch.yml):

- id: viya-memory
  name: viya-memory
  config:
    # 必填:你的 Obsidian vault 绝对路径
    library: '/home/you/Obsidian/MyVault'      # Windows: 'D:\Obsidian\MyVault'
    # 可选:常驻 prompt 文件,默认回落到 <vault>/user.md
    userFile: ''
    # 正文软限(字),超了只提示
    softLimit: 1000
    # 正文硬限(字),超了报错
    hardLimit: 4000
    # 检索结果总字符预算
    searchBudget: 2000
    # 是否开启敏感扫描(默认 true)
    sensitiveScan: true

Core Capabilities

The plugin provides seven core tools covering memory creation, reading, updating, deletion, and relationship management:

  1. memory_save: Create a new memory card. If a card with the same name has highly overlapping content, skip it; otherwise, append an update. Local images in the body are automatically moved into the _assets/ directory.
  2. memory_search: Full-text search. Supports spaces/wildcards and returns the title, path, tags, and snippet.
  3. memory_read: Read the full text, status, update time, and reference relationships of a card.
  4. memory_update: Update the content, tags, status, and other fields of a specified card while preserving the created timestamp.
  5. memory_link: Establish a relationship between two cards (for example, causes, explains). Writes are bidirectional to ensure both cards contain the link.
  6. memory_forget: Delete a memory. This is a two-step operation: preview first (it is executed only with confirm: true). Supports soft deleting into _trashed/ or permanent deletion.
  7. memory_stats: Check the vault health status, including card count distribution, oversized cards, dead links, and duplicate-name cards.

Additionally, the plugin has the following features:
* Atomic writes: Uses a temporary file + rename mechanism to guarantee data consistency.
* No overwriting of manual edits: Compares the file’s mtime before writing to prevent stale content from overwriting manual changes.
* Automatic completion: Automatically adds aliases to cards so that [[card title]] resolves correctly in Obsidian.
* Security protection: Scans for secret patterns before writing (rejects if found) and rejects path traversal attacks.

Typical Usage

After configuring library, you can invoke these tools in DSH prompts or scripts.

1. Resident Prompt Setup
Create user.md in the vault root directory. The plugin injects its content at the end of the system prompt. This is suitable for low-frequency content such as names, taboos, and preferences.

2. Memory Storage and Search

- id: viya-memory
  config:
    library: '/path/to/vault'
  tools:
    # 保存一条新知识
    - memory_save(title: "DSH 插件开发规范", content: "必须配置 library 路径...", kind: "Knowledge")

    # 搜索相关记忆
    - memory_search(query: "DSH 配置", limit: 5)

3. Relation Management

    # 建立两张卡片的关联
    - memory_link(source: "DSH 插件开发规范", target: "viya-memory 插件", type: "part_of")

Notes

  • First-call errors: Ensure the library path is configured correctly; otherwise, the plugin cannot initialize.
  • Permissions and restart: The plugin runs with the permissions of the current DSH process. Restart DSH after configuration changes.
  • Limits: The body soft limit is 1000 characters and the hard limit is 4000 characters. The search budget defaults to 2000 characters.
  • Dependency: The plugin depends on DSH’s built-in @deepseek-ai/schemastery.

Conclusion

viya-memory converts AI short-term memory into durable local files. It is suitable for developers who need long-term knowledge accumulation and value data privacy and local control. All code is open source on GitHub. Feel free to check it out.

GitHub Repository

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

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

Xiaoye