Skip to main content

dsh-memory-system

8Stars0Forks0Issues0Watchers

Provides local-first persistent memory across sessions for DSH, zero external dependencies, Markdown data storage, writes require confirmation.

Categories◆ Memory
Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
MIT
Branch
master
agent-memoryai-agentschinese-bm25coding-agentdeepseek-harnessdshdsh-pluginlocal-first

Install

cmdweb profile
$ dsh plugin --profile web add @zhujunpeng12/dsh-memory-system

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin zhujunpeng12/dsh-memory-system for me: review the repository at https://github.com/zhujunpeng12/dsh-memory-system first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Sentence Positioning

Provides local-first persistent memory across sessions for DeepSeek Harness (DSH): automatically injects a ≤14KB "hot memory packet" (gate status/rules/project summary/recent events) at the start of each new session, with on-demand recall of historical details when needed—all data stays on the user's own machine in pure Markdown form.

Core Capabilities

  • Automatic hot memory injection: Each new session's first round automatically reads gate status, user profile, active rules, current project summary, and recent event titles, composing a ≤14KB context for one-time injection (can be disabled by setting DSH_MEMORY_AUTO_INJECT=false)
  • On-demand cold recall: When users mention history, corrections, or specific topics, triggers Chinese BM25 + exact match + metadata reranking for cold retrieval, returning ≤4KB context with sources and traces
  • Mechanical gate health check (memory_gate): Automatically checks health items such as "whether raw records were distilled", "whether volume exceeds limit", "whether rule core is synchronized", "whether there are unreleased write locks", used with --closing/--expect-write modes at session end
  • Read-only governance scan (memory_govern): Finds duplicate, conflicting, expired, oversized, or lifecycle-abnormal candidate entries, provides only evidence and suggestions, never auto-deletes or modifies
  • Trajectory review (memory_trajectory_review): Scans session trajectories, uses "user corrections" as hard signals to generate review candidates (scenario → error → root cause → prerequisite action), works with optional evidence-ledger plugin to read tool call ledgers
  • Safe authorized writes (memory_write): Default dry-run preview, enters lease-lock transaction write only after user confirmation, corrections link to original entries via supersedes instead of overwriting

Technical Implementation

  • Language: JavaScript (ESM, type: module) as the host plugin shell, memory engine entirely implemented using Python standard library
  • Key dependencies: Zero npm runtime dependencies (only uses Node built-ins node:child_process/node:crypto/node:fs/node:os/node:path/node:url); Python side only depends on standard library (argparse/hashlib/json/pathlib/re, etc.)
  • Architecture pattern: Cordis dual-injection plugin (inject: ["tools", "agents"]), hooks into DSH via apply(ctx) — ctx.agents.roots() registers 6 tools for each root agent, ctx.on("agent/pre-step", ...) auto-injects hot packet on first round of each session, ctx.on("tools/pre-execute", ...) intercepts write tools to force confirmation; Python scripts called via subprocess, results returned as JSON
  • Entry files: index.js (host side) + bridge.js (pure function mapping tool parameters to Python CLI argv, zero-dependency for unit testing) + vault-guard/*.py (memory engine script collection)

Use Cases

Suitable for individual developers and small teams working continuously on the same project within DSH who need to remember their previous decisions and preferences across sessions—particularly Chinese-language scenarios where auditable "fact" logs are desired, privacy-sensitive, and unwilling to upload conversation content to third-party vector services. Not suitable for scenarios requiring multiple agents to frequently write to the same memory database concurrently, relying on semantic vector recall, or wanting AI to automatically write memory without approval.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
DeepSeek Harness (DSH)0.1.0-rc.7Registered as scoped bundle via cordis.patch.yml and dsh.plugin.json; early 0.1.0 installation will error due to loader name without scope package or missing agents injection, must upgrade to 0.1.1+
Node.js22 or 24Not declared in package.json#engines, but TROUBLESHOOTING.md and README consistently mark Node 22/24 as usable
Python3.10+Memory engine depends on Python standard library; command name must be available as python, otherwise use PYTHON environment variable to point to actual executable (e.g., py on Windows)
Default StorageUnlimitedAuto-initialized at ~/.dsh-memory/ by default; can point to any directory via MEMORY_VAULT (common usage: Obsidian Vault root)

Installation

dsh plugin --profile web add github:zhujunpeng12/dsh-memory-system

Configuration Options

ConfigTypeDescriptionDefault
MEMORY_VAULTPathMemory database root directory (containing memory/ and projects/ subdirectories), empty uses basic mode (regular Markdown folder)~/.dsh-memory
DSH_HOMEPathDSH runtime home directory (hooks config, storages, etc.), affects tool ledger location for companion plugin evidence-ledger~/.dsh
PYTHONExecutable nameInterpreter command to invoke Python scriptspython
DSH_MEMORY_AUTO_INJECTBooleanSet to false to disable automatic hot memory injection on first round of each new sessiontrue (enabled by default)

FAQ

Q: What's the difference between this plugin and DSH's built-in session memory?

A: DSH defaults to forgetting between sessions; this plugin沉淀每次会话产生的规则、项目笔记、纠正等"事实"到本机 Markdown(默认 ~/.dsh-memory),下次新会话开始时自动注入一个 ≤14KB 的"热记忆包",需要时再按需召回历史细节,整套数据存你自己电脑里,无需数据库或外部向量服务。

Q: Where is memory data stored? Will it leak to the cloud?

A: Stored by default in ~/.dsh-memory/ under the user home directory, a regular Markdown folder. The repository itself contains no personal data. For visualization, set the MEMORY_VAULT environment variable to point to your own Obsidian Vault—all read/write happens locally on your machine.

Q: Do I need to manually configure anything after installation?

A: First run automatically creates ~/.dsh-memory/ skeleton (including memory/events/index/projects subdirectories and empty user_profile.md/rules.md), no manual configuration needed. To switch to Obsidian mode or custom path, set MEMORY_VAULT and DSH_HOME environment variables.

Q: Will agents secretly modify my memory files?

A: No. All write operations (memory_write) default to dry-run (preview), only actually written when user explicitly confirms with apply=true; writes also have four-layer protection: 30-second lease lock, SHA-256 precondition, before-image backup, and submission receipt. Corrections must supersedes original entries and never overwrite historical raw logs.

Q: Is Python required to use this?

A: Yes. The memory engine is implemented by Python standard library scripts (no pip packages needed), requires Python 3.10+ and command name available as python; if your executable is named py or python3, set the PYTHON environment variable to point to it before starting Harness.

Q: How to uninstall? Will residual files be left behind?

A: Execute npx @deepseek-ai/dsh plugin --profile web remove @zhujunpeng12/dsh-memory-system in the web profile directory to uninstall the plugin; the plugin will not delete memory data under ~/.dsh-memory/. If you won't use it after uninstall, back up or manually delete that directory yourself.

Q: Do I need Obsidian?

A: No. Default is regular local Markdown folder, viewable with any editor; only when you want Obsidian features like bi-directional links and graph visualization, point MEMORY_VAULT to your Vault to switch to Vault mode—templates are in templates/vault/.

Q: Can cold recall understand paraphrasing?

A: No. Cold recall is based on exact match + Chinese bigram BM25 + metadata reranking, suitable for exact/near-exact matching (proper nouns, code identifiers, dates, explicit topics); paraphrasing, long-tail expressions, and cross-language recall capabilities are limited. Semantic vector search is disabled by default to maintain zero dependencies.

Getting Started Difficulty

Entry level — one-line install command, auto-creates database on first run, usable without configuration; advanced capabilities (lease locks, SHA-256 transactions, trajectory review) can be learned as needed, don't affect daily use.

Known Issues & Limitations

  • Writes default to dry-run: Won't write to disk without explicit apply=true and user confirmation. "Agent said it remembered" doesn't mean it actually wrote—use memory_gate or directly check events files to confirm
  • Cold recall is not semantic vector search: Based on BM25 keyword matching, limited capability for paraphrasing, long-tail expressions, and cross-language recall; this is a trade-off for zero dependencies
  • Single-writer lease lock: Only one writer allowed at a time for the same memory database; multiple agents writing concurrently will serialize; split memory databases or stagger writes for high-frequency multi-writer scenarios
  • Project isolation only by cwd ancestor matching: Different git branches in the same directory share the same memory database; branch-level isolation is on the roadmap, not yet implemented
  • Hot packet injected once per session: Memory added mid-session won't automatically appear in current session's hot packet—explicitly call memory_recall or memory_bootstrap to refresh
  • Trajectory review's quantitative dimension depends on companion plugin: Without plugins/evidence-ledger/, only scans session logs for user correction signals (qualitative), no tool ledger data to analyze
  • Common first-install failure reason: Early 0.1.0 versions will error due to scoped package name loader issues or missing agents injection—must install 0.1.1 or later
  • Node.js process timeout protection: All script calls default to 60-second timeout, memory_bootstrap/memory_recall/memory_govern/memory_trajectory_review/memory_write individually extended to 120 seconds

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/zhujunpeng12/dsh-memory-system)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory