dsh-subagent-model-switch: Adding Head Model Switching to Subagent Sessions

Preface

When working with teammates or sub-agents in parallel within DeepSeek Harness (DSH), the model is often fixed at the moment the sub-agent starts. DSH’s native header model switcher is strictly disabled for sessions where origin === "subagent": sub-agent sessions cannot access the model catalog, and clicking the switcher yields no response. To change models, users previously had to restart the sub-agent, interrupting the context and the ongoing turn.

The community plugin dsh-subagent-model-switch (maintained by YuMo-233) addresses this gap: it renders a dropdown menu identical to the native one in the sub-agent session header. The selection takes effect immediately—without restarting the session or losing context. The switch applies to requests in the next turn, and the selection is remembered across restarts.

What is this?

dsh-subagent-model-switch is a plugin categorized under “Model Inference” in the DSH community directory. The repository is located at YuMo-233/dsh-subagent-model-switch, with the current package version 0.1.0 and an MIT license.

In one sentence: It installs a model switcher exclusively for teammate / sub-agent sessions in DSH; the main session continues to use the native DSH switcher, and this plugin does not intervene.

Scope of Effect

Session Header Model Switcher
Main Session (opened by you) Native Switcher (This plugin does not intervene)
Teammate / subagent / subagent_fork etc. sub-agent sessions This Plugin’s Switcher

Core Features

Three-Level Menu

Click the button in the session header to select from the following options:

  1. Model —— All available models grouped by provider (free models are marked with a price tag like · x0.00);
  2. Reasoning Effort —— Reasoning effort supported by the provider, including “Provider Default”;
  3. Inherit Parent Session —— Clears the override and returns to the model inherited from the parent session.

The switch takes effect on the next model request: requests already sent are not interrupted, and calls following the current turn will use the new model.

Persistence

Selections are written to DSH_HOME/storages/dsh-subagent-model-switch/overrides.json and automatically restored after DSH restarts. Overrides are tracked by session ID; entries are not automatically cleaned up after the session ends. To completely clear them, delete the file or select “Inherit Parent Session” in the header.

Capability Boundaries (Explicitly stated in README)

  • Only covers provider / model / reasoningEffort; context, tools, and permissions remain unchanged.
  • UI is only displayed for sub-agent sessions.
  • Does not modify session logs (to avoid log reading failures caused by custom event types) and does not rely on native model selection.

How it Works (Brief Overview)

The plugin listens for agent/created and hooks into agents where header.origin === "subagent". It uses prepend to register two hooks, ensuring the override takes effect at the final step of the waterfall return journey:

  1. agent/request —— After the waterfall finishes, rewrites provider / model and clears the reasoningEffort inherited from the parent session (unless explicitly specified in the current selection);
  2. system-prompt/assemble —— Synchronously rewrites the provider / model variables in the system prompt to match the actual request.

Installation and Activation

The plugin runs with the permissions of the current DSH process. Before installation, it is recommended to browse the source code and the MIT License on GitHub to ensure compliance with your environment policies.

Fill in one of the following in the “Plugins” panel of DSH Desktop, then restart DSH after installation:

github:YuMo-233/dsh-subagent-model-switch

Or fill in the repository address directly:

https://github.com/YuMo-233/dsh-subagent-model-switch

Suitable for modifying plugin code and verifying immediately. The README requires Node >= 22.5.0. Brief steps: After cloning the repository, use junction (Windows) or equivalent methods to link it into %DSH_HOME%\profiles\desktop\node_modules. Register the link: dependency and dsh.profile.bundles in the profile’s package.json, register the plugin ID in cordis.patch.yml, and then restart DSH Desktop. For complete commands and paths, see the Repository README.

Typical Usage

  1. Launch a teammate or sub-agent session normally via DSH (subagent / subagent_fork, etc.).
  2. Open the model switch dropdown in the sub-agent session header, select the provider, model, and if necessary, the reasoning effort.
  3. Continue the conversation; starting from the next turn, the new model will be used for subsequent requests without restarting the sub-agent.
  4. If you wish to restore the model inherited from the parent session, select Inherit Parent Session in the menu.

If other plugins or scripts need to read or write overrides, they can call the subagentModelSwitch service registered by the host (typert RPC): getModel(sessionId), setModel(sessionId, provider, model, reasoningEffort?), unsetModel(sessionId). The first parameter must be named sessionId rather than session to avoid conflicts between gateway parameter hijacking and session lookup. Error codes include subagentModelSwitch/invalid-request, /session-not-found, /not-subagent, /invalid-model.

Use Cases and Notes

Who it is for: Developers who frequently open multiple sub-agents/teammates in DSH and need to switch models or reasoning effort within the same session based on tasks; the main session should continue using the built-in DSH switcher.

Ecosystem Note: DSH’s philosophy is “Everything is a plugin”; the SkillHub Plugin Directory is a community site and has no official affiliation with DeepSeek / High-Flyer. It should not be treated as an official app store.

Dependencies: The plugin depends on @deepseek-ai/cordis, @deepseek-ai/dsh-llm, @deepseek-ai/dsh-typert-protocol, etc., which are resolved and installed by the DSH profile.

Links

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

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

Xiaoye