Introduction

In DeepSeek Harness (DSH), there are two common approaches to supplementing local knowledge for dialogue models: either concatenating fixed retrieval results into every round of prompt, or calling a remote embedding API. The former easily introduces context irrelevant to the current question, while the latter introduces network dependencies and external services. The approach of mindspace-dsh-local-rag explicitly treats retrieval as a tool: the model only calls search_local_memory to retrieve local corpus when the current dialogue and the latest user request are insufficient.

What is it

mindspace-dsh-local-rag is an independent, locally running hybrid RAG plugin maintained by Spirtxiaoqi7, designed for DeepSeek Harness. It exposes a clear search_local_memory tool to the tool-type dialogue model, rather than injecting retrieval results into every round of dialogue. The plugin is under the MIT license and does not rely on remote embedding APIs; internet access is only used to download fixed model artifacts.

It is not bound to mindspace-dsh-session-memory and can be installed or removed independently.

Core Features

Explicit Model Invocation

The plugin registers a search_local_memory tool, allowing the model to decide whether retrieval is needed based on the current context. It does not modify the chat provider, nor does it automatically fill the prompt with retrieval results.

Hybrid Retrieval

The plugin simultaneously uses vector similarity and BM25 lexical retrieval, fusing the results using reciprocal-rank fusion. The retrieval adopts a child-hit/parent-return pattern and retains a fixed candidate limit. When the vector runtime environment is unavailable, lexical results can still be used.

Two Types of Local Corpus

The plugin manages two types of corpus:

  • Knowledge files uploaded by the user;
  • Native DSH compaction summaries isolated by session.

File types that support chunked ingestion include PDF, DOCX, TSV, CSV, TXT, Markdown, JSON, and HTML.

Corpus Management

Both types of corpus support viewing the body, editing, logical deletion, and version rollback.

Local Model Lifecycle

The plugin supports local model downloading, integrity verification, starting, stopping, and automatic persistence on startup. The download source first attempts ModelScope, then attempts Hugging Face. The built-in verified models are:

shibing624/text2vec-base-chinese

Specification: ONNX, 768 dimensions, approximately 407 MB.

Downloading, integrity verification, starting, stopping, and auto-starting are independent operations. By default, starting does not load the ONNX model; you need to explicitly start the model.

Installation and Enablement

The runtime environment requires Node.js 22.19+ or 24+, pnpm, and a local DeepSeek Harness checkout.

The following process first builds a tarball in the plugin repository, then returns to the official Harness checkout root directory to install it into the web profile. Please replace the paths with your actual paths.

git clone https://github.com/Spirtxiaoqi7/mindspace-dsh-local-rag.git
Set-Location .\mindspace-dsh-local-rag
corepack pnpm install
corepack pnpm run build
corepack pnpm pack --pack-destination dist
$ragTgz = (Get-ChildItem .\dist\mindspace-dsh-local-rag-*.tgz | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName

Set-Location C:\path\to\deepseek-harness
corepack pnpm dsh plugin --profile web add $ragTgz
corepack pnpm dsh --profile web --dump-config
corepack pnpm dsh web

Note: Do not run pnpm dsh inside the plugin directory; this command belongs to the official Harness checkout.

After installation, open the Settings → Local RAG page to upload files and perform lexical retrieval. You can use lexical retrieval even if the embedding model has not started yet.

Typical Usage

  1. Upload knowledge files: In Settings → Local RAG, upload PDF, DOCX, TSV, CSV, TXT, Markdown, JSON, or HTML files.
  2. Start the local model: If you need to use vector retrieval, perform downloading, verification, and starting according to the model lifecycle provided by the plugin. ONNX is not loaded by default on startup and needs to be explicitly started.
  3. Model retrieval: The model calls search_local_memory when it judges that the current dialogue and the latest user request are insufficient. The first retrieval only needs to provide query and scope; if documentId or sourceId is returned, it can be used for subsequent retrieval from the same source.
  4. Manage corpus: In the settings page, view the body, edit content, logically delete, or roll back revision versions.

Applicable Scenarios and Notes

Suitable for the following situations:

  • Need to add local knowledge retrieval for DSH dialogue models;
  • Want the model to decide when to retrieve on its own, rather than injecting results into every round of prompt;
  • Need to retrieve both user-uploaded knowledge and session compaction summaries;
  • Want to avoid relying on remote embedding APIs, retaining only network access for downloading fixed model artifacts.

Pay attention to:

  • The plugin runs with the current DSH process permissions; check the source code, build scripts, and MIT license before installing;
  • Retrieved text should be treated as untrustworthy evidence and must not override current instructions;
  • This plugin is not mindspace-dsh-session-memory; they can be installed independently;
  • Internet access is only for downloading fixed model artifacts and does not imply the use of a remote embedding API.

Links

  • Directory page: https://www.skillhub.cn/plugins/Spirtxiaoqi7/mindspace-dsh-local-rag
  • GitHub: https://github.com/Spirtxiaoqi7/mindspace-dsh-local-rag