dsh-kb: Citation-Based Q&A with Local Documents in DeepSeek Harness

Introduction

When working with agents or daily conversations in DeepSeek Harness (DSH), the model defaults to relying only on content within the context window. To keep team handbooks, technical notes, and PDF specifications “persistently available” in the sidebar for随时 access, common practices involve attaching an external vector database service or manually copying and pasting snippets. dsh-kb, maintained by cherub0, takes a different approach: as a local knowledge base plugin for DSH, the left sidebar provides a dialog box for paragraph-level retrieval of your own Markdown, PDF, Word, and other folders. It then instructs the model to answer based solely on the matched paragraphs and lists expandable sources at the bottom of the response. Categorically, it belongs to the “Memory” category in the DSH plugin directory; currently has 0 GitHub stars, MIT license, version 1.0.0.

The following introduces positioning, capabilities, installation, usage, and limitations, with facts based on the GitHub repository README.

What is this

dsh-kb is a local knowledge base plugin for DeepSeek Harness. After you point to (or import via inbox) a directory filled with documents, the plugin chunks and vectorizes them locally. You can get organized answers to natural language questions instead of a list of links. The data flow can be summarized as:

Question ──> Paragraph Retrieval (Vector + Keyword + MMR) ──> Model Synthesis ──> Answer with (Source N) citations

The maintainer is cherub0; the plugin is distributed on the SkillHub directory and github.com/cherub0/dsh-kb. The community directory is an independent site with no official affiliation to DeepSeek / Huafan; the DSH ecosystem philosophy is “everything is a plugin”. Before installing, it is advisable to view the source code and license yourself and be aware that the plugin runs with the current dsh process permissions.

Core Features

  1. Sidebar dialog, not just a search box. Ask in natural language, get a comprehensive answer; each answer lists citations, which can be clicked to see the matched snippet and file path.
  2. Agent Tools. Registers kb_search, kb_ask, kb_rebuild. The Agent can query the database directly during a conversation without switching panels.
  3. Document Import. Place files in the knowledge base inbox/, or rebuild the index via the panel; supports PDF, DOCX, TXT, MD, and common source code. After import, files are moved to inbox/done/, and notes fall into notes/import/.
  4. Incremental Indexing. Vectors are cached by paragraph hash; adding a new document usually only requires embedding the chunks of that document (seconds, not minutes for the whole library).
  5. Source Filtering. Three source types (fav, chat, import) are separated; you can limit to one type when asking.
  6. Web Article Import. You can use fetch_urls.py to pull the body of WeChat Official Accounts or web pages into the library (see commands below).

On the retrieval side: notes are cut into ~700-word paragraphs with adjacent overlaps of 120 words; the embedding model is BAAI/bge-small-zh-v1.5 (first launch ~95 MB, CPU); during queries, cosine similarity is combined with lexical weighting, MMR (λ = 0.72) is used for deduplication, retaining a maximum of 2 paragraphs per document, which are then concatenated with the context and handed to the model.

The local HTTP service also provides interfaces like GET /search, POST /ask, POST /rebuild, making it easy to interface with other tools (default port 8765).

Dependencies and Environment

  • DeepSeek Harness 0.2.x
  • Python 3.10+, requires sentence-transformers, numpy, requests, pyyaml; PDF/DOCX optional with pypdf, python-docx
  • DeepSeek API key: Write to refs.DEEPSEEK_API_KEY in ~/.dsh/.credentials.yaml, or environment variable DEEPSEEK_API_KEY

Python dependency installation example:

pip install sentence-transformers numpy requests pyyaml

Installation and Activation

Under the target profile, add using the absolute path of the local plugin directory (do not concatenate github:owner/repo installation commands based on the repository name yourself; refer to the original README):

# Execute under the profile where you want to install it
dsh plugin --profile <profile> add /absolute/path/to/dsh-kb

You can also install using the directory path in DSH’s “Plugin Market / Plugin Manager”.

Upon first activation, the plugin creates ~/.dsh/kb, copies the Python service, and starts it on 127.0.0.1:8765. The Knowledge Base panel appears in the left sidebar.

Optional configuration for the plugin (or environment variable DSH_KB_DIR to override the knowledge base directory):

Field Default Meaning
kbDir ~/.dsh/kb Directory for notes, index, and inbox
port 8765 Local service port
python Auto-detect Python interpreter path
script <kbDir>/server.py Service entry point override

Environment variable KB_CHAT_MODEL defaults to deepseek-reasoner, which can be changed to deepseek-chat for faster speed and lower cost.

Typical Usage

Adding files to the knowledge base

  1. Place PDFs, DOCXs, TXTs, MDs, source code, etc. into ~/.dsh/kb/inbox/.
  2. Click Rebuild Index in the top right corner of the panel (or let the Agent call kb_rebuild).
  3. After import, files are moved to inbox/done/, and notes are in ~/.dsh/kb/notes/import/.

Fetching web articles

Execute the script provided in the README in the knowledge base directory, then rebuild the index. Each import result is a Markdown with frontmatter (title, date, kind, url), and notes can also be written manually.

cd ~/.dsh/kb
python fetch_urls.py https://mp.weixin.qq.com/s/xxxx https://example.com/post

Asking questions in the panel or Agent

You can ask in natural language within the panel. If you need to call it in an automated workflow, you can send requests to the local service, for example, for paragraph retrieval:

GET /search?q=…&k=8&kind=fav,chat

Q&A with history and citations:

POST /ask
{"q","history","kind"}

Applicable Scenarios and Notes

More suitable for: Local document Q&A for individuals or small teams (specifications, notes, imported web archives); needing to chat and check while browsing the DSH left sidebar and hoping answers include verifiable sources; hoping to let Agents retrieve from the same library mid-process using kb_* tools.

Limitations to accept (explicitly stated in README):

  • Retrieval quality is constrained by bge-small-zh-v1.5; very long documents spanning multiple chapters may not be fully captured.
  • Intentionally avoids knowledge graphs, re-ranking, and multiple concurrent databases; only a single local library.
  • PDFs without text-layer scanning will be skipped.
  • When using deepseek-reasoner, a single answer typically takes about 15–40 seconds, primarily determined by the model’s processing time.

Please check the repository source code and MIT license before installing and using; the plugin starts a service locally and reads/writes to ~/.dsh/kb, with permissions consistent with the current DSH process.

Conclusion

dsh-kb brings “local folder + paragraph retrieval + RAG with citations” into the DSH left sidebar and Agent tools, suitable for turning existing documents into conversational, traceable knowledge sources. For more details and screenshots, see GitHub: cherub0/dsh-kb, directory page: SkillHub — cherub0/dsh-kb.

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

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

Xiaoye