Preface¶
When running agents in DeepSeek Harness (DSH), many judgments are actually quite narrow: yes/no, multiple-choice, scoring according to a rubric, or routing to a fixed branch. If all of these are handled by the main reasoning model, it consumes context and tokens, and self-auditing by LLMs of the same family often amounts to just “agreeing with itself.” The community plugin dsh-typesafe (maintainer 979569650, ~2 stars on GitHub, categorized as “Workflow” on SkillHub, current version v0.1.0) integrates TypeSafe Jev (a System One decision model) into DSH as an independent architectural decision layer: calibrated probabilistic cheap calls, confidence-gated routing, session cost counting, and automated prompt-injection screening for untrusted tool results.
The following sections explain what it is, what capabilities it offers, and how to install and configure it according to the repository README.
What is this¶
dsh-typesafe registers three tools, a prompt section, a tools/post-execute guard hook, and the session command /typesafe on the DSH side. Jev targets “enumerable, mechanical, narrow-domain” judgments; the main model remains responsible for open-ended reasoning. The plugin README uses a prompt section to explain when it is worth switching to Jev and when it is not.
The Settings card is available in both Chinese and English via Settings → General → Language; API keys are injected via credential storage or environment variables and are not written into the plaintext response of settings.yaml.
Core Features¶
Three Jev Tools¶
| Tool | Function |
|---|---|
typesafe_decide |
Submit 1–200 typed questions on the same content segment in a single call; supports mixing noul (yes/no probability), choice (select one + full distribution), and score (rubric). |
typesafe_route |
Route content to one of a fixed set of destinations, returning the option, probabilities for each, and confidence; min_confidence can explicitly flag uncertainty as requiring escalation. |
typesafe_screen |
Screen untrusted text for prompt injection and evaluate the harm level if the instructions within it were followed. |
Prompt Section and Automatic Guard¶
- Prompt section: Three specific rules telling the agent when Jev is superior to starting another round of reasoning, and when it is not; the README emphasizes that without this section, the tools exist but are easily ignored. The default
promptOrderis 700 (behavioral rules carry TEAM_POLICY 600 … PTC_ONLY 800). - Automatic guard:
tools/post-executescreens results fromweb_fetch,web_search,read_page, and fetch-type MCP tools before the model reads them; the policy is fail-open (upon failure, content is unchanged but annotated to avoid confusion with “screened and clean”). /typesafe: Outputs the number of TypeSafe calls, input tokens, and estimated cost for the current session.
Empirical Data in README (jev-latest, not vendor marketing)¶
| Item | Result |
|---|---|
| Mixed three primitives in a single call | urgency 0.98; routing technical 0.81; frustration 1.04/2 |
| Latency / Cost per call | ~800 ms, $0.0000173 |
| Real injection string | blocked, injection 0.99, harm 2.34 |
| Benign policy text | clear, injection 0.01, harm 0.06 |
| Chinese input | urgency 0.98, anger 1.9/2 (docs note CJK is weaker but usable) |
A single screen costs approx. \(0.0000235**; the README records a full round of verification at approx. **\)0.000094.
Field Tests: Whether the Agent Spontaneously Uses It¶
The README compares three session groups using 28 Chinese ticket triage tasks where the task description did not mention TypeSafe: With the old copy and promptOrder 2750, there were 0 calls in coding-form tasks like “write triage.py”. After rewriting to “identify triggers” (e.g., ask Jev before writing keywords/regex classification; do not guess “uncertain”—low confidence is machine-readable uncertainty) and adjusting the order to 700, there was 1 typesafe_decide call, firing all 28 questions at once. In the third session, the agent used Jev to audit its own written rules (asking “Is this ticket classification indisputable?”) and used the probability distribution to correct false positives from the keyword layer.
Installation and Activation¶
The DSH community directory displays this plugin at SkillHub (sourced from GitHub, with no official affiliation with DeepSeek / High-Flyer). After obtaining the plugin source code or release package, run the installation script from the README in the plugin directory:
node scripts/install.mjs
The script performs three actions: links this package’s node_modules to the profile, runs pnpm add link:<this dir> in the profile, and writes dsh-typesafe into dsh.profile.bundles (otherwise the loader will not read cordis.patch.yml). For non-default profiles, paths can be passed explicitly; uninstallation example:
node scripts/install.mjs "%DSH_HOME%\profiles\desktop"
node scripts/install.mjs --uninstall
Upon completion, restart DSH (or rely on patchReload: live to pick up bundle changes). The host and browser halves need to be confirmed separately; the README suggests looking for dsh-typesafe: Jev tools registered (model jev-latest) in the host logs.
Configuring API Key¶
Recommended: Settings → Plugins → Plugin configuration → TypeSafe (the card is at the end of the plugin list; a green dot indicates a stored key).
When no UI is available, use:
node scripts/set-key.mjs sk-your-key
node scripts/set-key.mjs --status
node scripts/set-key.mjs --unset
You can also set TYPESAFE_API_KEY in the environment where DSH is launched (environment variables take precedence over stored keys). Keys are requested at the TypeSafe Console. After configuration, you can run /typesafe in the session to verify.
Common configuration items (can be overridden in the Settings card or the profile’s cordis.patch.yml, all have default values) include: enabled, model (default jev-latest), promptOrder (default 700), guardEnabled, guardTools (glob matching external text-based tools), guardWarnThreshold, guardMinChars, etc.; for the full table, see the “Configuration reference” in the GitHub README.
Typical Usage¶
- Batch typed judgments: Call
typesafe_decideon a ticket or feedback text segment, juxtaposing multiplenoul/choice/scorequestions in a single request (README tests show up to 45/28 questions in one go). - Fixed branch routing: Use
typesafe_routeto select among predetermined destinations and setmin_confidence; when below the threshold, treat “uncertainty” as an explicit escalation signal rather than letting the main model guess verbally. - Untrusted content: Rely on the automatic guard for external fetch results; call
typesafe_screenwhen active auditing of a text segment is needed.typesafe_screenasks separate questions for injection and harm; the verdict isblocked/review/clear(see README for threshold logic). - Cost visibility: Regularly check
/typesafein long sessions to evaluate against the per-call magnitude published in the README (approx. $10⁻⁵ USD) to decide if it is worth using Jev to replace a round of reasoning.
The repository also provides session audit scripts (requires being in the plugin directory and knowing the sessionId):
node scripts/audit-session.mjs <sessionId>
node scripts/dump-call.mjs <sessionId>
Applicable Scenarios and Notes¶
More suitable for: Text triage, routing, rule engine self-checks, injection screening for external web pages/MCP fetch results, and other narrow-domain, enumerable decisions; when an independent signal with a different architecture from the main LLM is desired.
Points to note:
- The plugin runs with the current DSH process permissions. Before installation, please read the source code and license of 979569650/dsh-typesafe (package.json marks it as MIT).
- Without the prompt section or if the order falls deep within the tool directory, the agent may “have the tools but not use them”; the README’s long-context explanation mentions that the system prompt is reassembled per request and compaction does not cover node 0, but sections with earlier orders like memory may still occupy space—attention to
promptOrderand section copy is required. - The Guard skips automatic screening for content shorter than
guardMinChars; fail-open means that during API failures, content still reaches the model but should be annotated—when reading tool output, one must distinguish between “screened” and “guard did not run”. - The README includes empirical tests for Chinese scenarios, but the documentation still claims CJK is relatively weak; if thresholds and
modelare pinned, it is advisable to retest after upgrading the Jev version.
Conclusion¶
dsh-typesafe consolidates TypeSafe Jev into a decision layer on DSH: typed tools, confidence routing, an untrusted result guard, and a session cost table, using a prompt section to encourage the agent to invoke it at appropriate nodes. For directory and version information, see the SkillHub plugin page; for installation details, configuration tables, and test descriptions, refer to the GitHub repository README.