dsh-memory-panel
Persistent memory plugin for DeepSeek Harness: model-facing
memory_*tools, automaticmemory:recallprompt injection,/memory/apiJSON routes, and a Settings → 记忆 (Memory) management panel.
What it does
dsh-memory-panel gives every agent session a durable, searchable memory
that survives process restarts:
| Capability | Where | Description |
|---|---|---|
memory_save |
model tool | Create or update a memory entry (title + content + tags + importance) |
memory_search |
model tool | Ranked keyword search — Latin whole-word plus CJK bigram scoring |
memory_list |
model tool | List entries newest-first, optionally filtered by tag, with tag/importance stats |
memory_get |
model tool | Read one full entry by id |
memory_delete |
model tool | Delete an entry by id |
memory:recall |
system prompt | Top 6 memories (high-importance first) are auto-injected into every agent's prompt at assembly time |
/memory/api/* |
host route | JSON API used by the settings panel |
| Settings → 记忆 | web panel | Browse, search, create, edit, and delete memories in the GUI |
The plugin is mounted at the user layer of the DSH profile composition, so its tools are visible to every session regardless of which agent preset is active.
How it works
┌──────────────────────────── DSH host process ───────────────────────────┐
│ │
│ tools registry ◄── memory_save/search/list/get/delete (model-facing) │
│ ▲ │
│ │ createMemoryStore (src/store.js) │
│ │ ┌──────────────────────────────────┐ │
│ │ │ pure logic: scoring, recall, │ │
│ └──── execute ────────│ serialized write chain │ │
│ └───────────────┬──────────────────┘ │
│ │ load / persist (injected) │
│ /memory/api/* routes ◄── POST ──┐ ▼ │
│ ▲ │ fs service │
│ │ │ │ │
│ systemPrompt.memory:recall ◄───┘ ▼ │
│ ▲ <home>/.dsh-memory/memories.json │
│ │ (30s guarded refresh + │
│ │ refresh on every save/delete) │
└────────┴───────────────────────────────────────────────────────────────────┘
┌────────────────────────── browser (web client) ─────────────────────────┐
│ Settings → 记忆 panel ── fetch('/memory/api/<method>', { method: 'POST' })│
└────────────────────────────────────────────────────────────────────────────┘
- Storage:
memories.jsonunder<user home>/.dsh-memory/— resolved from the hostsandboxPolicy.workspaceRoot, i.e. the user home, not the session workspace. Created on first save; survives restarts. - Concurrency: every mutation goes through a serialized write chain, so concurrent saves/deletes can never interleave on the backing file.
- Recall: the
memory:recallsystem-prompt section renders a plain-string cache synchronously (the sectiontexthook is sync,ctx.fsis async); the cache is rebuilt after every save/delete and on a guarded 30s timer. - Scoring: title (×3) > tags (×2) > content (×1); CJK queries additionally score every overlapping bigram, so short Chinese queries still hit long entries; high-importance entries get a flat +2 (and thus surface even on no-hit queries).
Installation
Option A — official CLI (bundle channel, recommended)
dsh plugin --profile <profile-name> add dsh-memory-panel
The package declares dsh.bundle.patch: ./cordis.patch.yml; the CLI reconciles
the profile bundle stack and the patch inserts the plugin row, so no profile
file edits are needed.
Option B — manual patch
Copy the package anywhere DSH can resolve it, then append to your profile's
cordis.patch.yml:
- insert:
- id: tool-memory
name: 'dsh-memory-panel'
Restart DSH. New entries must be added with insert (an id-less override is
ignored by the patch loader).
Upgrading from an older manual mount: if your profile already mounts the plugin row in its own
cordis.patch.yml, remove that line before switching to the bundle channel to avoid double-mounting (two host halves, duplicated tools and routes).
Usage
As a model
Just talk naturally — or call the tools directly:
memory_save(title="User prefers Chinese thinking", content="...", tags=["preference"], importance="high")
memory_search(query="Chinese thinking")
memory_list(tag="preference")
memory_get(id="m...")
memory_delete(id="m...")
Every agent automatically sees the top saved memories through the
memory:recall section (marked [重要] when high importance) and is told to
call memory_search for the full picture.
In the GUI
Open Settings → 记忆 (Memory): browse all entries with stats, search,
create/edit/delete. The panel talks to the host through
POST /memory/api/* JSON routes.
Development
npm test # node:test — pure-logic + plugin-level integration tests
src/
index.js Host half: tools, routes, recall injection (Cordis plugin)
client.js Client half: Settings → 记忆 panel (module-loader bundle)
store.js Pure logic: scoring, recall builder, injected store factory
test/
store.test.js Unit tests for src/store.js
index.test.js Integration tests with a mocked Cordis ctx + in-memory fs
docs/
design.md Architecture and data-flow deep dive
FAQ.md Common questions
License
MIT © 2026 dsh-memory-panel contributors
No comments yet. Be the first to write one.