Preface¶
Running agents in DeepSeek Harness (DSH), no matter how long the context window, you will encounter the same class of problems: switching sessions, restarting processes, or running multiple subagents in parallel, previously agreed preferences, project background, and conversation conclusions are hard to carry over reliably. Stuffing the entire history into the prompt is costly and not good for retrieval either. The community already has the idea of an external memory vault; dsh-memory-vault stores memories in a local SQLite database and lets the model add, delete, modify, and query them in conversation via tools. This article introduces the fix fork on GitHub maintained by xs1023 (xs1023/dsh-memory-vault), which fixes several defects that could corrupt data or render the long-term layer ineffective while preserving data-format compatibility with the original project, and adds “project-dimension” retrieval. The plugin is categorized as “Memory” in the SkillHub directory; the directory is an independent community site with no official affiliation with DeepSeek / High-Flyer.
What Is This¶
dsh-memory-vault is an external memory vault plugin for DSH: data is stored in ~/.dsh/memory/memory.db (a single database shared across sessions and agents), and the host registers a set of memory_* tools that the model calls when needed. This repository declares itself a fix fork of hjj588/dsh-memory-vault; existing memory data requires no migration — just replace and install. The npm package with the same name is maintained by another maintainer and is an independent implementation from this repository. The current package version is 0.3.0, license MIT, requires Node ≥ 22.18 (uses the built-in node:sqlite, with zero additional npm runtime dependencies).
What the Fork Changes Compared to the Original¶
The four issues below have corresponding regression tests in the README (21 cases in total, all passing with npm test), and are the main reasons to choose this fork:
| Issue | Actual Symptoms | Fix Highlights |
|---|---|---|
| Conversation-record upsert was not isolated by category | Conversation rows accumulated duplicates in the same session; medium/long-term rows written by hierarchical compression were rewritten as “conversation records” | Add a category condition to findEntryBySessionId |
| Titles were taken from unfiltered message streams | Titles were polluted by host-injected content such as runtime context and preset memories | User-side messages changed to a whitelist of human sources; injections no longer enter body text or titles |
| Two-level thresholds were unreachable after hierarchical compression | The medium- and short-term caps were both 20, so the long-term layer almost never triggered | Medium/long-term caps and compression counts reduced (see default values below) |
| Preset memory injection was not idempotent | The same presets were re-injected on restart or session recovery | In-process flag + history probing; injected only once per session |
Core Features¶
Memory Operations and Conversation Archiving¶
- Add, view, modify, delete, and search memories; archive and restore; categories, tags, and statistics.
- Each complete conversation can be automatically saved as a “conversation record” (only user and assistant text, no tool details), with support for dedicated search of historical conversations (
memory_search_history,memory_list_conversations, etc.).
Hierarchical Memory¶
The short-term layer keeps recent raw messages; when full, they are folded into a medium-term summary, then folded into a long-term summary. There is also a “permanent” layer bound to the current session; important content can be promoted to permanent; when the long-term layer is full, it first absorbs important content and then discards the oldest entries. Default thresholds (they are interrelated; do not casually adjust the medium-term limit to be close to the short-term one, otherwise the long-term layer will again be unreachable):
- Short-term: the most recent 20 messages, folding the earliest 10 each time.
- Medium-term: up to 4 summaries, folding 3 each time.
- Long-term: up to 4 summaries.
The global “presets / user memories” are stored separately and automatically included at the start of a conversation (injected only once per session).
Project Dimension (New in This Fork)¶
When writing, the workspace path at session creation time (session.header.cwd) is normalized and written to entries.workspace_id. The default retrieval is “current project + global” (entries with workspace_id IS NULL are global, including all legacy data from before the upgrade). Tri-state scope:
current(default): current project + global.global: global only.all: all projects.
If the cwd cannot be obtained, it falls back to a full-database search; an unrecognized scope is treated as current. memory_add can specify scope as current or global when writing; list and search tools support current / global / all. memory_show and list output display project ownership.
Installation and Activation¶
The plugin runs with the permissions of the current dsh process. Before installing, it is recommended to read the repository source code and LICENSE.
Install from GitHub (Recommended)¶
Replace web with the profile you actually use (e.g., web-desktop):
dsh plugin --profile web add github:xs1023/dsh-memory-vault
After installation, restart dsh for it to take effect. You can confirm in “Settings → Plugins → Manage” that dsh-memory-vault has been loaded.
Install from Local Source¶
dsh plugin --profile web add /absolute-path-to-this-repo/dsh-memory-vault
For development, link to the source directory; after changing code, restart to take effect. If installed from GitHub, you need to re-run add and restart to pull the new copy.
Typical Usage¶
The tools injected by the plugin include: memory_add, memory_list, memory_search, memory_show, memory_update, memory_archive, memory_restore, memory_delete, memory_categories, memory_stats, memory_rename_category, memory_search_history, memory_list_conversations, memory_list_permanent, memory_promote_permanent, memory_add_preset, memory_list_preset, memory_promote_preset.
Day-to-day usage is simply driven by natural language, e.g., “Remember that…”, “Check memory…”, “What was said before…” — the model picks the appropriate memory_* call.
Adjusting Hierarchical Numbers¶
Add config for memory-vault in the profile’s cordis.patch.yml, e.g.:
- insert:
- id: memory-vault
name: 'dsh-memory-vault'
config:
shortTermLimit: 20
shortTermCompressCount: 10
mediumTermLimit: 4
mediumTermCompressCount: 3
longTermLimit: 4
If you only want less compression and more raw text retained, you can override just some fields, e.g. { mediumTermLimit: 8 }.
Data, Backup, and Upgrade¶
- Database file:
~/.dsh/memory/memory.db. - The plugin does not perform automatic backups; it is recommended to copy the file before upgrading or manually cleaning.
- Old databases automatically get the
workspace_idcolumn added on first open; existing rows remain NULL (global) and are still visible under default retrieval, with no manual migration required. - Deleting entries depends on
PRAGMA foreign_keys = ON; do not modify the database directly with external tools, to avoid leaving orphaned tag associations.
Local development verification: npm test (creates the database in a temp directory, does not touch the production database). To cover the test path, you can point the environment variables DSH_MEMORY_DB, DSH_MEMORY_DIR, or the plugin’s config.dataDir to a copy.
Use Cases and Caveats¶
Suitable for: DSH users who need to retain preferences and conclusions across sessions, isolate memories by project, and want hierarchical compression to control context size; when multiple agents or subagents collaborate in the same workspace, the default scope=current reduces cross-project memory bleed.
Caveats: Memory content lands in local SQLite; sensitive information must be assessed by yourself; plugin capabilities and data formats are subject to the README of this fix fork; when switching from the original version or the npm package, confirm that you are using the installation source of the xs1023 fix fork, to avoid confusion with “two independent implementations”.
Links¶
- Directory page: https://www.skillhub.cn/plugins/xs1023/dsh-memory-vault
- Source code and documentation: https://github.com/xs1023/dsh-memory-vault