dsh-ai-wiki: A Read-Only BM25 Wiki Gateway for DeepSeek Harness

Introduction

When integrating a personal wiki into DeepSeek Harness (DSH), existing generic wiki plugins often fail to meet the requirements of specific templates. dsh-ai-wiki provides dedicated read-only access and BM25 search capabilities for vaults built with ai-wiki-template.

What Is This

dsh-ai-wiki is a DeepSeek Harness plugin that connects as a read-only BM25 gateway to vaults using ai-wiki-template. It implements full-text search via SQLite FTS5, with the index stored in the DSH cache directory and no Python environment required. The plugin is maintained by pravets, current version 0.1.2.

Problem Solved

Existing wiki plugins suffer from structural mismatches: @pananfly/dsh-llm-wiki uses a different structure and indexing approach, with no support for that template’s zones, .llm-* markers, or BM25 weights; dsh-wiki-notes provides generic Markdown access but uses keyword/recall search rather than the BM25 contract, and lacks ACL, zones, and raw corpus; dsh-wiki-rag relies on embeddings instead of BM25; dsh-AIkb and dsh-knowledge-graph focus on ingestion/graph rather than reading wikis built with that template. dsh-ai-wiki replicates the template’s contract through a lightweight implementation (~5 MB), avoiding Python dependencies.

Core Features

The plugin provides six tools prefixed with aiwiki_:

  1. aiwiki_search: BM25 search with weights name=5, tags/aliases=3, headings=2, kw=2, body=1; supports similarTo; can filter by corpus (wiki/chats/raw).
  2. aiwiki_read: Reads frontmatter, body, or a specified section/line range; displays ACL permissions, outgoing links, and backlinks.
  3. aiwiki_list: Catalogs and aggregates by zone/type/tag/status/date.
  4. aiwiki_links: Lists outgoing links, backlinks, unresolved, and ambiguous wiki links.
  5. aiwiki_status: Checks viki/zone/ACL; shows counts, freshness, index size, generated index/hub, latest log.md entry, and warnings.
  6. aiwiki_lint: A read-only implementation of lint_frontmatter.py, with support for lint-baseline.json.

The plugin also includes system prompts and a guard that rejects write/edit/str_replace_editor/apply_patch operations on viki paths.

Installation and Enablement

The plugin requires Node.js 22.13+ (Node 24 recommended) and DSH 0.2.2-rc.5. Install from the plugin directory:

dsh plugin --profile web add C:\git\dsh-ai-wiki

After publishing, you can use:

dsh plugin --profile web add dsh-ai-wiki

Open a new session for it to take effect. Configuration is re-read on each invocation, so no DSH restart is needed.

Typical Usage

aiwiki_search query="индексы postgres" limit=5
aiwiki_search query="контекст агента" type=concept
aiwiki_search similarTo="10-wiki/1c-postgres-indexes"
aiwiki_read path="10-wiki/1c-postgres-indexes" section="Индексы"
aiwiki_read path="01-raw/2026-10-08-1c-postgres-indexes-transcript" offset=1 limit=80
aiwiki_list type=repo status=active groupBy=role
aiwiki_links path="10-wiki/1c-postgres-indexes"
aiwiki_status rebuild=true
aiwiki_lint limit=20

Configuration

Configure in %USERPROFILE%.dsh\dsh-wiki.json:

{
  "vaults": [
    { "name": "vault", "path": "C:\\git\\vault", "includeRaw": true }
  ],
  "indexDir": "~/.dsh/cache/dsh-ai-wiki",
  "autoIndex": true,
  "promptSection": true,
  "guardWrites": true
}

You can also simplify to “vaults”: [“C:\git\vault”]. A .dsh-wiki.json in the project directory overrides user configuration; setting enabled:false disables that viki. The DSH_WIKI_ROOTS and DSH_WIKI_INDEX_DIR environment variables also take effect. If the session is within a viki (AGENTS.md + zones or .llm-*), the plugin will auto-detect it.

Search Mechanism

The index is a standalone SQLite database in indexDir, named after the viki path hash. The first search builds the index; subsequent searches only update pages with changed mtime and size. For a full rebuild: aiwiki_status rebuild=true.

Tokenization follows 90-meta/scripts/wiki_search.py: lowercasing, [а-яёa-z0-9]+, and Snowball Stemmer for Russian/Latin/digits. Queries are AND/OR combinations of “term”*; raw is excluded by default; corpus=”raw” or “all” includes transcripts. similarTo extracts up to 40 unique words whose body length exceeds 4 characters.

Permissions and Read-Only

Template contract: absence of .llm-* markers means read-only; root directory is read-only; llm:ro in frontmatter overrides an rw zone. aiwiki_read displays permissions, and the guard rejects write/edit/str_replace_editor/apply_patch on configured viki paths. The guard does not parse arbitrary shell commands; sandbox and AGENTS.md rules apply to in-session paths. The plugin only writes to indexDir and does not create .wiki-index within the viki.

Diagnostics

  • VAULT_NOT_CONFIGURED: dsh-wiki.json is missing and the session is not within a viki; a path must be added.
  • INDEX_UNAVAILABLE: Node < 22.13 or FTS5 was not available at compile time; check node -v and node -e “require(‘node:sqlite’)”.
  • INDEX_STALE: autoIndex=false and the index does not exist; call aiwiki_status rebuild=true.
  • Empty search results: check corpus (raw requires explicit inclusion) and filters; use grep for exact string matching.
  • Stale index after manual edits: aiwiki_search auto-updates; use aiwiki_status if unsure.

Development and Limitations

Development uses node:test; test helpers are in tests/helpers.mjs; real vaults are opt-in. CI runs on GitHub Actions: tests, syntax checks, packaging, and publishing. Versions 0.1.0/0.1.1/0.1.2 have been published to npm; latest is 0.1.2.

The current version is read-only. Write/ingest, editing index.md/log.md, UI panels, slash commands, and ambient recall are not supported. ACL-aware append/create can be added in future phases.

Use Cases and Caveats

Suitable for developers who have built vaults with ai-wiki-template and need BM25 search, ACL checks, and frontmatter lint. The plugin runs with the permissions of the current DSH process; review the source code and license (MIT) before installing.

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

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

Xiaoye