Introduction

In DeepSeek Harness (DSH), plugins, MCP connections, and tool contributions are usually managed by Cordis Loader. After modifying the disk code of an in-process plugin or changing the code of an MCP server corresponding to a mcp-client, the common practice is to restart the host.

dsh-plugin-reload offers finer granularity: it provides the agent with a reload_plugin tool, allowing it to restart a single Cordis Loader entry by entry id, module name, or MCP config.serverName, while other entries continue to run.

Overview

dsh-plugin-reload is a DeepSeek Harness plugin licensed under the MIT license.

Its goal is not to provide a settings interface, but to give the agent a callable tool to perform online restarts of specific entries. Repository address:

https://github.com/reina4xa/dsh-plugin-reload

Core Capabilities

The plugin provides a reload_plugin tool. The behavior is explained below by entry type.

mcp-client Entries

For mcp-client entries, the restart re-raises the MCP server subprocess and re-registers its tools. Sibling MCP connections are not affected.

in-process plugin Entries

For in-process plugin entries, the plugin performs a hard reload:

  • Clear the ESM/CJS module cache for that entry.
  • Re-import code from disk.
  • Switch the fiber to the new module.
  • If re-import or re-application fails, rollback to the previous code.

Modes and Preview

reload_plugin supports the following parameters:

name     Required. entry id (priority), module name, or MCP config.serverName
mode     Optional. auto, soft, hard
dry_run  Optional. When true, it only reports matching results and the strategy to be executed, without actually restarting

Semantics of mode:

  • auto: in-process plugin uses hard reload; mcp-client restarts the MCP server subprocess and re-registers tools.
  • soft: only dispose and re-apply; in-process code changes will not be picked up.
  • hard: clear ESM/CJS cache and re-import entry code from disk.

dry_run: true is suitable for confirming which entry will be matched and which strategy will be used before actually executing.

Matching Rules

Matching only iterates over non-group entries, with the following priority:

exact entry id > module name > mcp-client serverName

Failure behavior:

  • Zero matches: Error, listing available entries.
  • Multiple matches: Error, listing candidate entry ids, no state modification.
  • Group entries: Do not participate in matching. To reload a plugin subtree, you need to call for each leaf entry individually.

Successful return includes entry id, module, optional serverName, before/after fiber phases, strategy, and semantic explanation.

Installation and Mounting

Starting from v0.1.2, the package declares dsh.bundle. It will be automatically mounted after installation using dsh plugin:

dsh plugin --profile web add dsh-plugin-reload

Subsequent updates:

dsh plugin --profile web update dsh-plugin-reload

If using standard npm installation, or wishing to explicitly maintain the patch line, you can insert a profile patch: ~/.dsh/profiles/<name>/cordis.patch.yml, or a --patch overlay:

- insert:
    - id: plugin-reload
      name: 'dsh-plugin-reload'

Note: Do not keep both the bundle mount and manual patch line. Duplicate tool registration will fail on load.

Runtime Requirements

Requires a DeepSeek Harness profile providing web or headless bundle, and availability of:

@deepseek-ai/dsh-tools
@deepseek-ai/cordis-plugin-loader

Applicable Scenarios and Notes

Suitable for:

  • Only wanting to restart a specific in-process plugin without affecting other entries.
  • After modifying the MCP server code of a mcp-client, re-register the server’s tools.
  • Agent performing controlled plugin-level reloads within a DSH session.

Notes:

  • The plugin runs with the current dsh process permissions. Check the source code and MIT license before installing.
  • There is a brief tool interruption during reload. Contributions from the reloaded entry (e.g., MCP tools) are unavailable between disposal and re-application; calls during this period will fail.
  • Hard reload only covers the plugin’s own code; dependencies in node_modules will not be re-imported. Modifying these dependencies still requires restarting the host.
  • Reload will re-execute the plugin’s top-level code. Plugins should not rely on top-level persistent state surviving a reload.
  • This plugin targets the agent; there is no browser/UI surface. The Settings plugin-inventory tab remains read-only.
  • Group reload is not supported; you need to restart the plugin subtree one leaf entry at a time.

Development Commands

npm install
npm run build
npm test
npm pack
  • GitHub: https://github.com/reina4xa/dsh-plugin-reload
  • Plugin Directory Page: https://www.skillhub.cn/plugins/reina4xa/dsh-plugin-reload