Passer au contenu principal
Z

dsh-memvault

zhang66633/dsh-memvault

Relie DSH à un stockage MemVault local : injecte les blocs de mémoire essentiels dans le system prompt, extrait les tours terminés via le pipeline propre à MemVault et fournit un panneau pour parcourir, retracer, examiner et rejouer le contenu stocké.

Installer

dsh plugin --profile web add github:zhang66633/dsh-memvault

README

dsh-memvault 项目介绍

dsh-memvault

Long-term memory for DeepSeek Harness.
blocks in the prompt · turns extracted into one SQLite file · two tools · one panel

English | 中文

version license runtime deps node stars


MCP is pull-only, so "memory is already loaded" can never come from a server. This plugin does it inside DSH — and since 0.9.x it owns the store too: no Python, no second process.

HalfWhatHow
Injectcore blocks in the system prompt, every stepctx.systemPrompt.context()
Extractfinished turns → one window → one LLM passsession/event → window → add/supersede/none
Recallmemory_search / memory_addFTS5 trigram + vectors, RRF, answerability guard
Showoverview / memories / structure, block editing, replayhost routes + conversation tab / settings page

✨ Features

🗄️ One storeprompt, extraction, tools and panel read ~/.dsh/memvault/memvault.db
🧠 No tool call neededblocks ride the runtime context, TTL-cached
⏱️ Off the critical pathqueued windows, one call per N turns / idle / cap
🔎 Hybrid recallsubstring truth (trigram) + paraphrase (vectors), fused
🛠️ Two toolsscoped by user_id / agent_id / run_id
🎛️ A real paneldiagnostics, vector backfill, provenance, relation graph
🃏 Native tool cardsmemory_search / memory_add render their own conversation cards
🪶 Zero depsnode:sqlite + hand-written client bundle

🚀 Install

dsh plugin --profile desktop add dsh-memvault

Self-owned install links a checkout in the profile's package.json (dsh-memvault: link:…) plus a junction under node_modules — see docs/DEVLOG.md. A new bundle needs a DSH restart; after editing the client run npm run build.

Requires DSH 0.2.1+, verified against 0.2.2-rc.5 (engines.dsh names the 0.2.2 line explicitly, because a bare >=0.2.1-0 <0.3.0-0 does not admit 0.2.2-rc.5 for strict semver readers; the >=0.2.2-0 arm covers the whole 0.2.2 pre-release line, rc.1 through rc.5). Node 24.9+ is required: that is the runtime floor of DSH 0.2.2, and this plugin uses Node 24's DatabaseSync busy-timeout option. The tool cards, the non-interpolated injection and the session-close extraction are 0.2.2 features; on 0.2.1 they degrade to the previous behaviour.

⚙️ Configuration

FieldDefault
scopes[{user,lenovo},{agent,claude-code-memory}]
labels / maxChars / refreshMs[] / 4000 / 30000
extract.everyNTurns / idleMs / windowTurns3 / 20000 / 8
extract.timeoutMs60000 (wired as MEMVAULT_EXTRACT_TIMEOUT_MS)
extract.minTranscriptChars / maxInputChars40 / 6000
extract.projectDir / envdiscovered .env directory / {}
panel.writestrue

The store path is not configurable through this plugin (~/.dsh/memvault/memvault.db, or DSH_MEMVAULT_CORE_DB). projectDir is only where .env is read — nothing is spawned, so a machine without a Python checkout still works, and the panel lists the directories it checked. The pipeline reads the usual .env keys (OPENAI_*, MEMVAULT_EXTRACTOR=rule|llm, MEMVAULT_EMBEDDER=local|openai, MEMVAULT_ADJUDICATOR=off).

The old dbPath, extract.pythonPath and extract.user/agent/run keys are gone: a stale patch that still sets one is reported as an ignored key in the panel instead of silently doing nothing. The write scope is derived from scopes (first user → user_id, first agent → agent_id).

🗄️ Store & migration

~/.dsh/memvault/memvault.db (override DSH_MEMVAULT_CORE_DB). From the Python store, once:

memvault export --from data/memvault.db --out export.json
node scripts/import-core.mjs export.json ~/.dsh/memvault/memvault.db --apply
node scripts/backfill-core.mjs ~/.dsh/memvault/memvault.db --project-dir <checkout> --apply

🏗️ How it works

flowchart LR
  T[turn/end] --> W[window] --> X[extractor] --> D[decide] --> S[(store)]
  S --> P[system prompt]
  S --> M[tools]
  S --> U[panel]

🧪 Verification

npm test (6 smokes + 56 unit). Live: /memvault/api/status shows the last five outcomes ([rule]|[llm] ok added=N); replay via POST /memvault/api/replay; recall via memory_search.

🧠 Decisions

  • One store, not two — no "tool saw it, panel didn't".
  • Supersede, never delete — history keeps the audit.
  • Only user text is extracted — short windows are skipped (docs/DEVLOG.md §35).

⚠️ Limits

  • Single machine, single store: no sync, no encryption.
  • Extraction quality depends on the extractor (rule is deterministic but narrow; LLM depends on the endpoint).

📄 License

MIT

Plugins associés