dsh-company-kb: DSH Local Folder Knowledge Base and Retrieval with Mixed Chinese-Language Support

Introduction

When drafting proposals, bids, or reviewing policies in DeepSeek Harness (DSH), the model often cannot access the company materials on your disk. Common workarounds include copying documents into the conversation or connecting to a cloud vector database; the former has limited context, while the latter requires uploading and a running service, and may not be optimized for Chinese text retrieval. Below is a community plugin, dsh-company-kb: it builds a read-only index of any local material directory and only searches when the user explicitly requests it within a conversation. The index is only synchronized when manually triggered. All search and preview operations are performed locally.

What Is This

dsh-company-kb (GitHub: wu81313-lab/dsh-company-kb) is maintained by wu81313-lab and categorized under “Memory” on SkillHub. It targets DSH 0.1.5 and above, using SQLite FTS5 for offline indexing, combining Chinese BM25, two-character combinations (bigram), and trigram substrings, with results merged via RRF. It includes a web panel, a company-kb skill, and five model tools (kb_search, kb_read, kb_list, kb_status, kb_session). The plugin is read-only for the directories you configure and will never write to the original folders.

Core Features

  1. Configure roots (multiple local directories supported) under “Settings → Plugins → Local Knowledge Base”.
  2. After manual synchronization, the plugin traverses files, extracts body text, and writes to index.sqlite under %USERPROFILE%\.dsh\local-kb\ (in the same directory as settings.json; on Linux, ~/.dsh/local-kb/).
  3. Search is fully offline: Chinese tokenized BM25 + CJK bigram + trigram → RRF, with no external services required.
  4. Explicit invocation gate (explicitOnly defaults to true): When not explicitly requested and no session switch is enabled, the search tool only returns a description and will not query the database. Explicit request methods include trigger words (such as “knowledge base”, “document database”, /kb, etc.), paths/filenames from the database appearing in messages, or the “Knowledge Base” toggle on the right side of the input box.

Document Extraction and Preview

  • Supports common text and Office formats (controlled by include / excludeDirs / excludeGlobs; non-matching files are recorded as metadata only).
  • .docx / .xlsx / .pptx files are parsed by the plugin into formatted HTML previews (Word retains headings/tables/images, Excel as table grids, PPT as page cards), without launching Office, converting to PDF, or writing temporary files.
  • Embedded images can undergo OCR (cached by sha1); text in architecture diagrams and screenshots can be indexed. OCR and legacy Office format (.doc/.xls, etc.) extraction depend on Windows optional capabilities; when missing, other formats are unaffected.
  • Within the panel, you can “Open with native application” or “Show in folder”; images and PDFs can be rendered directly in the panel.

Sync Model

  • No timer: The index only changes when the panel’s “Sync Now”/”Rebuild Index” is clicked, the user explicitly requests a sync, or the CLI node lib/cli.mjs index is run.
  • On startup, no disk scanning occurs—only schema and stat checks are performed, displaying “N files have changed since last index”—it will not silently rebuild.
  • Sync Now: Incremental extraction based on size and modification time; Rebuild Index: Clear the index and perform a full re-extraction (applicable after changing trigram, chunking, OCR limits, etc.). Both operations only affect the plugin’s index database, not the original files.

Web Panel and Tools

  • The “Local Knowledge Base” entry at the bottom of the sidebar provides: overview, sync, search (with type/time/directory filters), sync history, and re-extraction of failed files; the API uses the same-origin /company-kb-api/* (default: loopback only).
  • When the panel is unavailable, tools and indexing remain functional.
Tool Purpose
kb_search Hybrid search, can filter by dir / ext / days
kb_read Read extracted body text (paginated); open:true opens the original file with the default system application
kb_list Browse directories
kb_status Status and failure list; action=now/rebuild for manual sync
kb_session Per-session search toggle on/off/status

Installation and Activation

Environment requirements: DSH 0.1.5+, Node.js ^22.19.0 || >=24.0.0 (see package.json engines).

Install from GitHub (original command):

dsh plugin --profile <your profile> add github:wu81313-lab/dsh-company-kb

Alternatively, clone to the profile’s plugins/ directory and install locally:

cd <DSH_HOME>/profiles/<your profile>
git clone https://github.com/wu81313-lab/dsh-company-kb.git plugins/dsh-company-kb
dsh plugin --profile <your profile> add ./plugins/dsh-company-kb

Verify the bundle is loaded:

dsh --profile <your profile> --dump-config | findstr company-kb

Restart the profile and refresh the page. Then fill in roots under “Settings → Plugins → Local Knowledge Base”, open the panel, and click “Sync Now” to complete the initial index build (the first run may take several minutes if OCR is included).

Uninstallation:

dsh plugin --profile <your profile> remove dsh-company-kb

Also remove the corresponding line from dsh.profile.bundles; you may optionally delete ~/.dsh/local-kb, but the original material directories remain unaffected.

Typical Usage

  1. After configuring roots, perform the initial index build: click “Sync Now” in the panel, or run:
node lib/cli.mjs index

(Execute the CLI within the plugin directory.)

  1. Explicitly request searches in conversations, for example:
  • Use the knowledge base to look up the clause requirements for XX policy
  • Draft a proposal for the XX project based on 模板/技术方案书模板.docx

Or enable the “Knowledge Base” toggle on the right side of the input box.

  1. After materials are updated, manually sync: use “Sync Now” in the panel, instruct “sync the knowledge base”, or run node lib/cli.mjs index again.

Without explicit requests and without enabling the toggle, the model will not actually search the database.

Common configuration items (written at runtime to ~/.dsh/local-kb/settings.json, hot-reloaded) include: roots, explicitOnly, triggers, trigram, ocrEmbeddedImages, autoSync (default 'off' for purely manual; 'watch' for event-driven incremental, still no timer), etc.; startup default values are defined in the plugin’s cordis.patch.yml.

Use Cases and Notes

Suitable for: Teams or individuals who need to reference local company/project materials in DSH conversations, want Chinese text search and Office preview to work offline, and can accept “manual sync + explicit request” workflows.

Notes:

  • The plugin reads disk with the current DSH process privileges; roots should only point to directories you authorize for indexing. Please review the GitHub repository source code and the MIT license before installation.
  • Large file parsing is limited by maxFileBytes (default 256MB); PDF/image OCR has additional page count and width limits.
  • Results may be temporarily reduced during index rebuilding; it is recommended to perform this during non-peak search hours; the operation can be aborted at any time and will resume on the next sync.

Conclusion

dsh-company-kb integrates “local material directory → Chinese hybrid search → on-demand citation” into a DSH plugin: manual sync, explicit gate, zero external search services, plus panel preview and OCR for embedded images. Community directory page: SkillHub - dsh-company-kb; source code and full documentation: github.com/wu81313-lab/dsh-company-kb.

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

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

Xiaoye