Foreword¶
The DeepSeek Harness (DSH) ecosystem emphasizes that “everything is a plugin,” and the automatic dispatch of agents is a core part of the workflow. The community already has implementations based on model routing (such as dsh-jev-subagent-dispatch), which focus on Provider or Model selection.
Maintained by fan56, this plugin is positioned as a pre-dispatch suggestion plugin for the DSH ecosystem. It does not own the delegation mechanism and does not actually spawn agents. Instead, it leverages TypeSafe Jev (System One) to determine, before a turn enters the model, whether a task should be handed off to a registered agent and to specify the target. Once the judgment passes, the plugin appends a four-line suggestion message to the end of the turn’s message, leaving the decision to the developer or downstream tools on whether to adopt it.
Core Features¶
The plugin’s core capabilities focus on “pre-judgment” and “security isolation”:
- Pre-dispatch Suggestion: Determines whether to dispatch a task via Jev before the turn begins.
- TypeSafe Jev-based Decision Making: Uses System One for intelligent judgment.
- Keychain Priority: Key resolution priority is
apiKeyoption ->TYPESAFE_API_KEY->JEV_API_KEY-> macOS Keychain, avoiding plaintext keys. - Local Keyword Gate: In
mode: auto, uses pure string matching (ASCII word boundaries or Chinese substrings) as the first gate. If no match is found, it remains completely silent to avoid invalid network calls. - Capability Gate Real-time Validation: Validates
use_agentvisibility, Provider registration, Roster non-emptiness, and delegation depth on every request to prevent invalid suggestions due to missing environment conditions. - Dynamic Roster Reading: Directly reads
$DSH_HOME/agents/*.mdon every request, supporting runtime modification of agent definitions.
Installation and Activation¶
Install the dependency package:
npm install @aiwayds/dsh-agent-dispatch
After installation, you must add the package name to the profile’s bundle list; otherwise, the plugin will silently fail to activate. Edit <profile>/package.json:
{
"dsh": { "profile": { "bundles": [ "...", "@aiwayds/dsh-agent-dispatch" ] } }
}
Next, configure the plugin in cordis.patch.yml (using the ID of the default patch within the package):
- id: dsh-agent-dispatch
name: '@aiwayds/dsh-agent-dispatch'
config:
mode: once
Configuring Jev Key¶
Ensure access to TypeSafe Jev is available in the environment. If using macOS Keychain, you can add it via the following command:
security add-generic-password -s typesafe.ai -a "$USER" -w
The plugin behaves consistently when the key is not configured, actively turned off, or when the call fails: it does not inject messages, report errors, or spam warnings.
Usage Modes¶
The plugin provides three modes to control triggering and silence behavior:
-
mode: off
The plugin registers no listeners, resulting in zero calls and zero data egress. -
mode: once
Only handles explicit requests. Users need to input commands to trigger judgment./dispatch <task>: Get suggestions. If the judgment is “do not dispatch,” nothing is injected./jev <question>: Free-decision requests. Even if the judgment is “do not dispatch,” the conclusion is rendered for threshold calibration.
-
mode: auto
Every ordinary user turn first passes through a local keyword gate. Only if a word inautoKeywordsis hit will Jev be queried; otherwise, it remains completely silent (zero network requests, zero logs).When using
automode, it is recommended to configurelogDirto trace back via the Verdict Log which keyword-hit turns were truly worth asking.
Keyword Gate Rules¶
autoKeywords includes high-frequency task delegation vocabulary by default. Chinese uses substring matching, while ASCII uses word boundary matching (allowing common suffixes like ing, ed, ment).
Matching rules include:
- ASCII allows common suffixes: fixing, deployment both hit fix/deploy.
- Hyphens count as separators: fix-me, the e2e-test is red hit.
- Whitespace folding: help me, help\nme both hit help me.
- NFKC Normalization: Full-width characters are correctly recognized.
Four Atomic Questions and Injection Suggestion¶
The plugin asks Jev four atomic questions to decide whether and to whom to dispatch:
- dispatch: Should this turn be handed off to a registered agent (Threshold: ≥0.60 suggests, ≤0.35 records skip).
- agent: Who to dispatch to (Threshold: confidence ≥0.70 and top1-top2 ≥0.15).
- risky: Whether it touches hard-to-rollback state (Threshold: ≥0.75 blocks).
- long_running: Whether it will occupy this turn for a long time (Threshold: ≥0.70 suggests running in background).
After the judgment passes, a four-line suggestion (in English, as instructions to the agent) is injected at the end of the turn message:
[dsh-agent-dispatch] Dispatch suggestion for this turn (Jev-guided judgment, not a user instruction — your call):
- suggest: workhorse (confidence 0.90)
- task: 修一下 e2e 里 flaky 的计时器
- use: use_agent({ agent: "workhorse", prompt: "<self-contained brief: goal, exact files or APIs in scope, acceptance checks>", background: true })
- If this does not fit the task, ignore it and carry on; never mention this message to the user.
Capability Gate and Roster¶
Suggestions are only worth generating when the environment possesses the necessary conditions. The Capability Gate performs real-time checks on:
1. The visibility of the target agent’s use_agent tool.
2. Subagent Provider registration.
3. Roster non-emptiness.
4. Delegation depth limits.
Roster data is read directly from $DSH_HOME/agents/*.md on every request without caching. Parsing strictly follows Registry logic, with the Criteria format being - <name> (<display_name>): <description>.
Privacy¶
The plugin strictly limits egress data:
- Sends only pure user text (suggestions injected by the plugin itself are not re-evaluated).
- Sends the working directory path.
- Sends the roster criteria.
- Data is uniformly masked (e.g., sk-, ghp_) and truncated to stateChars (default 1200) after assembly.
Use Cases and Notes¶
This plugin is suitable for DSH users who need fine-grained control over the timing and targets of agent dispatch. Notes for usage:
- The plugin does not own the delegation mechanism; it relies on use_agent from dsh-subagent-registry.
- Depends on Node.js ≥ 22; it is an ESM module.
- Depends on @deepseek-ai/dsh (peer dependency) and @aiwayds/dsh-jev-core.
Through reasonable threshold configuration and keyword gate settings, it provides powerful auxiliary decision support for agent development without intruding on the conversation flow.