Introduction¶
DSH’s plugin mechanism allows tool capabilities to be attached to agent conversations. The built-in subagent tool already enables sub-agent delegation, but in practical development, it is often necessary to temporarily specify the provider, model, and max_tokens for a single call, or to have the sub-agent continue working based on the latest state of the current conversation.
Below is an introduction to dsh-subagent-model. It is a DSH plugin maintained by Momojie-S, based on @deepseek-ai/dsh-tool-subagent, that exposes sub-agent model routing and context inheritance as optional parameters for each invocation.
Plugin Positioning¶
dsh-subagent-model registers the subagent_model tool. When optional parameters are omitted, the sub-agent defaults to a clean context, which is semantically consistent with the built-in subagent; when you need to continue based on the current conversation, pass fresh_context: false, where the seed is the latest completed round of the parent session at the moment of invocation.
package.json declares version 0.3.1 and license MIT.
Core Capabilities¶
- Register
subagent_modeltool. - Optional
provider,model,max_tokensfor each call to specify sub-agent model routing. - Optional
fresh_contextto control clean context or fork the current conversation based on the latest completed round at the call time. - Support
run_in_background, distinguishingcontinuableandone-shotbackground strategies. - Routing priority is call parameters > plugin config’s
agentOptions> parent session routing. - Unknown
provider/modelwill fail fast before starting the sub-agent.
Environment Requirements¶
Perform the following checks first:
- DeepSeek Harness version
>= 0.1.0-rc.6; verified up to0.1.1-rc.2(Windows). - The host bundle has the
subagentsservice loaded. - The
freshmode requires aspawnclass provider; the default inheritance mode requires aforkclass provider.
The provider in the configuration is used for the fresh mode and must be a spawn class provider; configuring it as fork will result in an error upon mounting. The inheritance channel uses inheritProvider.
Installation and Activation¶
The composite package installation command provided by verified sources is as follows, which adds the plugin to the web profile:
dsh plugin --profile web add github:Momojie-S/dsh-subagent-model
You can also use the source code direct-connect development machine form:
git clone https://github.com/Momojie-S/dsh-subagent-model.git
cd dsh-subagent-model
npm install
In the source code form, configure the plugin entry in cordis.patch.yml. The configuration items must at least specify provider and the background strategy, as shown below:
- insert:
- id: subagent-model
name: 'file:///D:/code/workspace/deepseek-harness-101/plugins/dsh-subagent-model/lib/index.js'
config:
provider: spawn
backgroundMode: continuable
# inheritProvider: fork
# defaultContext: fresh
After restarting DSH, the registration of the subagent_model tool takes effect.
Invocation Parameters¶
Common parameters are as follows:
description/prompt/run_in_background: same as the built-insubagent; the default behavior ofrun_in_backgroundvaries depending on the context mode andbackgroundMode.fresh_context: omitted means clean context; passingfalsecontinues based on the current conversation, with the seed being the latest completed round of the parent session at the moment of invocation; explicitly passingtrueforces a clean context.provider: the provider routing ID. Omitted means inheriting from the parent session; in this case,modelmust be a model under that inherited routing.model: the model ID, interpreted by the valid routing; models across different routes require passingprovideras well.max_tokens: the output token limit for each model request by the sub-agent; must be a positive integer.
Background Defaults¶
When mounted with backgroundMode: continuable:
- In
freshmode, the background iscontinuableby default, returning the sub-agent ID for a continuous session that can be continued usingsend_message. - In inheritance mode, it waits in the foreground by default and takes the result directly; passing
run_in_background: trueyields a continuous forkable session.
When mounted with backgroundMode: one-shot:
- Both modes default to foreground.
- Passing
run_in_background: trueruns it as a background job, and results are collected usingjob_output.
Version Defaults¶
Default values have changed between versions:
0.1.x: Omitted parameters indicate a clean context.0.2.0: Changed to default inheritance.0.3.0: Changed back to default clean.
If you need to inherit the current conversation, you can pass fresh_context: false or set defaultContext: inherit in the deployment configuration.
Typical Verification¶
After completing the above steps, you can perform a set of comparative delegations:
- First, agree on a secret code in the current conversation.
- Use
subagent_modelwithout passingfresh_contextto delegate the question “What was the secret code before this conversation?”. - Then pass
fresh_context: falseand delegate the same question.
The sub-agent with the default clean context should not know the secret code; the sub-agent with fresh_context: false should be able to answer it. After switching to a new round of conversation content and forking, if the sub-agent can see the new content, it indicates that the seed is the latest state at the moment of invocation.
Applicable Scenarios and Notes¶
Suitable for DSH development scenarios that require selecting sub-agent routing per invocation, or temporarily inheriting the current conversation context. It places routing and context control within invocation parameters, making it easy to specify different models or different context sources within a single delegation.
The plugin runs with the permissions of the current DSH process. Before installation, you should check the source code, configuration items, and license. This article has verified the license as MIT.
Conclusion¶
The value of dsh-subagent-model lies in making sub-agent model routing and context inheritance into invocation parameters, making it suitable for DSH workflows that require fine-grained delegation control.
GitHub: https://github.com/Momojie-S/dsh-subagent-model