Introduction¶
Building a long-term knowledge base in DSH typically requires setting up indexing, handling file parsing, and wiring together vector retrieval and Q&A pipelines. This kind of repeated construction carries a non-trivial maintenance cost. The dsh-kb plugin introduced below provides local knowledge-base capabilities directly within DSH: mount a reports directory and you get browsing, hybrid search, cited answers, a knowledge graph, and LLM-generated wiki entries in the sidebar.
What It Is¶
dsh-kb is a DSH plugin maintained by frankfurtlin, categorized as “Memory.” It scans HTML reports (or ingests files in various formats) to build a local SQLite index, then combines a local embedding model with the host LLM to provide hybrid retrieval, Q&A, classification, graph, and wiki generation capabilities.
Core Capabilities¶
- Scanning & Indexing: Scans
reports/YYYYMMDD/xxx.html, extracting title, category, series, and date; caches summaries and full text (up to 20,000 characters). - AI Enhancement: Auto-generates summaries, key points, entities, and tags; supports backfilling background summaries, classification, and wiki article generation.
- Local Embedding: Uses bge-small-zh-v1.5 (512 dimensions) for semantic retrieval; supports configurable local model directories and HF cache.
- Hybrid Search: Keyword hits take priority, followed by semantic ranking; supports multi-dimensional organization via view/category/series/date/keyword/semantic/Q&A/summary.
- Knowledge Graph: Abstracts topics or entities from reports into graph nodes; supports graph nodes participating in retrieval.
- Wiki Generation: Based on indexed content, lets the LLM auto-generate readable wiki articles.
- Ingestion: Supports HTML, Markdown, TXT, PDF, Word, Excel, PPT, images, audio, and video; audio and video can be transcribed locally into searchable text.
- Security & Storage: Files exceeding 10 MB are AES-256-GCM encrypted before being stored in COS; smaller files are stored in a local Blob store via content addressing and synchronously encrypted to COS.
- Sidebar Integration: A “Knowledge Base” row appears in the DSH sidebar, supporting keyboard navigation, favorites, a detail drawer, and source document links.
Installation & Setup¶
- Clone the repository to the designated path (example uses
/opt/dsh/dsh-kb):
sudo git clone https://github.com/frankfurtlin/dsh-kb /opt/dsh/dsh-kb
cd /opt/dsh/dsh-kb
- Create a virtual environment and install dependencies:
/usr/bin/python3.11 -m venv .venv
.venv/bin/pip install -r server/requirements.txt
- Copy the systemd unit file and enable the service:
sudo cp deploy/systemd/dsh-kb.service.example /etc/systemd/system/dsh-kb.service
sudo systemctl daemon-reload
sudo systemctl enable --now dsh-kb
curl -s http://127.0.0.1:8816/healthz
- Configure environment variables (recommended in
server/.env.localwith chmod 600), then mount via the plugin manager:
plugin_manager action=install_bundle target=<path-to-your-checkout>
After refreshing the DSH page, a “Knowledge Base” row will appear in the sidebar. The host forwards /kb/* to 127.0.0.1:8816 via a reverse proxy.
Typical Usage¶
- Open the Knowledge Base panel in the DSH sidebar; by default it displays the report list.
- Press
⌘KorCtrl+Kto focus the search box, type a keyword (e.g., “fund flow”), and press Enter to execute hybrid search:
- Keyword hits take priority, followed by semantic ranking.
- Results include report cards and graph nodes (e.g.,topic-fund-flow). - Use
kb_askto ask questions in conversation (within a DSH session):
- Example:kb_ask(question: "What changes in fund flow this week?")
- Returns cited answers with references mapped to specific reports. - Navigate using sidebar shortcuts:
J/Kto move through the list,OorEnterto open a report,Sto mark as favorite,Escto close the detail drawer,?to view help. - Batch process from the server directory using Python CLI:
- Generate summaries:../.venv/bin/python -m app.cli_enrich --limit 20
- AI classification:../.venv/bin/python -m app.cli_classify --limit 20
- Generate wiki:../.venv/bin/python -m app.cli_wiki --limit 5
- Retrieval evaluation:../.venv/bin/python -m app.cli_eval - Probe backend status via API:
curl -s 'http://127.0.0.1:8816/api/kb/search?q=fund-flow&mode=auto&limit=3'
curl -s -X POST http://127.0.0.1:8816/api/kb/ask -H 'Content-Type: application/json' \
-d '{"question":"What changes in fund flow this week?"}'
Use Cases & Notes¶
Ideal for DSH users who need to maintain a long-term internal knowledge base, report library, or document repository. It is recommended to review the source code and license (MIT) before installation, and to confirm that the local Python 3.11 environment and dependencies meet the requirements. The plugin runs with the current DSH process permissions; configuration changes require a reload or restart of the service. All write operations ultimately target a single SQLite index, and index rebuilds automatically sync derived data such as summaries, tags, embeddings, graph, and wiki entries.
Summary¶
dsh-kb consolidates the local knowledge-base build and retrieval pipeline into a DSH plugin. Through hybrid search, knowledge graph, and wiki generation, it enables agents to answer report-library-based questions more naturally. To view the directory page and source code, visit:
- Skill directory: https://www.skillhub.cn/plugins/frankfurtlin/dsh-kb
- GitHub: https://github.com/frankfurtlin/dsh-kb