kiwix-wiki: Enabling Offline Wikipedia Query for DSH Agent

Preface

When running Agents in DSH, fact retrieval often relies on web_search or web_fetch: it requires external network access, may be subject to ranking and summary quality, and is completely unavailable in internal networks or isolated environments. If you want the model to query encyclopedia entries where answers come from local disk-stored data that is reproducible and verifiable, you need a channel that bypasses search engines.

Below is an introduction to the community plugin kiwix-wiki (npm package name dsh-kiwix-wiki, maintained by MingShi350). It reads pre-downloaded ZIM snapshots via kiwix-serve running on the local machine or LAN, and registers three tools for the Agent: wiki_search, wiki_read, and wiki_books. It does not scrape web pages, requires no API keys, and generates no traffic directed towards public internet search. When online, it serves as a supplement to online tools, not a replacement.

What is this

kiwix-wiki is a DSH Host plugin: all queries are sent only to the baseUrl you specify in the configuration (default http://127.0.0.1:8090), and data comes from ZIM files mounted by kiwix-serve. The plugin itself does not contain encyclopedia data; you need to deploy kiwix-serve and download ZIMs yourself (e.g., from download.kiwix.org or library.kiwix.org).

Compared to real-time web search, there are two points to keep in mind:

  • The content is a snapshot of the ZIM, valid up to the dump date; recent events cannot be found, and updates require switching to a newer ZIM version.
  • When switching ZIM versions, if defaultBook uses an alias (e.g., zh) or a series name without a date, the plugin will track the latest dump of the same series, generally requiring no configuration changes.

Current version (from package.json): 1.4.1, License MIT, requires Node >= 20 to run.

Core Features: Three Model Tools

Tool Function Key Parameters
wiki_search Full-text search (summary snippets & total count) or exact title search (mode=title) query, mode, book, limit, offset
wiki_read Read full article by exact title (plain text, auto-truncated) title, book, maxChars
wiki_books List local ZIM library (name/language/article count/has full-text index) language, query

The default book points to Chinese Wikipedia (built-in default alias zh, can be changed to the exact filename of a local ZIM). book supports exact ZIM names, aliases (zh / en / medicine / simple), series names without dates, or book name substrings. If an explicit book with a date is passed but the file no longer exists on the server, the plugin will error and list available libraries; for defaultBook in the config, if an exact name is not found, it falls back to the latest dump in the same series and includes a note in the result explaining this.

In terms of implementation, the plugin has zero npm dependencies, using only Node built-ins node:http / node:https to access kiwix-serve.

Prerequisites

Before installing the plugin, prepare these two things:

  1. kiwix-serve: The official Docker image ghcr.io/kiwix/kiwix-serve, or official kiwix-tools binaries.
  2. ZIM Files: Download and place them in the kiwix-serve service directory.

The repository provides examples/docker-compose.yml (official image + local ZIM directory) and docs/quickstart.md to help you start a service from scratch, select ZIMs, modify baseUrl, and troubleshoot.

Installation and Activation

To install into DSH (web profile), use one of the following methods. Commands are from the project README:

# Method 1: Install from npm (Easiest)
dsh plugin --profile web add dsh-kiwix-wiki

# Method 2: Install from local directory (Source code or cloned repo)
dsh plugin --profile web add /path/to/kiwix-wiki

dsh web        # Host plugin changes must be followed by a restart to take effect

You can also add "dsh-kiwix-wiki": "link:/path/to/kiwix-wiki" to the profile’s package.json and then run dsh web.

Configuration

The configuration block key is Config. All fields can be omitted to use default values. A typical configuration looks like this:

config:
  baseUrl: http://127.0.0.1:8090   # kiwix-serve address
  defaultBook: zh                  # Recommended alias, auto-tracks the latest ZIM version
  timeoutMs: 15000
  maxTextChars: 24000
  catalogTtlMs: 60000              # Library catalog cache; lower it to discover new ZIMs faster

To point baseUrl to a LAN or remote kiwix-serve, simply change this key. It is recommended to write to $DSH_HOME/profiles/<profile>/cordis.patch.yml; or use a patch file: dsh web --patch examples/kiwix-wiki.patch.yml. For complete examples, see section 5 of the repo’s docs/quickstart.md and examples/kiwix-wiki.patch.yml. If the address is unreachable, the error will directly point out the baseUrl.

Typical Usage (Agent Side)

The Agent calls tools as needed during conversation; no additional HTTP interface is required:

  1. Use wiki_books to confirm which ZIMs, languages, and full-text index statuses are available on the current kiwix-serve.
  2. Use wiki_search to find entries by keyword or title (mode=title), specifying book, limit, offset if necessary.
  3. Use wiki_read to retrieve body text by exact title, using maxChars to control the return length limit (working in conjunction with the global maxTextChars).

Integration tests connect to http://127.0.0.1:8090 by default; if kiwix-serve is not running locally, integration tests will be automatically skipped. Developers can run the following in the plugin directory:

npm test

The environment variable KIWIX_TEST_URL can point to other kiwix-serve addresses.

Use Cases and Notes

Suitable for: Intranets, air-gapped environments, weak networks, or locations without stable external network exits; supplementing verifiable encyclopedia facts for local small models; when retrieval content must not leave the network; when answers need to be consistent with the original ZIM text to reduce “search summary drift”.

Notes:

  • It is not real-time news; timeliness is subject to the ZIM dump.
  • The plugin runs with the DSH Host process, with permissions consistent with the current dsh web user; please read the GitHub source code and the MIT license before installation, and assess the copyright statements of the ZIM data sources yourself (see the License and Acknowledgments section in the repo’s docs/quickstart.md). This project is not affiliated with the Wikimedia Foundation or Kiwix/openZIM.
  • The DSH community plugin directory is an independent site skillhub.cn, with no official affiliation with DeepSeek or High-Flyer.

Conclusion

kiwix-wiki encapsulates “Local kiwix-serve + ZIM” into three encyclopedia tools callable by the Agent. In environments where public internet retrieval is impossible or undesired, it still provides the model with an offline, verifiable fact channel. Directory page: skillhub.cn/plugins/MingShi350/kiwix-wiki; Source code and docs: github.com/MingShi350/kiwix-wiki.

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

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

Xiaoye