Cross-session memory plugin for DeepSeek Harness (dsh).
YAML-backed remember / recall / forget / pin tools with embedding search and automatic system-prompt injection — the agent "naturally carries" memory without having to remember to call a tool.
English | 中文
| Feature | Description |
|---|---|
| remember / recall / forget / pin | Four tools for write, semantic search, soft-delete, and force-inject pinning |
| Embedding search | HybridSearch (keyword 2-gram + local embedding via ollama, RRF fusion) — catches paraphrases keyword search misses |
| Automatic injection | systemPrompt.context() at order -50: high-importance + recent memories injected every session, visible in the WebUI as a "上下文注入" row |
| Dynamic topic injection | agent/pre-step listener retrieves memories matching the user's current message (with a retrieval gate that skips "好/行/ok" chatter) |
| Provenance labeling | Injected memories are prefixed "Retrieved memories from the memory store (not conversation history)" so the model never mistakes them for dialogue |
| Data safety | Serialized write queue (no lost updates), corrupt-file quarantine + backup, atomic writes, mtime cache invalidation |
# From source (inside a dsh checkout)
pnpm install
pnpm run build
# Register in your profile patch (e.g. ~/.dsh/profiles/web/cordis.patch.yml)
- insert:
- id: dsh-memory
name: '@towzai/dsh-memory'
config:
file: /path/to/memory.yaml
injectLimit: 8Requires a local ollama instance with an embedding model
(default qwen3-embedding:0.6b; override via DSH_MEMORY_EMBED_MODEL).
| Tool | Purpose |
|---|---|
remember |
Save a memory (content / category / tags / importance / forceInject / source) |
recall |
Hybrid search (keyword + embedding) top-N |
forget |
Soft-delete (marks retired, keeps history) |
pin |
Toggle forceInject — pinned memories always appear at session start |
Single YAML file (default memory.yaml). Each entry:
- id: MEM-20260814-001
content: "..."
category: preference | project | lesson | fact
tags: [tag1, tag2]
importance: high | normal | low
created: 2026-08-14
updated: 2026-08-14
source: user | agent | conversation
retired: false
forceInject: false
vector: [...] # 1024-dim embedding, auto-computed on writesrc/
├── index.ts # plugin entry: tools + injection + pre-step listener
├── storage.ts # Storage interface + YamlStorage (queue, mtime cache, quarantine)
├── search.ts # KeywordSearch / EmbeddingSearch / HybridSearch (RRF) / OllamaEmbedder
├── inject.ts # selectForInjection / renderSection / buildMemorySectionSync
├── dynamic.ts # DynamicInjector (per-session dedup + retrieval gate)
└── types.ts # data model (+ reserved fields: vector/scope/weight for future)
Design doc: docs/2026-08-13-dsh-memory-design.md.
- Embedding model change invalidates stored vectors (dimension mismatch is detected and logged)
- The plugin is developed against dsh
v0.1.0-rc.5; peer dependency ranges may need bumping
This plugin is part of the DeepSeek Harness (dsh) plugin ecosystem.
- Official repo: deepseek-ai/deepseek-harness
- Plugin docs: docs/user/develop — plugin lifecycle, config, and publish guide
- Ecosystem topic:
dsh-plugin
MIT