dsh-kb-lite: DSH Local Knowledge Base and Citation-Enabled Retrieval

Introduction

A common way to connect documents to a model in DeepSeek Harness (DSH) is to install a plugin with RAG capabilities, enabling the session to retrieve local materials and provide citations. Solutions like dsh-kb-rag already exist in the community. According to its plugin README, it fails to install on DSH 0.2.0-rc.2 due to client injection dependencies and peer version range issues. dsh-kb-lite (by maintainer imaused) takes a different approach: it provides Host-side tools only, with no client bundle and no browser UI. Indexing and retrieval are completed in a local directory, and BM25 works with just the Python standard library. The following sections introduce what it is, how to install it, and how to use its five tools.

What is this

dsh-kb-lite is a “memory”-type plugin for DSH: it ingests Markdown, plain text, and PDFs into a local index, retrieves snippets using BM25 or optional dense vectors, and passes citations to the model in forms such as path, heading, line numbers, or PDF page numbers. The engine does not listen on any ports and does not start a separate database service; a knowledge base corresponds to a directory (default ~/.kb-lite). The license is MIT, and the current package version is 0.1.0.

Compared to a full RAG stack, its scope is intentionally narrowed down: five tools, one index directory, and a BM25 path that can run on machines without torch.

Core Features

According to the README and package.json, the capabilities include:

  1. Five Host tools: kb_ingest (build index), kb_search (snippets with scores), kb_ask (returns original passages for citation within a character budget, no rewriting), kb_stats (document/chunk counts and partial path list), kb_clear (delete index).
  2. Input formats: .md, .markdown, .txt, .pdf. PDF requires pymupdf; if it is not installed, a single file will error out, but the remaining files in the same batch can still be indexed. Directory traversal skips hidden directories as well as .git, node_modules, .venv, __pycache__, etc.
  3. Incremental indexing: Skips unchanged files based on their sha256; force: true forces reparsing. There is a limit on max_files per call; exceeding it returns the remainder as pending, which will be continued in the next call.
  4. Retrieval modes: Pure Python BM25 (including CJK bigram tokenization); optional dense retrieval with sentence-transformers + default model BAAI/bge-small-zh-v1.5; hybrid uses reciprocal rank fusion to merge the two. The mode for kb_search can be auto, bm25, dense, or hybrid.
  5. No client fields: package.json does not contain dsh.client, only adding Host tools, avoiding the entire Web UI being broken by client API changes.

Installation and Activation

Run this in the environment where DSH is located (web can be replaced with your profile, e.g., desktop):

dsh plugin --profile web add dsh-kb-lite

Or install from GitHub:

dsh plugin --profile web add github:imaused/dsh-kb-lite

After installation, you must restart DSH and start a new session; tools are bound at session creation time, and already open sessions will not see the new tools.

Optional environment variables (set before starting DSH, not within a session):

Configuration Default Description
KB_LITE_PYTHON If unset, tries python, python3, py in order The Python interpreter to run the engine
KB_LITE_ROOT ~/.kb-lite The default knowledge base directory when kb_root is not passed
KB_LITE_MODEL BAAI/bge-small-zh-v1.5 The embedding model for dense retrieval

A single call can override the default directory via the kb_root parameter; the priority is: current kb_root > KB_LITE_ROOT > ~/.kb-lite.

Typical Usage

The README suggests explicitly writing out tool names and parameters in the conversation to facilitate stable triggering of calls.

1. Index a document directory

The paths for kb_ingest must be absolute paths; relative paths will not be resolved relative to the current working directory.

Ingest D:/docs into the knowledge base with kb_ingest: paths ["D:/docs"], recursive: true, max_files: 50.

The response will include added/updated/skipped, per-file errors, and pending when the limit is exceeded.

2. Q&A material with citations

Answer from the knowledge base with kb_ask: query "how does the retry policy back off", top_k: 5, max_chars: 6000. Quote the passages and cite path and line numbers.

3. Compare retrieval behavior using only BM25

Use kb_search with query "BM25 k1 b", top_k: 8, mode: "bm25".

4. View index overview

Run kb_stats and tell me the kb_root, document count, chunk count, whether dense is available, and the indexed paths.

5. Clear the experimental index

kb_clear will delete manifest.json, chunks.jsonl, and vector files under that kb_root, but will not delete source documents.

Use kb_clear with kb_root "D:/kb/scratch" and confirm: true.

Common defaults (README): recursive: true, max_files: 50 (1–500), with_embeddings: "auto". For kb_search, top_k defaults to 8; for kb_ask, it defaults to 5, and max_chars defaults to 6000.

Use Cases and Notes

It is suitable for developers who need to build local offline libraries on a DSH 0.2.0-rc.x type Host and want citations to land on file and line numbers/page numbers. If only keyword retrieval is needed, sentence-transformers can be omitted; for dense or hybrid modes, dependencies must be installed before ingestion, and a re-ingestion with force: true for old indexes or a kb_clear is required first.

DSH plugins run with the permissions of the current dsh process; kb_ingest can read any path the process can access. It is recommended to read the source code and MIT license on GitHub before installation to ensure it meets your security and compliance requirements. The community directory skillhub.cn is an independent site and has no official affiliation with DeepSeek / High-Flyer.

If a version of dsh-kb-rag targeting 0.2.x without injecting dsh-client-runtime appears in the future, its functionality will significantly overlap with the plugin in this article; when choosing, you can compare dependencies and peer ranges, without sticking to a single plugin.

Conclusion

dsh-kb-lite uses five Host tools to bring “ingestion—retrieval—citable original text—statistics—clearing” into a local directory. BM25 works with zero extra dependencies, and dense and hybrid modes can be added when needed. Directory page: https://www.skillhub.cn/plugins/imaused/dsh-kb-lite; Source code and full documentation: https://github.com/imaused/dsh-kb-lite.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye