Read-Only Retrieval Sub-Agent Plugin for DeepSeek Harness

Introduction

When using the main model to handle development or analysis tasks, you often need to perform broad-scope searches first: reading multiple files, searching a codebase, consulting documentation, or browsing web pages. This kind of work involves a lot of reading and little reasoning. Letting the main model do it directly consumes a large amount of quota and floods the main session context with raw content. Manually switching to a cheaper model mid-task and switching back after the search invalidates the prefix cache, causing subsequent turns to be re-billed at a higher cost.

The subagent tool built into DeepSeek Harness allows specifying a sub-model, but the model must be filled in by the main model at call time—users have no direct entry point to designate the retrieval model or toggle it on/off. When subagent/model-selection-policy is not configured, the built-in sub-agent is also subject to the session routing whitelist and can only default to the parent session’s current model.

dsh-query-scout adds a Query Scout entry to the input toolbar and registers the query_scout tool. Once users configure a retrieval model in the panel, the main model delegates broad file or web searches to an independent read-only sub-agent via query_scout, bringing back only a sourced report to the main session. The main model stays in place, and the prefix cache remains intact.

What It Is

dsh-query-scout is a read-only retrieval sub-agent plugin for DeepSeek Harness. It delegates large-scale file and web searches to an independently configured model without switching the main model or breaking the prefix cache—the main model simply receives one sourced report.

Maintained by xuanfenglajiao. Plugin version v0.1.1, under the MIT license.

Core Capabilities

No Main Model Switch, Prefix Cache Preserved

Retrieval is handled by the sub-agent while the main session’s model remains unchanged. The query_scout definition is fixed and contains no model name; toggling it per session only appends a status note at the end of history, leaving the existing prefix untouched.

Retrieval Process Doesn’t Occupy Main Model Context

File reads, searches, and raw web content all stay within the sub-agent. The main model receives only a length-capped, sourced report and waits synchronously for the result—no extra turn triggered by async notifications.

Specify the Retrieval Model Directly in the Panel

Select a model, adjust reasoning effort, or set a global default for the current session at any time—without affecting the main model or maintaining the built-in sub-agent’s routing whitelist. The tool parameters do not expose a model field, so the main model cannot swap it on its own.

Proactive Delegation Based on Search Volume

When globally enabled, the system prompt includes a fixed directive: whether searching the web, reading code, or consulting docs, delegate to the Query Scout whenever three or more search/read operations are involved, or when the task spans multiple files, directories, repositories, or web pages; one or two quick lookups are handled by the main model itself. Per-session toggling does not alter this prompt.

Fallback Models and Parallel Queuing

Configure multiple candidate models in order; on failure, the model is automatically cooled down and the next one is tried. When concurrent retrieval hits the limit, requests are automatically queued rather than failing and falling back to the main model.

Sub-Agent Is Read-Only by Default

Only file read, search, and web tools are exposed; global tools, MCP tools, and query_scout itself are automatically blocked. To allow specific tools, specify them via globalToolAllow.

Installation & Activation

Requires DSH 0.2.2-rc.3 or later and Node.js 22.19 or later.

Desktop installation:

dsh plugin --profile desktop add dsh-query-scout

Install from a local directory:

dsh plugin --profile desktop add link:<absolute path to this directory>

Web installation:

dsh plugin --profile web add dsh-query-scout

After installation, restart the application or refresh the web page to activate. To uninstall, replace add with remove dsh-query-scout.

Usage

  1. Click the Query Scout icon in the input toolbar.
  2. Toggle the switch on. If no model is selected yet, you’ll be taken to the model list first; select one and it enables automatically.
  3. To add a fallback model, click Add Fallback Model. Use the up/down arrows to adjust order, click Reasoning below the model to set reasoning effort, fill in additional instructions if needed, and choose the number of concurrent retrievals in Max Parallel. All changes take effect immediately.
  4. After this, the main model will invoke query_scout on its own when retrieval is needed. You can also explicitly ask: “Use query_scout to look up …”
  5. The bottom of the panel shows whether the current session is Using Defaults or has Per-Session Overrides. When overrides exist, you can Restore Defaults or Set as Default to apply them to other sessions.

A session only stores fields that differ from the defaults. For example, if you only toggle the switch off in the current session, the model list still follows the global defaults.

When enabling or disabling per session, the plugin injects a status note into the session; this note is appended after the existing history and does not affect the prefix cache.

Failure Handling

When a sub-agent’s model request fails, DSH’s built-in retry handler (dsh-llm-retry) kicks in first: rate limits (429), 5xx errors, timeouts, network errors, and empty responses are retried up to 5 times with exponential backoff starting at 0.5 s, capped at 10 s. If the provider’s required wait time exceeds 10 s, the attempt is abandoned.

Providers connected via the pi-ai adapter (e.g., magpie) that return error text without a 429 or 5xx status code will produce the error code PI_AI_ERROR, and DSH will not retry.

If DSH retries are exhausted or the model route is unavailable, the plugin switches to the next model in the list and reruns the retrieval from scratch.

User interruption, sub-agent output exceeding the limit, task being blocked, or the sub-agent service refusing to start—these cannot be resolved by switching models; the retrieval ends immediately without trying other models.

A failed model enters a 2-minute cooldown (cooldownSec): during cooldown it is moved to the end of the queue, but will still be attempted if all preceding models have also failed. Cooldown records are shared across all sessions and cleared on plugin reload.

If less than 15 seconds remain in the total timeout, the next model will not be started.

On success, the annotation at the end of the report states the model that actually answered, along with any preceding failed or skipped models and reasons, e.g. [query_scout: deepseek-account/deepseek-v4-pro, 31s; deepseek-account/deepseek-flash failed: ACCOUNT_QUOTA: Insufficient Balance].

When all models fail, query_scout returns an error listing each model and its failure reason, and instructs the main model to complete the retrieval itself; the panel displays the result of the most recent retrieval attempt.

Configuration

Configuration beyond the panel lives in the config section of the query-scout plugin line:

Field Default Description
defaults.enabled false Global default for enabling; also determines whether the delegation directive appears in the system prompt (the panel’s Set as Default rewrites fields under defaults)
defaults.models [] Models to try in order; each entry is { provider, model, reasoningEffort? }; up to 3, extras are ignored
defaults.instructions — Additional instructions prepended to every task
defaults.maxOutputChars 8000 Character limit for the report returned to the main model
defaults.timeoutSec 300 Total time limit per retrieval (seconds); shared across all models in the list
defaults.cooldownSec 120 Cooldown seconds after a model fails; 0 disables cooldown
defaults.maxParallel 2 Max concurrent retrievals per session, 1–8; excess are queued
subagentProvider spawn Sub-agent provider
agentPreset query-scout Preset used by the sub-agent
globalToolAllow [] Global tool names to keep available in the sub-agent

This package’s cordis.patch.yml writes defaults.enabled: true at install time and pre-sets DSH’s built-in deepseek-account / deepseek-flash (DeepSeek-V4.1-Flash under the DeepSeek Account route) as the default model, so you don’t need to select a model in the panel first. This model depends on a DeepSeek account login and sufficient balance; if the account is unavailable, switch to a model from another provider in the panel or add a fallback model to the list.

The single-model fields defaults.provider, defaults.model, defaults.reasoningEffort from version 0.3 and earlier can still be read as the first entry in the list; Set as Default writes them back as a models list.

Security & Risks

  • The sub-agent inherits the main session’s sandbox settings; the approval policy is fixed to never. Read-only tools involve no writes.
  • This plugin calls ctx.subagents directly, bypassing the built-in subagent tool’s session model whitelist. The models used come solely from plugin configuration; the main model cannot swap them via tool parameters.
  • The sub-agent incurs additional API costs for the selected model. When switching to a fallback model, the retrieval is rerun from scratch—costs already consumed by the previous model are not refunded.
  • DSH allows at most 8 concurrently active sub-agents per session by default (maxActiveSubagents). The Query Scout shares this quota with the built-in subagent tool. When the quota is full, retrieval fails directly (ACTIVATION_LIMIT_REACHED) without trying fallback models; the main model must perform the retrieval itself. Setting a higher parallel limit increases the chance of competing with built-in sub-agents for quota.

Use Cases & Notes

Well suited for development and analysis scenarios that require frequent large-scale retrieval, especially when you want to save main-model quota, preserve the prefix cache, and avoid manually switching models.

The plugin runs with the permissions of the current dsh process. Review the source code and license before installing. The sub-agent is read-only by default, with only read, glob, grep, web_search, and web_fetch exposed—it cannot write files or spawn further sub-agents.

Conclusion

dsh-query-scout completes retrieval through an independent read-only sub-agent; the main model simply receives the report—no model switching, no prefix cache disruption. For more details and installation instructions, see the plugin directory page and the GitHub repository.

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

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

Xiaoye