Preface

In the development of DeepSeek Harness (DSH), preventing agents from repeating mistakes and reusing successful experiences are key to improving robustness. Traditional memory mechanisms often rely on external services or lack an explicit confirmation process. The dsh-error-improvement plugin directly addresses this pain point: it converts results produced during agent runs into persistent memory that becomes effective only after user confirmation, turning “errors” into prevention rules, “validated fixes” into recipes, and ultimately elevating battle-tested entries into standalone skills.

Plugin Positioning

This is a DeepSeek Harness plugin (owner: wbushihenshuai-design). It is a pure file-based storage system independent of EverOS, memory services, databases, browsers, and network APIs. All persistent state is stored in plain Markdown files under the $DSH_HOME/error-improvement/ directory. The plugin adopts a “safety protocol,” injecting memory only when confirmed: true, ensuring that agents do not silently write unauthorized output.

Core Features

The plugin’s core workflow and mechanisms are described below.

1. Capture and Confirmation

  • Zero-LLM Capture: The plugin listens to tool execution results and queues errors and outcomes directly into candidates.jsonl without going through an LLM queue.
  • Controlled Distillation: When the queue reaches capture.minQueueSize and the interval satisfies capture.minIntervalMs, the LLM is activated to generate drafts. Drafts are stored in the drafts/ directory.
  • User Confirmation: Drafts are not silently written to memory. They first appear in Settings → Error Improvement → Pending Drafts. Users can approve or reject them.
  • Exception Tool: Agents can persist an already validated solution by calling the improve_record_recipe tool; this is treated as an exceptional case.

2. Injection and Memory

  • Three Modes:
    • assist (default): Experiences relevant to the current context are injected as suggestions.
    • strict: All confirmed experiences are injected as rules.
    • off: Capture only; no injection.
  • Rendering Rules: Injected text is cleaned of control characters and role-tag encoded (escaping < and >), and rendered atomically (if a block exceeds the character budget, it is omitted entirely rather than truncated).
  • Source Identification: Injected content uses the plugin source (form: instructions) and includes recursion protection (<SUBAGENT-STOP>).

3. Error Prevention (Enforced Rules)

  • Repeated Error Detection: The plugin listens to tools/post-execute and aggregates identical failure patterns (tool name + normalized error signature).
  • Escalation to Rule: When the failure count exceeds enforcement.threshold (default 3), the error is promoted to a runtime rule.
  • Interception Mechanism: Matching calls are intercepted during the tools/pre-execute phase:
    • warn (default): Intercept during the cooldown period, display the reason, and allow retries.
    • deny: Block the call directly.
  • Fail-Open: Every hook and file/LLM operation is designed to “fail open,” so plugin errors do not block the tool pipeline or agent loop.

4. Recipes and Skill Promotion

  • Recipes: Validated solutions saved via the improve_record_recipe tool are stored in recipes.md and share the relevance engine with experiences.
  • Skill Promotion: Entries accumulate hit (hit count) and mature. Entries that reach graduation.minHits (default 3) are proposed as skills. After approval, they are written to disk as a $DSH_HOME/skills/<slug>/SKILL.md file.

Installation and Enabling

The plugin targets DSH 2.0.15+ (requires Node 22.19+ or 24+). It is enabled through a profile configuration file rather than a traditional npm install command (no specific installation command is provided in the facts; deploy it via a directory or package manager and then configure it).

The configuration file is located at ~/.dsh/profiles/<profile>/cordis.patch.yml. The plugin is enabled by declaring the Schemastery schema.

Typical Usage

  • View Drafts: Go to Settings → Error Improvement → Pending Drafts, then review and process pending entries.
  • Tool Operations: In an agent session, call the improve_review_drafts tool to list and manage drafts.
  • Record Recipes: After solving a problem, call the improve_record_recipe tool to persist the solution as a recipe.
  • Candidate Queue: Results are automatically converted into entries in candidates.jsonl.

Use Cases and Considerations

  • Use Cases: Scenarios requiring long-term memory, preventing agents from repeating mistakes, and solidifying validated workflows into skills.
  • Considerations:
    • Permissions: The plugin runs with the current DSH process’s permissions. Review the source code and license before installation.
    • Data Migration: Settings from older versions (0.2.x) are not automatically migrated to the new cordis.patch.yml; manual configuration is required.
    • Data Storage: All data is stored in the local file system and does not depend on EverOS or other services.
    • Cleanup: Stored text is cleaned of control characters, and file writes use atomic operations (write to a temporary file first, then rename it).

Summary

dsh-error-improvement provides a complete loop from “error capture” to “user confirmation,” then to “prevention injection” and “skill promotion.” It ensures memory quality through a mandatory confirmation mechanism and ensures independence through file-based storage, making it suitable for DSH agent development that prioritizes high reliability and reusability.

GitHub Repository