Back to home@tieveto666-code

dsh-memory-migration

为原版 DeepSeek Harness 提供长期记忆:用键值对保存身份、偏好、方法论和约束,并在后续对话中按提问召回。可手动增删改查;也可选「记忆迁移」,从 ChatGPT / Claude / Gemini / DeepSeek 官方导出包提取少量核心记忆。独立插件,不修改 DSH 源码。

Stars
1
Language
TypeScript
Created
Aug 26, 2026
Updated
Aug 26, 2026
GitHub repo

Introduction

DSH Long-term Memory

A DeepSeek Harness plugin that gives stock DSH long-term memory: a key/value store of who you are and how you work, recalled into later chats when the question matches.

You can add memories by hand. Memory migration is one extra path: import an official ChatGPT, Claude, Gemini, or DeepSeek export and extract a small core of reusable pairs.

It is an out-of-tree Cordis plugin. It does not fork or patch DSH source, and it does not turn old chats into sidebar sessions.

The npm / plugin id remains @tieveto666-code/dsh-memory-migration (needed by dsh plugin add). The product name in Settings is Long-term memory.

Why this exists

DSH starts every conversation blank. Preferences, methods, constraints, and settled decisions have to be re-explained, or they sit unused in another product’s export.

This plugin keeps a compact standing memory on the machine, then injects only the entries that match the current question—not the entire history.

Typical uses:

  • Keep identity, hard preferences, and communication style across new DSH chats
  • Reuse standing methods and constraints for a class of work (reviews, SQL, writing)
  • Avoid re-litigating decisions you already confirmed, with the rationale attached

Preview

Settings → Long-term memory (key/value list, recall switch, and Memory migration):

Long-term memory settings

Capabilities

Manage long-term memory

Settings → Long-term memory:

  • Key/value table: add, inline edit, search by name, paginate, bulk delete
  • Global switch to enable or disable recall into later chats
  • Each row is tagged manual or migrated

Data lives under $DSH_HOME/memory-migration/ (usually ~/.dsh/memory-migration/).

Recall in later chats

On each turn, only keys are scored against the current user message (values never participate):

  1. The question contains a complete key (length ≥ 2) → always recall every value under that key
  2. Otherwise BM25 on CJK unigrams/bigrams and Latin words, with a stop list
  3. Non-contained hits need at least one content token overlap and a score ≥ max(0.55, best × 0.4)
  4. Cap: 8 keys, 16 entries

Hits are injected as system context. Off-topic questions inject nothing.

Memory migration (optional)

The Memory migration button imports a ZIP or JSON export. It does not dump whole transcripts. With DSH’s DeepSeek model it scans recent substantial conversations, then keeps at most 10 core pairs that fit one of:

  1. Identity and hard preferences — who you are, what you want, style
  2. Methods for a class of tasks — how you do that kind of work
  3. Recurring constraints — standing limits and must-nots
  4. Confirmed conclusions and rationale — settled decisions so you do not retry

One-off tasks, appointments, secrets, assistant opinions, and single-ticket conclusions are dropped. Near-duplicates are merged. Re-import skips pairs similar to memories you already have (including manual ones).

If DeepSeek is not available, import only lifts enabled facts from files the export already contains (memory.json / memories.json). Gemini Takeout and DeepSeek’s official bundle usually have none of those files.

Dropping a ZIP into $DSH_HOME/memory-migration/inbox/ also runs this import.

How it works

Manual add / edit  ─┐
                    ├→ key/value store ($DSH_HOME/memory-migration/)
Export ZIP/JSON  ───┘     extract at most 10 core pairs when migrating
                          → on later chats, match the user message against keys
                          → inject hits into the system prompt

The settings UI talks to a plugin-owned loopback HTTP API (/memory-migration/api, via official ctx.webServer.register). Stock DSH does not need a settings-namespace allowlist change.

Migration extraction uses ctx.llm (DeepSeek chat) and does not create a sidebar Session.

Install onto stock DSH

Requires a working DSH Web profile (same Node range as DSH: 22.19+ or 24+).

dsh plugin --profile web add github:tieveto666-code/dsh-memory-migration
dsh --profile web

Then open Settings → Long-term memory.

pnpm 10+ may refuse the git prepare script until you allow it. Copy the package name from the CLI error into the profile pnpm-workspace.yaml:

allowBuilds:
  '@tieveto666-code/dsh-memory-migration': true

Then run dsh plugin add again.

From a local checkout:

dsh plugin --profile web add link:$(pwd)
dsh --profile web --dump-config   # look for the memory-migration layer

Official export packages

Used only by Memory migration. You can skip this section if you only add memories by hand.

SourceWhat to importConversationsSaved memories in the zip
ChatGPTSettings → Data controls → Export data (emailed ZIP)conversations.json (current mapping / current_node branch only)memory.json when present
ClaudeSettings → Privacy → Export dataconversations.json (chat_messages)memories.json / memory.json when present
GeminiTakeout → My Activity → Gemini Apps, activity records as JSON (not HTML)MyActivity.json grouped by chat URLUsually absent (Saved Info is not in Takeout)
DeepSeekSettings → Data management → Export chat historyChat JSON (several unpublished shapes are accepted)None in the official bundle

Unrecognized dumps fail loudly instead of importing silently. Account emails stay in local metadata and are not injected.

Gemini HTML Takeout is rejected; re-export with JSON activity records. The top-level Takeout “Gemini” product is Gems, not chat history.

Privacy

Parse, unzip, extract, and store on the DSH host. There is no telemetry and no upload of the export to a third-party service. Migration extraction calls the DeepSeek model already configured in your DSH, the same as a normal chat.

Uninstall:

dsh plugin --profile web remove @tieveto666-code/dsh-memory-migration

That removes the plugin layer only. Delete $DSH_HOME/memory-migration/ yourself to wipe stored memories.

Develop

pnpm install
pnpm test
pnpm build

License

MIT