dsh-cherry-kb
Local knowledge base and memory switch for DeepSeek Harness (dsh web).
Two controls in the composer's trailing tool row (left of the model selector), and two pages under Settings. The host half orchestrates an external knowledge-base toolchain; it re-implements neither indexing nor memory.
⚠️ Read this first: external prerequisite
This plugin is not self-contained. It contains no chunking, no FTS, no
embedding, no AGENTS.md rendering and no memory logic. Every operation is a
spawn of three executables that already exist on your machine:
| Executable | Used for |
|---|---|
我的知识库/记忆开关 |
reading and setting the three-position memory mode |
我的知识库/idx |
status, sources, indexing, search, embedding models, index library |
我的知识库/cherry |
read-only access to Cherry Studio's own knowledge bases |
The knowledge-base root is resolved in this order:
DSH_KB_ROOT(environment variable), or an explicit override;- otherwise
<built lib/>/../../../../我的知识库, then one level further up.
The first candidate that actually contains an idx file wins.
Without that toolchain installed, the plugin still installs and renders, but every route fails with a "cannot find the CLI" error. The package does not ship the toolchain, and there is no public distribution of it.
Install
dsh plugin --profile web add @wanghuiym123/dsh-cherry-kb
Point it at your knowledge base if it does not sit four levels above the installed package:
DSH_KB_ROOT=/path/to/我的知识库 dsh web
What it registers
Composer tool row — slot conversation.input.right, both left of the model
selector as one cluster of "what this conversation gets to see":
| Seat id | Order | Role |
|---|---|---|
kb-chat-kb |
90 | Which knowledge base this conversation uses |
kb-memory |
100 | Three-position memory switch (always shows the current position) |
Settings — slot settings.section:
| Section id | Order | Role |
|---|---|---|
my-knowledge-base |
50 | Source list, native folder picker, one-click reindex with staged progress, index library, per-source memory, embedding-model picker, local model service |
cherry-studio-kb |
55 | Read-only view of Cherry Studio's knowledge bases |
Both composer seats share one store, so the button and the settings page cannot disagree about the current position.
Host half — 22 routes under /dsh/kb/*:
status toggle update progress stop token
sources search select source-memory
indexes index-delete rebuild-vectors models
model/service model/list model/loaded model/load model/unload
cherry/list cherry/search cherry/select
Routes that write require a token; KbToken.ts issues it to loopback
same-origin requests only.
Boundaries
- Cherry Studio's bases are read-only. They belong to another application;
the plugin never builds, moves, rewrites or vacuums them. This is enforced by
keeping the Cherry family in a separate module (
KbCherry.ts) from the workspace family (KbSources.ts). - Adding a source registers it; it does not index it. Confirming an add
writes
我的知识库/03_证据层/来源清单.jsonand nothing else. - The plugin never moves the memory switch on its own. It is changed only by a user gesture in the UI.
- The plugin holds no persistent state of its own; every status shown is read live from the CLIs.
Verify
Both checks are offline — no dsh process, no browser, no network:
node scripts/verify-bundle.mjs # client artifact + host route table
node scripts/verify-host.mjs # route handlers against stub CLIs
verify-host.mjs runs entirely against bash stubs; it does not exercise the
real CLIs or the HTTP adapter layer. Read its closing note before treating a
green run as end-to-end coverage.
Build
tsc -b tsconfig.json && tsc -b tsconfig.host.json # types (client / host)
node <tsdown entry> # lib/client.js + lib/index.js
The two tsconfig files are standalone on purpose: no extends into the dsh
checkout and no project references, so tsc -b never writes outside this
package.
License
MIT
No comments yet. Be the first to write one.