Bundle
@tieveto666-code/dsh-memory-migration
Long-term memory for stock DeepSeek Harness: key/value store with question-time recall, plus optional migration from official ChatGPT, Claude, Gemini, and DeepSeek exports.
- Source
- tieveto666-code
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 13 days ago
Readme
# DSH Long-term Memory
A [DeepSeek Harness](https://github.com/deepseek-ai/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):

## 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+**).
```sh
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`:
```yaml
allowBuilds:
'@tieveto666-code/dsh-memory-migration': true
```
Then run `dsh plugin add` again.
From a local checkout:
```sh
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.
| Source | What to import | Conversations | Saved memories in the zip |
| --- | --- | --- | --- |
| **ChatGPT** | Settings → Data controls → Export data (emailed ZIP) | `conversations.json` (current `mapping` / `current_node` branch only) | `memory.json` when present |
| **Claude** | Settings → Privacy → Export data | `conversations.json` (`chat_messages`) | `memories.json` / `memory.json` when present |
| **Gemini** | [Takeout](https://takeout.google.com) → My Activity → **Gemini Apps**, activity records as **JSON** (not HTML) | `MyActivity.json` grouped by chat URL | Usually **absent** (Saved Info is not in Takeout) |
| **DeepSeek** | Settings → Data management → Export chat history | Chat 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:
```sh
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
```sh
pnpm install
pnpm test
pnpm build
```
## License
MIT
Install
dsh plugin --profile web add github:tieveto666-code/dsh-memory-migration
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install tieveto666-code-dsh-memory-migration from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.