跳过主要内容
S

dsh-hsh64

sauomore/dsh-hsh64

让被压缩的历史可以按语义找回来:接管上下文压缩,把被遮蔽的原文编码成本机 64 位词指纹索引,再通过三个工具依次检索候选词、定位字符偏移、截取原句;不依赖 seq 指针、不额外调用模型,官方摘要保持不变。

安装

dsh plugin --profile web add github:sauomore/dsh-hsh64

README

dsh-hsh64

简体中文 · English

NPM Version NPM Downloads GitHub stars License dshfind

Keep what compaction throws away — a local context index plugin for DeepSeek Harness.

Listed in — dshfind · Memory & Context.

When a long conversation grows past the context budget, earlier history is compacted into a summary. The summary keeps the gist and loses the details: the exact wording, the numbers, the original sentence are gone.

dsh-hsh64 takes over compaction and, in the same pass, encodes the compacted original text into a local index. The conversation gains one line of pointer text (~60 characters); the original stays on your disk. When the agent needs detail, three tools walk back by meaning: search candidate words, locate the offset, extract the sentence.

A 1.5 KB Chinese passage becomes roughly 2.5 KB of index. That is exactly why the index never enters the conversation — the conversation gets a pointer, the index stays on disk.


What it does

  • Takes over compaction — the summary still comes from the official implementation, so its quality is unchanged. This plugin adds one step: encode the region, write it to the local index, append a one-line pointer.
  • One switch, two clear states — Enabled means this plugin owns compaction; Disabled hands compaction back to the official implementation. Switching is immediate, and every switch runs one threshold check so leaving the plugin on after a long session cannot strand an over-budget context.
  • Three-stage retrieval — hsh_search returns candidate words only (cheap), hsh_locate returns character offsets for an exact word, hsh_extract returns text under a rule you choose.
  • Sidebar panel — “Context Keeper” lists conversations grouped by workspace and can compact any of them in place; settings changed there take effect immediately.
  • Optional reranking — fingerprint retrieval only measures word-level similarity. Attach a CrossEncoder to rescore query × passage pairs when accuracy matters.
  • Semantic model discovery — no hand-written paths: it scans common locations, picks a usable model, and shows you which one is in use.
  • Local only — index and encoder cache live on your disk and are never uploaded. Clearing removes only this conversation's index.

Install

From the desktop or web app

Search for dsh-hsh64 in the Add plugin wizard and click Install.

With the dsh CLI

dsh plugin --profile desktop add dsh-hsh64

Update later:

dsh plugin --profile desktop update dsh-hsh64@latest

From source

git clone git@github.com:Sauomore/dsh-hsh64.git
cd dsh-hsh64
npm install
dsh plugin --profile desktop add /absolute/path/to/dsh-hsh64

One required step after installing

The settings page can only write configuration for a plugin that has an explicit row in the profile's cordis.patch.yml. Append this to ~/.dsh/profiles/desktop/cordis.patch.yml:

- id: hsh64
  name: dsh-hsh64
  config:
    mode: hsh

id must match the plugin's own row id (hsh64). This is not specific to this plugin — the settings service resolves entries through the profile patch document only.

See docs/getting-started.md for the full walkthrough.


Quick start

  1. Install, then restart DeepSeek Harness.
  2. Open Context Keeper in the left sidebar and confirm the plugin is Enabled.
  3. Chat normally. When history grows past the threshold it is compacted and indexed automatically.
  4. To try it now: press Compact & index on any row, or run /hsh-encode.
  5. Ask about earlier content — the agent runs hsh_search, then hsh_locate, then hsh_extract.

Documentation

DocumentContents
Getting startedInstall, profile row, first compaction, verifying it worked
ConfigurationEvery setting, defaults, recommendations, model discovery, reranking
Tools and commandsAll eight tools and four slash commands, with parameters and examples
ArchitectureEncoding, index layout, compaction takeover, sidecar protocol, data locations
TroubleshootingKnown errors and what actually causes them

Chinese versions use the *.zh.md suffix, for example 中文文档.


Requirements

  • DeepSeek Harness 0.2.0 or newer
  • Python 3.10+ with numpy, scikit-learn, jieba, sentence-transformers
  • A local sentence-transformers embedding model (auto-discovered; see Configuration)

License

MIT

相关插件