In DeepSeek Harness (DSH), top-level sessions typically use DeepSeek’s loop driver. If you want to use different AI engines (for example, Claude Code) for different sessions in the same client, you usually need to replace the configuration globally or restart the application. The dsh-engine-switch plugin uses a proxy pattern to allow dynamically switching the driving engine of a session at runtime based on presets.

What is this

dsh-engine-switch is a DSH workflow plugin. It does not provide a specific engine implementation; instead, it defines the specification for engine integration. The plugin decides which engine driver to use when a session is created, when a conversation is resumed, and when presets are switched, based on the current session preset, with DeepSeek as the default fallback. It is maintained by Yuki-takuya-kun and released under the MIT license.

Core features

  • Engine selection by preset: Engine selection is determined by the preset. The priority order is: declaration inside the preset → explicit configuration entry → preset name equal to engine name → default DeepSeek.
  • Switching before the first message: Switching the preset before the session sends its first message immediately applies the corresponding engine, without reopening the session or restarting the application.
  • Presets are installed automatically: After an engine plugin is installed, its bundled presets are automatically copied into the DSH preset directory, with no manual maintenance required.
  • Engines and sessions remain decoupled: Engines are not aware of the concept of “presets,” and sessions are not aware of “being switched to a different engine”; the two logics remain independent.
  • Sub-agents always use DeepSeek: Regardless of which engine is used in a top-level session, sub-agents always use the original DeepSeek loop.
  • Automatic restoration on resume: When a session is resumed, the corresponding engine is automatically restored based on the preset recorded in the logs.

Installation and enablement

1. Install the plugin

Install it using the official command:

dsh plugin --profile web add github:Yuki-takuya-kun/dsh-engine-switch

2. Enable the plugin

Edit the configuration file ~/.dsh/profiles/web/cordis.patch.yml and add the following:

- id: dsh-engine-switch
  config:
    enabled: true

After saving, restart the web application.

3. Configure an engine

To specify an engine in a preset, there are two methods (from highest to lowest priority):

Method 1: Declare it in the preset

Edit agent.cordis.yml under the preset directory:

# ~/.dsh/.agent-presets/<预设名>/agent.cordis.yml
- name: dsh-engine-switch
  config:
    engine: claude-code   # 指定使用 claude-code 引擎

Method 2: Specify it in the configuration

Add a mapping in the config section of cordis.patch.yml:

config:
  engineByPreset:
    research: claude-code

If none of the above configurations specifies an engine, the default engine deepseek will be used.

4. Register an engine (for engine plugin developers)

If you need to develop your own engine plugin, call ctx.engineSwitch.register() in the plugin code to register the engine:

export const inject = ["engineSwitch"];
export function apply(ctx) {
  ctx.engineSwitch.register({
    id: "claude-code",              // 引擎名,需与预设目录名一致
    name: "Claude Code",
    description: "…",
    presetDir: fileURLToPath(new URL("./presets/claude-code/", import.meta.url)),
    makeAgent(loopCtx, id, options, session, engineConfig) {
      return new ClaudeCodeAgent(loopCtx, id, options, session, engineConfig);
    },
  });
}

Notes and limitations

  • Plugin independence: This plugin itself does not include any engine or any preset. The actual engine is registered and provided by downstream plugins.
  • Special engine name: deepseek is a special name that indicates falling back to DeepSeek’s original loop.
  • Dependency requirement: The Node.js version must satisfy: ^22.19.0 || >=24.0.0.
  • Peer Dependencies: Ensure the following dependencies are installed when installing:
    • @deepseek-ai/cordis
    • @deepseek-ai/schemastery
    • @deepseek-ai/dsh-agent
    • @deepseek-ai/dsh-agent-presets
    • @deepseek-ai/dsh-session
    • js-yaml
  • Preset directory structure: The presetDir specified during engine registration must contain two files: agent.cordis.yml and preset.yml.

Summary

dsh-engine-switch provides a preset-based routing mechanism that allows DSH to flexibly support multiple AI loop engines without modifying the core logic. By decoupling engine selection from session logic, it achieves the goal of “sub-agents always using DeepSeek while top-level sessions can be switched as needed.”

  • GitHub repository: https://github.com/Yuki-takuya-kun/dsh-engine-switch
  • Plugin directory: https://www.skillhub.cn/plugins/Yuki-takuya-kun/dsh-engine-switch