DeepSeek Harness 插件

sunny-summer-dish/dsh-keepsake

Star 数 ★ 0 分类 记忆 收录于 2026-12-02

本地、只追加的 DSH 记忆:记、找、改口、忘掉;支持翻页/压缩两种采集模式与可选离线向量。

安装

# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)

dsh plugin --profile web add github:sunny-summer-dish/dsh-keepsake

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。

README

该插件的 README 只有英文版本。

Local, append-only memory for DeepSeek Harness (DSH).

No cloud. No persona card. No telemetry. One JSONL file on your machine.

Package: dsh-keepsake · CLI: keepsake · data: ~/.dsh-keepsake

0.3 adds two DSH surfaces, page/compact capture modes, and an optional offline embedding backend. All read/write stays local.

界面示意:布局随 DSH 主题变化,截图内记录为演示数据。

Two surfaces

AI page User page
see records with id / time / who / source same
write remember / find / correct (tools) delete (soft), export, settings
cannot delete, export, change settings —

The permission split is enforced by the server routes, not just hidden in the UI.

User correction is off by default

The user page has a 更正 button, but it is rejected until the user turns on allowUserCorrect in settings (default false). Toggling the switch does not write anything to the ledger, so repeated on/off cannot spam it.

Instead, memory_find reports the current state to the AI on every query:

(用户记忆权限:更正 开/关;语义 开/关)

A correction itself is still additive: a new record points back to the old id, and the original is never overwritten.

Two modes, one core

The difference between page-flipping users and compaction users is how turns are captured, not how memory is stored. One plugin, three settings:

mode for capture behavior
page page-flippers records a page-boundary marker when the session changes; dedupes copied context
compact single long sessions ignores page boundaries; records compaction markers; never stores a summary as a user quote
auto (default) both page boundary when the session changes, compaction marker when a compaction event appears

autoCapture remains off by default. When on, each user/assistant turn is stored separately with session, page, turn, who, source. Long pages never become one giant record.

Verified against real DSH event names: compaction/start, compaction/summary, compaction/end, compaction/prune; only start writes one marker. A replay of 22 real sessions (255k events, 43 compactions) produced 43 compaction markers and 21 page markers. captureAssistant is also off by default; injected prompts (starting with 【, <system-reminder>, Current runtime context, etc.) are skipped.

If your context gets compacted

Keepsake is built for compact-style sessions: the ledger lives outside the context window, so compaction does not delete it.

compaction rewrites the session context
ledger.jsonl is a separate append-only file
memory_find still searches it after compaction

compact records one compaction/start marker, not the summary. A summary is never stored as a user quote, so compaction cannot create a fake memory.

What still depends on the agent:

  1. A record has to exist. autoCapture is off by default; turn it on, or call memory_remember for the things that must survive.
  2. The query has to hit. Use nouns, names, dates, or a synonym from the editable src/synonyms.json. With semantic search off, purely different wording may miss.
  3. The agent has to decide to search. The tools stay registered after compaction, but the agent may not remember that a memory exists. Add one line to the profile's AGENTS.md or system prompt:
Before saying you don't remember something from an earlier page or from before
a compaction, call memory_find with the nouns / names / dates first.

That line is the difference between "the memory is still there" and "the agent actually goes and gets it". Keepsake stores and retrieves; it does not inject the whole ledger into every prompt.

What it does

  • remember — append a note, with who said it and where it came from
  • find — by word, by day, by speaker; every hit carries an id and time
  • correct — a new record points back to the old one; the original is never overwritten
  • forget — soft delete; the record stays exportable
  • export / import — plain JSONL, no lock-in

Install (0.3, from source)

git clone <this repo> dsh-keepsake
cd dsh-keepsake
node bin/keepsake.mjs help

No dependencies for the core. Node 20+. After the npm release, npm i -g dsh-keepsake gives you the keepsake command.

Use inside DSH

# 发布后
dsh plugin --profile desktop add dsh-keepsake

# 或者先装本地目录(路径按实际位置)
dsh plugin --profile desktop add "D:/dsh-stuff/projects/dsh-keepsake"

重启 DSH 后,侧栏会出现两个入口:

  • 留念 · AI:只读列表,按词/天搜
  • 留念 · 我的:搜索、忘掉、导出 JSONL、打码/自动收设置

AI 那一侧的工具是 memory_remember / memory_find / memory_correct; forget 和 export 只在用户页面,由服务端拒绝 AI 路由。

Use (CLI)

# 记
node bin/keepsake.mjs remember --text "今天去看了海。" --who user --source cli

# 找(词 / 天 / 谁)
node bin/keepsake.mjs find "海"
node bin/keepsake.mjs find "海" --day 2026-11-30
node bin/keepsake.mjs find "海" --who user --limit 5

# 改口(原文不动,新条指向旧 id)
node bin/keepsake.mjs correct --id m_000001 --text "今天去看了海,风很大。"

# 忘掉(软删)
node bin/keepsake.mjs forget --id m_000002

# 导出 / 导入
node bin/keepsake.mjs export --file keepsake.jsonl
node bin/keepsake.mjs import --file keepsake.jsonl

Default store: ~/.dsh-keepsake/ledger.jsonl. Override with DSH_KEEPSAKE_HOME or --home.

Retrieval benchmark (0.3)

Synthetic data, not anyone's real memories. Two sets:

npm run bench
category hit
字面 10/10
改口 2/2
按人 2/2
换说法(种子内) 5/5
精度(别被同义词带偏) 3/3
无命中(该空就空) 1/1
留出(种子里没有的说法) 1/5
overall 24/28 (85.7%)

Honest reading: a small editable synonym seed (src/synonyms.json) covers the five seeded paraphrases, but held-out paraphrases ("毛孩子", "远行", "伴手礼") still fail. That is a dictionary, not understanding. Vectors or a larger semantic layer are the next step; do not report 100% from the seeded set alone.

Optional semantic retrieval (off by default)

No download is required to install or use this plugin. Without a semantic backend, find uses literal + multi-word + the synonym seed only.

Semantic retrieval is an optional enhancement, off by default. Nothing is downloaded until the user turns it on and confirms the model size/source.

Status: wired into memory_find behind settings.semantic (off by default). The default stays usable without any model; a failed load falls back to literal.

Tested model: Xenova/bge-small-zh-v1.5 (q8), about 23 MB on disk.

To enable the local backend, install the optional peer in the same DSH profile:

cd "$DSH_HOME/profiles/desktop" && pnpm add @huggingface/transformers

Not installing it is supported: none remains the default and lexical search still works.

benchmark lexical only + local-onnx hybrid
overall 24/28 (85.7%) 27/28 (96.4%)
held-out paraphrases 1/5 4/5
literal / precision 10/10, 3/3 10/10, 3/3

The model is not bundled; first use downloads it to ~/.dsh-keepsake/models (or DSH_KEEPSAKE_MODEL_CACHE). In mainland China, DSH_KEEPSAKE_MODEL_HOST=https://hf-mirror.com is a working mirror. Text never leaves the machine.

backend role requires
none (default) literal + synonym seed nothing
local-onnx primary optional: truly offline, no other software one-time model download (~25–100 MB, user-confirmed)
openai-compatible second option: use an existing local Ollama / LM Studio endpoint user already runs one

Rules:

  • The plugin must run fully with none; a missing/failed model falls back to literal search, never blocks remember / find.
  • local-onnx loads dynamically only after opt-in; text never leaves the machine.
  • A model switch rebuilds the sidecar vector index; the ledger is untouched.
  • Enable only if the held-out benchmark improves without hurting literal or precision cases; otherwise keep it off.

Privacy defaults

  • Everything stays local; there is no network code.
  • token, password, Bearer, sk-… are masked by default. --no-redact keeps raw text.
  • forget is a tombstone: hidden from find, still present in export.
  • Deleting the store directory deletes everything.

Deliberately out of scope

  • persona / identity generation
  • QQ / group chat / bridge integrations
  • mood / diary / drawing
  • cloud sync or accounts

Tests

npm test

内容来自项目 README(GitHub)↗

链接

同类插件

查看整个分类 →

社区评论

评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。