Preface¶
In DeepSeek Harness (DSH), spawning child agents is commonly done using the built-in @deepseek-ai/dsh-subagent: it primarily limits the number of simultaneously active agents (maxActiveSubagents, default 8), and once a subagent finishes, the quota is immediately released. When the limit is reached, it often directly throws subagent limit reached without asking; the tool side will only create new ones and will not actively look for reusable old subagents.
In long sessions or when repeatedly breaking down tasks, two types of problems tend to arise: difficulty in controlling the number of historically spawned subagents, and the duplication of agents even when new tasks are similar to old ones. The dsh-subagent-governor (Category: Workflow) provided by maintainer zhengjy273 supplements total caps and similar task reuse by intercepting decisions, reusing tools, and injecting prompts, without modifying the native subagent / subagent_fork tools or copying the model routing. See the SkillHub plugin page for the community directory and GitHub for the source code (MIT, current package version 0.1.1). This directory is an independent community site and has no official affiliation with DeepSeek / High-Flyer.
What is it¶
dsh-subagent-governor is a DSH plugin that keeps the total number of child agents (active + finished) within a configurable limit within a session, and checks for similar, reusable old child agents before preparing to spawn a new one. The built-in active limit and this plugin’s total limit stack (take effect together); the one that reaches the ceiling first takes effect.
Core Features¶
Total Quota Gate¶
The total number of child agents in a session (active + finished) does not exceed maxTotal (default 12). When the limit is reached, choose Ask (ask) or Hard Deny (deny) based on limitBehavior. You can set quotaEnabled to false to disable only this gate.
When maxTotal is 0, it means no new agents can be created; work can only continue through reuse.
Reuse Gate¶
Before dispatching a new child agent, the plugin checks for reusable old child agents. Similarity is scored locally (by character for Chinese, by word for Latin scripts), adjustable via thresholds like strongThreshold and candidateThreshold. Only continuable child agents are reusable; one-shot child agents have no label and cannot receive subsequent messages, but they are still counted towards the total.
A summary of the Reuse Check modes (reuseCheck) is as follows:
| Mode | Behavior at High Similarity | Suitable for |
|---|---|---|
enforce (default) |
Automatically forwards the task to the old subagent; this creation is skipped | Daily use |
enforce-ask |
Confirms via userQuestions card whether to reuse; confirms creation if reuse is declined |
Retaining human judgment |
advise |
No interception; logs score and hints | Observing thresholds |
off |
No reuse check; only total gate remains | Limiting only total count |
enforce-ask can still pop up cards even in sessions where approval is disabled (does not rely on the host’s silent degradation for approval). Direct calls to reuse_subagent will also ask if reuse is desired first; if unanswered within 60 seconds, it is treated as not executed.
Interaction with Built-in Active Limit¶
When maxTotal is lower than the built-in maxActiveSubagents (default 8) and syncActiveCap is true, the plugin lowers the built-in active limit to maxTotal (decreases only, never increases). The original value is restored when the plugin is uninstalled or disabled.
Provided Tools¶
| Tool | Purpose |
|---|---|
list_reusable_subagents({ task, limit? }) |
Query similar reusable subagents |
reuse_subagent({ subagent_id, task }) |
Send a new task to a reusable subagent (cold-resume for finished sessions) |
subagent_governor_status() |
View total, limits, mode, and counts |
subagent_governor_diagnose() |
Diagnose client / settings / bundle status |
By default, intercepts subagent and subagent_fork (can be changed via guardTools). Does not intercept Agent Teams’ spawn_teammate.
Installation & Activation¶
Install the bundle from the plugin directory (replace the path with the absolute path to your local clone or extraction):
plugin_manager action=install_bundle target=<本目录绝对路径>
Takes effect in new sessions after installation. When uninstalling or disabling, the linked modified built-in active limit is restored.
The plugin runs with the permissions of the current DSH process; please check the repository source code and MIT license yourself before installing to confirm it fits your environment policy.
Configuration¶
In addition to changing the plugin Config, parameters can be adjusted via the Web settings page:
- Refresh the DSH Web page once after installing or updating (Ctrl+R).
- Open Settings → Child Agent Management (located after ‘Plugins’ and before ‘Browser Bridge’).
- Group adjust total, reuse check, and advanced items, then click ‘Save’, which writes back via
configFormsand takes effect immediately.
Main configuration keys (see README for full table):
| Key | Default | Meaning |
|---|---|---|
maxTotal |
12 |
Total limit for child agents in the session |
limitBehavior |
ask |
Limit reached: ask or deny |
quotaEnabled |
true |
Enable total gate |
syncActiveCap |
true |
Enable lowering of built-in active limit |
reuseCheck |
enforce |
Reuse check strength |
strongThreshold |
0.60 |
High similarity cutoff |
candidateThreshold |
0.35 |
Cutoff for entering candidate list |
candidateLimit |
5 |
Max number of candidates |
injectHint |
true |
Inject usage guidelines into system prompt |
Rollback strategy: Disable reuse by setting reuseCheck: "off"; Disable total gate by setting quotaEnabled: false; Disable both to minimize directory reading overhead; Remove entirely by uninstalling the plugin.
Typical Usage¶
The main agent can query the reusable list before dispatching, or the plugin can automatically intercept or ask in limit/high-similarity scenarios. Example (parameters based on the task in your session):
list_reusable_subagents({ task: "在 src 下搜索所有 API 路由定义" })
If a suitable subagent already exists, you can reuse it explicitly:
reuse_subagent({ subagent_id: "<id>", task: "补充列出 middleware 挂载点" })
When you need to confirm current quota and count:
subagent_governor_status()
For daily use relying on automatic governance, keeping the default reuseCheck: enforce is sufficient; to observe thresholds before deciding, you can temporarily change it to advise.
Applicable Scenarios & Notes¶
Who is it for: Users who frequently use subagent / subagent_fork in the same DSH session, wish to control the total history of child agents, and want to reduce workflows that involve creating agents for synonymous tasks.
Notes:
- Similarity is lexical scoring, not semantic model-based; if misjudgment occurs, you can switch to
advisefirst to observe and then adjust thresholds. - Reusable candidates come only from direct child agents of the current parent session, not cross-session sharing.
enforce-askrelies on the client’s user-questions answerer; if it cannot pop up, reuse confirmation will be skipped, and quota asking may fall back to the host approval.- If reading the subagent directory exceeds
queryTimeoutMs(default 1500ms), it proceeds to avoid blocking dispatch.
Conclusion¶
dsh-subagent-governor constrains the scale and duplication of child agents within the session by using total and reuse gates, while preserving the capabilities of the built-in subagent. Parameters can be adjusted in the config file or in the Web ‘Child Agent Management’ section.
- Directory page: https://www.skillhub.cn/plugins/zhengjy273/dsh-subagent-governor
- GitHub: https://github.com/zhengjy273/dsh-subagent-governor