dsh-maibot-plugin-writer: Writing DSH Plugins Based on Local MaiBot Protocols

Preface

When writing plugins for MaiBot in DeepSeek Harness (DSH), the difficulty often isn’t in “whether you can write Python”, but in whether the contract aligns with the current host: _manifest.json fields are strict, capability whitelists must match actual code calls, and SDK method names change across versions. Writing based on model memory commonly results in manifest validation failures, runtime “unauthorized capability” errors, or incorrect EventHandler message field access.

dsh-maibot-plugin-writer is a community-maintained DSH workflow plugin (cordis bundle) that registers 5 maibot_* tools with the agent, and ships the skill maibot-plugin-writer with the package. The capability whitelist and ctx.* method table are read from the locally running MaiBot source code and the installed maibot_sdk, rather than fetching documentation online or guessing APIs from memory. Maintainer: Lgv-H; Repository: GitHub, community directory page: SkillHub. MIT licensed, current package version 0.1.0.

What Is This

In one sentence: it lets DSH itself complete the closed loop of MaiBot plugin development: “query contract → generate the trio → static validation to 0 errors → install to plugins/”.

Layer Content
Tools maibot_plugin_catalog, maibot_sdk_reference, maibot_plugin_scaffold, maibot_plugin_validate, maibot_plugin_install
Skill maibot-plugin-writer (distributed to <dshHome>/skills on load, hot-reloaded)
Source of truth Capability whitelist and SDK method table fetched live from the local MaiBot

The plugin does not connect to the network, does not read credentials, and does not execute the validated plugin’s code; if AST deep inspection is needed during validation, it uses a local Python subprocess to parse files (see the repository’s SECURITY.md).

Why It’s Needed

Host constraints summarized in the README and common consequences of “writing from memory” include:

  • _manifest.json is a strongly-typed model: multiple fields, version number format, author.url not being http(s), etc. can cause manifest validation failure.
  • capabilities is an authorization whitelist: using undeclared capabilities in code raises errors; declaring names the host hasn’t registered makes the manifest invalid.
  • SDK interfaces change across versions; some methods may not exist in the current SDK.
  • @EventHandler does not intercept messages by default; ON_MESSAGE should use fields such as message["session_id"], message["processed_plain_text"], rather than incorrect key names.
  • Only plugins with [plugin].enabled = true are activated; when the [plugin] section is missing, behavior may be opposite to expectations.

maibot_plugin_validate performs static checks on the above rules; when Python can be found, it also performs AST-level syntax, import, and structure checks.

Core Features

maibot_plugin_catalog

Lists existing plugins under plugins/ (ID, name, version, directory, enabled/disabled status, components, capability declarations, line count) and capability names currently registered by the host, used for checking ID conflicts and referencing existing patterns.

maibot_sdk_reference

Returns the development contract of the current host by topic, optional: overview, capabilities, methods, components, messages, config, pitfalls, all.

maibot_plugin_scaffold

Generates a trio that passes host validation: _manifest.json, plugin.py, config.toml; defaults to enabled = false. Can specify a directory to write drafts outside the plugin directory before formal installation.

maibot_plugin_validate

Performs static validation on the plugin directory, returning error / warning / info, covering manifest, config.toml, plugin.py, cross-checking capability declarations against code calls, component decorator contracts, duplicate plugin IDs, etc.

maibot_plugin_install

Validates first; refuses installation if errors exist; after passing, copies to <maibotRoot>/plugins/<dirName>, and sets [plugin].enabled according to parameters (default remains disabled).

Skill: maibot-plugin-writer

Defines the complete workflow (query contract → review current state → generate scaffold → write implementation → validate to clean → deliver) and a hard contract checklist. DSH loads this skill when handling requests such as “write a plugin for MaiBot / modify a plugin / troubleshoot loading failures”.

Installation and Activation

This plugin is distributed only via GitHub (not available on npm). The official README provides three methods, choose any one:

# 1) Clone and link into profile
git clone https://github.com/Lgv-H/dsh-maibot-plugin-writer.git
dsh plugin --profile web add link:/path/to/dsh-maibot-plugin-writer

# 2) Offline/registry-free environment (equivalent to link installation in 1), no pnpm network dependency)
cd dsh-maibot-plugin-writer
node scripts/deploy-local.mjs --profile web

# 3) Install via plugin market: once the repository is public with the dsh-plugin topic, the market's GitHub source can retrieve it (subject to actual market inclusion)

After installation or update, a restart of the profile’s service is required. The bundled skill is hot-reloaded by the file watcher, visible in new sessions without restart.

Uninstallation:

dsh plugin --profile web remove dsh-maibot-plugin-writer

Configuration

Can be overridden in the profile’s cordis.patch.yml (profile layer takes precedence over plugin bundle):

- id: dsh-maibot-plugin-writer
  name: dsh-maibot-plugin-writer
  config:
    maibotRoot: 'C:\...\modules\MaiBot'   # MaiBot source root (contains src/plugin_runtime and plugins/)
    pythonPath: ''                        # Optional: interpreter for AST deep inspection
    dshHome: ''                           # Optional: defaults to $DSH_HOME or ~/.dsh
    syncSkill: true                       # Whether to distribute the bundled skill to <dshHome>/skills

The maibotRoot resolution order is: tool parameter → plugin config → environment variables DSH_MAIBOT_ROOT / MAIBOT_ROOT → upward detection from the current working directory → automatic discovery of common installation paths; explicit configuration errors will raise directly without silently switching directories.

Typical Usage

After installation and profile service restart, just describe your needs in natural language in DSH. README example:

Write a plugin for MaiBot: post a morning greeting in a designated group at 8 AM every day, with the text editable in the config.

The agent roughly executes following the skill:

maibot_plugin_catalog            → confirm no ID conflicts, see if there are reference plugins
maibot_sdk_reference             → get components / messages / config / capabilities contracts
maibot_plugin_scaffold           → generate the author.morning-greeting trio
(use file tools to complete the business logic of plugin.py and config.toml fields)
maibot_plugin_validate           → repeatedly validate to 0 errors
maibot_plugin_install            → copy into plugins/, keep enabled = false

Finally, the user decides whether to set [plugin].enabled to true and verify the behavior based on the instructions.

Use Cases and Notes

Who it’s for: Developers who have already deployed MaiBot 1.x (_manifest.json v2 + plugin_runtime) and DSH web profile locally, and want the agent to generate, validate, and install plugins according to the machine’s real contracts. The README’s tested environment includes DSH 0.1.7-rc.2 desktop client + web profile, @deepseek-ai/dsh-tools 0.1.2-rc.1, Node ≥ 20, MaiBot Plugin SDK 2.x (example 2.8.2); Windows has been tested; macOS / Linux path detection is covered but not marked as tested in the README.

Limitations (repo original): Only performs static validation, does not start MaiBot, and does not guarantee business logic correctness; when Python is not found, AST deep inspection will degrade and be noted in the results; writing to plugins/ may trigger the host’s file watcher to reload the plugin runtime; no network access, everything is based on the local host.

Recommendations before installation: DSH plugins run with the current DSH process permissions, will read MaiBot source code and plugins/, write to scaffold/install targets and the skill directory. Before installation, you should read the repository source code and MIT license yourself, and confirm that maibotRoot and path disclosure comply with your environment. The community directory SkillHub is an independent site, with no official affiliation to DeepSeek / High-Flyer.

The maintainer also points to MaiBot’s official vibe-coding documentation at the beginning of the README; if you prefer documentation-driven development, you may refer to it as well.

Closing

dsh-maibot-plugin-writer hands over the error-prone contract details in MaiBot plugin development to the local source of truth and static validation, and automates the “write it correctly so it loads, with consistent capability declarations” part; delivery still depends on your decision whether to enable the plugin. For further information, see the SkillHub directory page and GitHub repository.

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

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

Xiaoye