dsh-error-improvement
Manifest valid★ 1Standalone DSH plugin: user-confirmed anti-regression lessons for DeepSeek Harness
DSH Error Improvement
English | 中文
A standalone DeepSeek Harness plugin that turns user-confirmed mistakes into bounded pre-task checks, helping an agent avoid repeating the same error.
It is intentionally independent from EverOS, memory services, databases, browsers, and network APIs. The only persistent state is the normal DSH settings namespace error-improvement.
Tested with DSH 0.1.2-rc.1 (Node 22.19+ or 24+).
Safety contract
- A lesson is injected only when its
confirmedcheckbox is enabled. - The plugin never creates lessons automatically from model output.
- It never executes tools or changes permissions.
- It never modifies Desktop mode, browser access, network exposure, sandbox presets, or approval policy.
- Injected text uses plugin provenance (
form: instructions), never direct-user provenance. - Stored lesson text is fenced, control-character cleaned, role-tag encoded (all
<and>are escaped), count-limited, and character-limited. - Lessons are rendered atomically: a lesson is included only if the entire block fits the character budget; otherwise it is omitted entirely (no mid-rule truncation).
- Any runtime rendering failure fails open: the original downstream agent decision is returned unchanged.
How it works
- The Host registers the
error-improvementsettings section through DSH's settings provider. - In Settings → 错误改进, the user records a mistake, a prevention rule, optional scope/keywords, and explicitly confirms it.
- On every model step of each turn, the Host wraps the
agent/pre-stepwaterfall and inspects the complete downstream message batch. Unlike a one-shot injection at the first step only, this ensures prevention rules are visible before every LLM call — including follow-up tool calls that the model makes within the same turn. assistmode injects only lessons whose explicit scope/keywords match the current direct-user message. Latin/digit keywords require whole-token equality (no substring false positives); CJK uses bigram matching. If scope/keywords are blank, it falls back to conservative multi-term matching.strictmode injects all enabled, confirmed, complete lessons up to the configured limits.
strict is a stronger prompt policy, not hard enforcement. It never expands model or tool capabilities.
Repeated errors graduate into rules (0.2.0)
- The Host listens to
tools/post-executeand counts identical failures (same tool + same normalized error signature). Counts persist across restarts in$DSH_HOME/error-improvement/state.json. - Once a failure crosses
enforcement.threshold(default 3), it is promoted into a rule — linked to a matching confirmed lesson when one exists, otherwise synthesized from the error sample as an auto-rule. - Matching future calls (same tool + sufficiently overlapping arguments) are intercepted on
tools/pre-execute:warn(default): intercepts once per cooldown window (warnCooldownMs, default 1h), showing the model the prevention reason; an immediate retry is allowed — a reminder, not a blockade;deny: always blocks, for calls that must never happen again.
- Every hook fails open (a plugin error never blocks the tool pipeline) and never weakens an existing downstream deny/ask into an allow. Rules are capped by
maxRules(default 20); only the oldest auto-rules are evicted beyond the cap, lesson-linked rules are kept.
Success recipes (0.2.0)
- After solving a non-trivial problem, the agent can call the
improve_record_recipetool to persist the verified solution (title/problem/solution/scope/keywords) into the same state file. - Recipes share the lessons' relevance engine (including CJK bigrams) and render in a
<success_recipes>block next to the lessons, so a recurring problem is answered with the proven fix instead of being re-derived from scratch. - Recording with
asSkill: truegraduates the recipe into a standalone skill file at$DSH_HOME/skills/<slug>/SKILL.md— experience becomes capability. - Recipes can also be maintained manually in the
recipes[]settings section (injection likewise requiresconfirmed).
Settings
| Field | Default | Meaning |
|---|---|---|
enabled | true | Enables lesson injection. |
mode | assist | assist matches relevant rules; strict injects all eligible rules. |
maxLessons | 5 | Maximum injected rules per turn, clamped to 1–50. |
maxChars | 6000 | Maximum complete lesson block, clamped to 500–50000 characters (shared by lessons and recipes). |
maxRecipes | 3 | Maximum injected recipes per turn, clamped to 1–20. |
lessons[] | [] | User-managed lesson records. |
recipes[] | [] | User-managed success recipe records. |
enforcement.enabled | true | Enables repeated-error counting and pre-execution interception. |
enforcement.threshold | 3 | Identical errors required before promotion into a rule, clamped to 2–10. |
enforcement.defaultMode | warn | Default mode for new rules: warn one-shot reminder / deny hard block. |
enforcement.warnCooldownMs | 3600000 | Minimum milliseconds between two warn interceptions of one rule. |
enforcement.maxRules | 20 | Rule cap; oldest auto-rules are evicted beyond it. |
Context compaction
| Field | Default | Meaning |
|---|---|---|
compaction.enabled | true | Enables automatic pre-step pressure compaction and context-overflow recovery. |
compaction.thresholdRatio | 0.8 | Start normal compaction once the active conversation route reaches this fraction of its advertised context window. |
compaction.retainRatio | 0.16 | Recent conversation fraction retained verbatim; it must be lower than thresholdRatio. |
compaction.summarizationProvider / summarizationModel | empty | Primary summary route. Leave both empty to use the active conversation route. The pair must be complete or both blank. |
compaction.fallbackSummarizationProvider / fallbackSummarizationModel | empty | Explicit fallback summary route when the primary call fails (for example, exhausted balance or authentication/provider failure). The pair must be complete or both blank. |
compaction.maxTokens | 8192 | Maximum summary output tokens. |
When the primary route is configured but its summary call fails, the plugin tries the explicit fallback route once. If no explicit fallback is set, it retries using the current conversation route when that is different. It never chooses an arbitrary provider/model: a route must already be known to DSH, so recovery stays predictable and reproducible. The upstream DSH engine records the normal durable transaction (compaction/start → summary → checkpoint replacement → compaction/end) and then retries a context-overflow request only after the replacement was committed.
⚠️ Threshold and summarization model context window. If your summarization model has the same advertised context window as your conversation model, the default threshold of
0.8(80 %) can cause a chicken-and-egg problem: the compaction engine fires once the conversation reaches 80 % of the context window, but the summarization call then sends the full conversation to the same model and overflows its limit. Setcompaction.thresholdRatioto0.5or lower so compaction starts well before the conversation fills the window, leaving enough headroom for the summarization request. Alternatively, configure a different summarization model with a larger context window.
A lesson contains:
{
"id": "stable-unique-id",
"title": "Verify the active profile",
"mistake": "Edited a different profile from the one used by Desktop",
"prevention": "Confirm the active profile before editing any profile files",
"scope": "DSH Desktop profile changes",
"keywords": "desktop profile package.json",
"confirmed": true,
"enabled": true
}
Install into DSH Desktop
Do not edit DSH Desktop security settings (mode, openBrowser, networkExposure, sandbox presets). Install through the normal DSH profile plugin mechanism, then restart DSH Desktop once.
From GitHub (recommended)
Add this to your DSH Desktop profile's package.json (the file at C:\Users\<you>\.dsh\profiles\desktop\package.json):
{
"dependencies": {
"dsh-error-improvement": "https://github.com/wbushihenshuai-design/dsh-error-improvement"
}
}
Also add "dsh-error-improvement" to the dsh.profile.bundles array in the same file.
Then run in the profile directory:
pnpm install
Restart DSH Desktop. The settings section appears under Settings → 错误改进.
From a local checkout (development)
{
"dependencies": {
"dsh-error-improvement": "link:D:/work/DS/dsh-error-improvement"
}
}
Preserve all existing bundles and dependencies when merging. The plugin's cordis.patch.yml mounts exactly one Host row; its dsh.client metadata loads the Settings UI.
Before installing into a live Desktop profile
- Run
npm run ciin this repository. - Make a backup of the profile's
package.json, lockfile, andcordis.patch.yml. - This repository does not include an auto-installer because silently rewriting a live profile is unsafe.
Build and verify
Requires Node.js 22.19+ or 24+.
npm install
npm run ci
npm run pack:check
The CI command performs formatting/lint checks, TypeScript checks, 24 Host/client/matching/integration tests, production build, safety preflight scan (all published JS files), and a clean-consumer pack smoke test that installs the tarball into a fresh node_modules and imports the real artifact.
Development layout
src/index.ts— Host registration and pre-step middleware.src/lessons.ts— schema, matching, sanitization, atomic rendering, message provenance.src/client.js— immediately loaded Settings UI with conflict-aware save controller.test/— Host, matching, safety, client controller, and integration tests.scripts/preflight.mjs— scans all published JS for forbidden coupling.scripts/pack-smoke.mjs— clean-consumer tarball install + import verification.
Privacy
No telemetry and no network requests. Lessons remain in the user's DSH settings document and are sent only as part of the local agent context when selected.
License
MIT © 2026 wbushihenshuai-design
Comments
Loading…
From the same category
by deepseek-ai
DeepSeek Harness: Everything is a Plugin.
★ 234.6k
MIT
TypeScript
Sep 23, 2026
by nexu-io
🎨 Best DeepSeek Harness Design Plugin. The open-source Claude Design alternative. 🖥️ Local-first desktop app. 🖼️ Your coding agent becomes the design engine: prototypes, landing pages, dashboards,
★ 97.9k
Apache-2.0
TypeScript
Sep 24, 2026
by tt-a1i
Agent skill for beautiful, verifiable architecture, workflow, sequence, data-flow, and lifecycle diagrams—self-contained HTML with motion and crisp export.
★ 70.8k
↓ 3.5k/wk
MIT
JavaScript
Sep 24, 2026
dsh plugin --profile agent add @tt-a1i/archify-dshby Tencent
Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
★ 29.5k
↓ 838/wk
NOASSERTION
Go
Sep 24, 2026
dsh plugin --profile web add @wxg-prc-cpg/dsh-weknoraby awesome-dsh-plugin
A curated list of plugins for DeepSeek Harness (dsh) · DeepSeek Harness 插件精选列表
★ 16.8k
CC0-1.0
Python
Sep 24, 2026
by zhu1090093659
DeepSeek Harness (DSH) Web Plugin Aggregation Ecosystem · Everything is a plugin, distributed via the Creative Workshop
★ 8k
Apache-2.0
TypeScript
Sep 24, 2026
dsh plugin --profile web add dsh-web