dsh-thinking-language-zh
ayanJava111
deepseek harness思考过程中文插件
PROJECT TOPICS
PROJECT README
🌏 中文 · English
AI never forgets what you told it.
A native DeepSeek Harness (DSH) plugin that gives the agent a memory maze — corridors and rooms built from every conversation you have had together. Every decision, setting, discussion, or casually mentioned requirement is remembered. Ask "where were we?" and it walks the maze, brings back the conversation verbatim, and answers as naturally as if it had never forgotten — you won't even notice it thought for a moment.
Conversation history recall · Three-layer retrieval (literal / fuzzy / semantic) · Fully local & offline · Compaction-proof
While searching, a quiet sweeping light appears in the corner:

When done, no trace:

Conversely, if your sessions are short and easy to scroll, you probably don't need it — it is built for "history too long, memory compacted" scenarios.
dsh plugin --profile web add dsh-recall@0.2.2
One command: the package ships its own composition patch (bundle layer), so the plugin and the search index it needs are wired up automatically. Restart dsh web. Nothing else to do — the model ships with the package (~37MB full install), the index builds on first search, and semantic warm-up finishes quietly in the background (a few minutes, imperceptible to you).
You can also install / disable / uninstall dsh-recall from the Add-ons block of the Plugin Management tab in dsh-extension-hub.
Install from source (git clone):
dsh plugin --profile web add git+https://github.com/Relistencode/dsh-recall.git
The repository tracks the model (models/model_merged.onnx) and the vendored runtime, so a git install is fully functional offline with no build step and no allowBuilds entry. The optional dsh-recall-models dependency is still attempted from npm; if it fails to resolve, the in-repo model is used instead — either way the semantic layer works. The harness resolves all paths through $DSH_HOME (default ~/.dsh), so this works identically regardless of where your harness home lives.
- id: recall
name: dsh-recall
config:
semantic: false # disable the semantic layer (literal + fuzzy only, smaller package)
warmup: gentle # slower warm-up, lower background CPU (only during warm-up; zero afterwards)
| Capability | Implementation |
|---|---|
| Three-layer hybrid retrieval | Literal / fuzzy / semantic merged automatically with a coverage gate (≥90%) and a silent degradation chain |
| Progressive disclosure | Light coarse recall by default (titles + snippets + events, ~100–800 tokens); detail drills into the original text — hit list / exact window / paged browsing |
| Event aggregation | Repeated mentions of one topic merge into events ([startSeq..endSeq], ≤5 text blocks apart) — one complete episode instead of scattered fragments; the full event text is one detail browse away |
| Proactive recall | The agent recalls on its own when needed (after compaction, when details are missing); explicit user requests also work |
| Compaction anchor | On compaction/summary, one lightweight anchor is injected automatically (summary + key original fragments, expires after 3 turns) |
| Scope control | Current session only by default; workspace / all only on explicit user request |
| Compaction-proof | Index covers the full history, including shadowed (compacted) events |
| Incremental indexing | Live sessions via ctx.sessions, persisted via sessionPersistence, append-only deltas |
| Background warm-up | Worker-thread embedding (~10 texts/sec), host event loop never blocked |
| Invisible UI | "Recalling…" sweep → one quiet "Recall complete" line; results never enter the UI, the agent presents them naturally |
| Fully local & offline | Zero npm runtime dependencies; no external model APIs; works with no network at all |
recall tool, the three layers are searched, hits are grouped into events per session, and the agent receives either a light coarse recall or a drill-down window, depending on what it needs.ctx.sessions / ctx.sessionPersistence / ctx.sessionQuery) — no .zstd parsing, no private formats. The plugin's own recall-index.db (SQLite) holds the fuzzy index, the vectors and the trigram FTS.compaction/summary listener that turns every compaction into one lightweight anchor, so the agent keeps its bearings after history is folded away.| Layer | Technique | Covers |
|---|---|---|
| Literal | Official FTS5 full-text index | Exact keyword matches |
| Fuzzy | Self-built trigram + char-bigram index (zero dependencies) | Rough wording, remembered fragments, typos / missing chars |
| Semantic | Local bge-small-zh model (int8, 24MB, bundled) | Paraphrase, word substitution, "roughly what it was about" |
Recall happens in two stages, and the second stage only fires when the agent actually needs it:
| Stage | What the agent gets | Cost |
|---|---|---|
| 1 — coarse recall (default) | Session titles + snippets + same-topic events, grouped, ranked | ~100–800 tokens for up to 10 sessions |
2 — detail drill-down |
A session's hit list / the exact original-text window (readEvent) / paged browsing |
~300 tokens per session (e.g. a ±3 event window) |
Measured live on a real instance: coarse recall saved ~80% of tokens versus the old full-context windows (2500–3000 → ~600 on a 10-session hit, pre-aggregation). Event aggregation keeps the same discipline — snippets only, full event text one drill-down away — so a coarse call stays under ~800 tokens. Irrelevant content never enters the context — and when it matters, the original text is always one drill-down away.
Compaction is where memories get lost — the harness summarizes, the original text is shadowed. dsh-recall listens for compaction/summary and immediately injects one lightweight anchor into the compacted session:
detail drill-down away, always./compact produced the anchor in the very next assembly, with the correct content, expiring automatically after 3 turns.workspace) and cross-project (all) searches happen only on the user's explicit request.| Measurement | Result |
|---|---|
| Coarse recall cost (default) | ~100–800 tokens per call |
| Old full-context windows (10 sessions) | ~2500–3000 tokens — 3–4× more |
detail ±3 window |
~300 tokens per session |
| Compaction anchor | Verified live: real /compact → anchor injected next assembly, correct content, auto-expires after 3 turns |
| Semantic warm-up | ~10 texts/sec in a worker thread, host event loop zero-blocked |
Synthetic 4-session corpus (32 docs) with 23 hand-annotated queries (exact / fuzzy-typo / paraphrase / cross-session), run in-memory with the real model — repro: node eval/run-golden.mjs:
| Variant | recall@5 | MRR | nDCG@10 |
|---|---|---|---|
| Literal only (simulated official FTS5) | 0.196 | 0.217 | 0.201 |
| Fuzzy only | 0.587 | 0.652 | 0.579 |
| Semantic only | 0.533 | 0.609 | 0.529 |
| Hybrid (production path) | 0.696 | 0.761 | 0.687 |
The npm package first published as 0.1.0; the 0.0.x entries below are development milestones.
[startSeq..endSeq], hits ≤5 text blocks apart; threshold measured on real index data — p50 same-topic gap 3, 61% ≤5). Coarse recall returns up to 3 events per session with the same token discipline (snippets only; full event text stays one detail browse away). v2 roadmap complete.node eval/run-golden.mjs.detail ±3 window costs ~300 tokens per session. Compaction anchor verified end-to-end: a real /compact injected the LLM summary + 3 key original fragments into the next assembly on a live instance, expiring automatically after 3 turns.recall returns a light coarse recall by default (titles + snippets, far fewer tokens), with a new detail parameter for the second stage (a session's hit list / the exact original-text window via readEvent / paged browsing); description rewritten so the agent recalls proactively (after compaction, when details are missing — no need for the user to ask), keeping the scope red line and invisible-presentation rules; compaction anchor — after a compaction, one lightweight anchor (LLM summary + key original fragments, expires after 3 turns) is injected automatically, with exact text always one drill-down away.dsh.bundle.patch wires the plugin row and enables full-text session search automatically), optional dsh-recall-models package for the 23.9MB embedding model (--omit=optional for a lightweight build), bilingual README + locale-aware UI.recall tool — official FTS5 full-text search over every past session (including compacted history), grouped by session with a bounded context window; scope control (current session by default); invisible UI (Recalling… / Recall complete).v1 · Done — Three-layer hybrid retrieval: official FTS5 literal / self-built trigram+bigram fuzzy / local bge embedding semantic; coverage gate, background warm-up, silent degradation chain.
v2 · Retrieval control
compaction/summary, inject one lightweight anchor (summary + key fragments) automatically; the original text stays one drill-down away[startSeq..endSeq] events (threshold measured on real data: p50 same-topic gap = 3, 61% ≤ 5); the full event text stays one detail browse awayv3 · Memory organization
node .smoke-recall.mjs # unit + integration (mocked, no model needed) — 90+ assertions
node .smoke-semantic.mjs # real-model integration (requires models/ present)
Covers: tokenizer alignment (token-for-token against transformers.js), index increments, scoping, hybrid ranking, degradation, warm-up, event aggregation.
| File | Responsibility |
|---|---|
lib/index.js |
Tool registration, scope resolution, hybrid ranking, session & event aggregation, warm-up scheduling |
lib/fuzzy-index.js |
Self-built SQLite index (trigram FTS + bigram + vector table), zero npm dependencies |
lib/tokenizer.js |
BERT WordPiece tokenizer (pure JS, token-for-token aligned with the reference) |
lib/semantic.js |
Embedder: worker thread, batched embedding, lazy loading |
lib/embed-worker.js |
WASM inference + mask-aware mean pooling + L2 normalization inside the worker |
lib/vendor/ |
Vendored onnxruntime-web (0.8MB entry + 12MB wasm) + tokenizer.json |
models/ |
Merged single-file int8 model (23MB; split into an optional package at publish) |
lib/client.js |
Minimal ToolView ("Recalling…" / "Recall complete"), locale-aware zh/en |
dsh-recall — main package (code + vendored runtime + tokenizer)dsh-recall-models — optional dependency (23MB model); npm installs it by default; --omit=optional yields the lightweight build, which degrades silently when the model is absent@deepseek-ai/dsh-session-query(-sqlite), dsh-tools, dsh-session-persistenceMIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。