Foreword

When developing DeepSeek Harness (DSH) agents, using an expensive premium model for every step wastes resources and may slow down response times. Local models are less costly, but may lack sufficient capability for complex planning or error recovery. The @richie.liu/dsh-hybrid-coder plugin implements a dual-model routing strategy: the premium model handles planning and emergency situations, while local small models (such as Ollama) execute routine steps.

Core Features

This plugin is a routing strategy, not model transport. It controls routing by rewriting the target provider/model for each step’s request. Main features include:

  • Dual-model routing: Switches between premium and local routes based on priority (plan mode or escalation triggers).
  • Plan mode escalation: Forces the use of the premium model when plan mode is active.
  • Consecutive failure threshold: Escalates to the premium model if the local model reaches the threshold for consecutive tool execution failures in a single conversation turn.
  • Request-level fallback: Handles transport-level failures from the local provider (such as timeouts or connection refusals).
  • De-escalation: Automatically de-escalates back to the local model after the premium model succeeds a specified number of times.
  • System prompt identity synchronization: Ensures the system prompt reflects the current route to avoid identity confusion.

Installation and Enablement

Use the official installation command to add the plugin to the target configuration file.

dsh plugin --profile web add @richie.liu/dsh-hybrid-coder

Configuration and Usage

Define the premium and local routes in the DSH configuration file. premium.provider and local.provider must be registered LLM adapter routes.

- id: hybrid-coder
  name: '@richie.liu/dsh-hybrid-coder'
  config:
    premium:
      provider: glm
      model: glm-4-plus
      reasoningEffort: high        # 可选,未设置则使用提供商默认值
    local:
      provider: ollama
      model: qwen2.5-coder:7b
    escalation:
      failureThreshold: 2                  # 单轮对话中连续失败的阈值
      premiumStepsBeforeDeescalation: 2    # 连续成功的高级模型步骤阈值

Notes

  • Experimental status: This plugin is experimental. The public contract may change, and it is not included with official releases.
  • Configuration fault tolerance: Unknown configuration keys fail during loading.
  • Known limitation: During request-level fallback, the identity text in the system prompt may briefly exhibit “directional drift” (that is, after switching to the premium model, the identity text may still temporarily reference the local model). This is caused by the context of retry steps and is a benign drift.
  • License: MIT License.

Summary

This plugin allows you to balance cost-effectiveness and reliability in DSH agents. For more technical details and source code, refer to the GitHub repository.