lawkb-ui: Article-level Retrieval and Legal Workbench for Local Legislation Corpus

Preface

When building legal agents or assistance tools within DSH, common practices include feeding regulation PDFs/Words to general RAG systems or relying on online legal article APIs. The former often only achieves “whole document” granularity, making it difficult to control validity levels, article number citations, and filtering dimensions; the latter involves data出境 (cross-border data transmission) and account dependencies. If you wish to keep your corpus entirely on your local machine, retrieve individual articles, and complete reading, document templating, and various AI assistance tasks within a single interface, the community plugin lawkb-ui (repository Iambatman1928/dsh-lawkb-ui) offers a “Client + Local Index” pathway. The following introduces what it is, what it can do, and how to install and import data.

What is this

lawkb-ui is a DSH client plugin for legal retrieval (Maintainer: Iambatman1928), positioned as a “Legal Knowledge Base Workbench.” It reads regulation .doc / .docx files from your machine, builds an article-level retrieval library, and provides three types of retrieval: keyword, statistical semantics, and vector semantics (with RRF fusion support). It features dual-dimension filtering, outline and article reading, a case name index, a civil cause-of-action tree, a document editor, and a suite of four AI tools: “Citation Verification / Contract Review / AI Analysis / AI Document Generation.”

The plugin declares itself as a Web client in package.json (dsh.client.platform: web), depends on the host Cordis (@deepseek-ai/cordis ^4.0.4), and requires Node.js ≥ 20 and DSH ≥ 0.1.0-rc.1 for the runtime environment. The license is MIT (© 2026 Iambatman1928). Community directory page: https://www.skillhub.cn/plugins/Iambatman1928/dsh-lawkb-ui; Source code and documentation: https://github.com/Iambatman1928/dsh-lawkb-ui.

Note: The README explicitly states that this plugin is a retrieval and writing assistance tool and does not constitute legal advice; AI-generated content must be independently reviewed by the user.

Core Functions

Local Corpus and Article-Level Indexing

  • Direct Local Corpus Reading: Parses .doc / .docx (Word binary / OOXML / pseudo-HTML / RTF, etc., via multi-strategy parsing), fully offline, with no external transmission of the corpus.
  • Article-Level Retrieval: Builds indices by chunking “one article / one paragraph”; substring matching is combined with validity level priors and scoring based on the number of hit articles.

Three Retrieval Modes and Fusion

  1. Keyword: Substring matching.
  2. Statistical Semantics: IDF, concept co-occurrence, and legal citation graphs.
  3. Vector Semantics: Local embedding model bge-small-zh-v1.5.

The results from all three paths can be fused via RRF (Reciprocal Rank Fusion), with sources labeled item by item. The first use of vector retrieval will automatically download the embedding model (approx. 23 MB, fetched from huggingface.co by default; if direct connection is unavailable, set HF_ENDPOINT=https://hf-mirror.com), and can be used offline thereafter.

Filtering, Index Trees, and Documents

  • Dual-Dimension Filtering: Validity level, enacting authority, currency (timeliness), publication year, data source, etc.; counts exclude the current dimension during filtering.
  • Knowledge Index Trees: Criminal Charge Tree (Criminal Law annotations + supplementary provisions), Civil Cause-of-Action Tree (Provisions on the Causes of Action in Civil Cases).
  • Document Editor: 9 document templates + common article library; pure template rendering (non-AI), where articles are fetched in real-time from the library’s currently valid original text.

The AI Suite (4 Tools)

Capability Description
Citation Verification Purely local
Contract Review Purely local rules
AI Analysis Retrieve first → Model relies solely on articles → Verify article numbers
AI Document Generation Model utilizes the host llm service

Installation and Activation

Execute the official installation command in your DSH environment:

dsh plugin add github:Iambatman1928/dsh-lawkb-ui

Restart DSH after installation is complete. The plugin injects Cordis patches via cordis.patch.yml, so no separate git clone of the repository is required.

Data Directory and Typical Usage

Data Persistence Location

Indexes, extraction caches, drafts, exports, etc., are stored by default in ~/lawkb/. The priority order is:

  1. config.dataRoot in cordis.patch.yml
  2. Environment variable LAWKB_DATA_ROOT
  3. Default ~/lawkb/

Data Import Process

After completing the installation steps above, the typical usage flow is:

  1. Register the corpus root directory (a directory containing .doc / .docx regulation files) in the plugin’s “Data Management”.
  2. Execute Data Import; index building runs in the background, and progress can be monitored.
  3. The vector index supports resumption from interruption.
  4. In the retrieval interface, use Keyword / Semantic / Vector or Fusion modes, combined with dual-dimension filtering to read articles; use the Document Editor or the AI Suite as needed (some capabilities require the host to have llm configured).

The README does not provide detailed step-by-step UI screenshots or API examples; actual operations should follow the client interface after installation and the repository README.

Use Cases and Precautions

Who is it for

  • Agent developers or legal tool builders working within the DSH ecosystem who require offline or local-first retrieval of Chinese legal norms and writing assistance.
  • Users with a large volume of Word-format regulation corpora who desire article-level hits and validity dimension filtering rather than whole-document chunks.

Runtime and Security

  • The plugin runs with the permissions of the current DSH process and can read/write to the registered corpus directories and ~/lawkb/ (or custom dataRoot). It is recommended to review the source code and the MIT license on GitHub before installation to ensure compliance with your requirements.
  • It is categorized as a client plugin; consistent with displays on community directories like SkillHub, the community directory is an independent site and has no official affiliation with DeepSeek / High-Flyer.
  • Do not treat plugin output as formal legal advice; manual review is required before involving external documents or decision-making.

Conclusion

lawkb-ui consolidates “Local Word Regulations → Article-Level Three-Path Retrieval → Reading / Templating / Local Rules + Host LLM Assistance” into a single DSH Web client plugin. It is suitable for users who prioritize data sovereignty (corpus staying on-machine) and retrieval granularity down to the article level. The current version is 0.1.0; repository star counts are subject to the GitHub page.

  • Community Directory: https://www.skillhub.cn/plugins/Iambatman1928/dsh-lawkb-ui
  • GitHub: https://github.com/Iambatman1928/dsh-lawkb-ui
羽毛球分组比赛记分
小程序二维码

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

Xiaoye