Introduction

In the DeepSeek Harness (DSH) ecosystem, building agent memory mechanisms usually relies on static retrieval pipelines. Once retrieval fails, the pipeline ends, and the system cannot automatically fill knowledge gaps. The dsh-learn-wiki plugin solves this by introducing CRAG-style corrective retrieval: if retrieval from the knowledge base fails, it automatically learns and consolidates the knowledge, so the next lookup hits directly.

The plugin is maintained by Dayi-Z and is positioned as a workflow plugin. It does not reimplement Hindsight’s L2 episodic memory; instead, it focuses on L1 Markdown knowledge base storage, miss detection, and rate-limited L3 Web acquisition.

Core Architecture

The plugin uses a three-tier knowledge architecture to manage knowledge flow:

  • L1 (Markdown Knowledge Base): A standalone Markdown repository that stores curated knowledge pages. Strong hits are injected directly.
  • L2 (Hindsight): Raw episodic memory. Semantic recall is handled by the existing hindsight plugin, and this plugin does not reimplement it.
  • L3 (Web): Fallback supplementation, using rate-limited Web access through ctx.web.

Installation

The plugin is implemented in pure JS, requires zero build steps, and declares its dependencies via peerDependencies.

# 从 GitHub 安装
dsh plugin --profile web add github:Dayi-Z/dsh-learn-wiki

# 本地开发(直接链接源码目录)
dsh plugin --profile web add link:D:/Harness/dsh-learn-wiki

Configuration

The configuration source precedence is: code default values → <wikiRoot>/wiki.config.json → the second argument of apply(ctx, config). Key configuration items are listed below:

Configuration Item Default Value Description
wikiRoot D:\Harness\dsh-wiki Root directory of the L1 repository
autoContext true Automatically inject retrieval results as the first step of each turn
autoAcquire true Background acquisition (non-blocking); the trigger condition is determined by gapTrigger
gapTrigger 'struggle' Signal for triggering acquisition: 'struggle' (default), 'miss', 'both', 'off'
hitThreshold 0.20 score ≥ this value → hit (inject page body)
weakThreshold 0.15 score ≥ this value → weak (inject title index only)
maxAcquisitionsPerRun 2 Maximum number of gaps processed in a single background acquisition run

Explicit Tools

In addition to the automatic mechanisms, the plugin provides a set of explicit tools for model invocation:

  • wiki_recall: Explicitly retrieves L1 and returns a three-bucket decision plus page body.
  • wiki_learn: Explicitly persists a knowledge item (defaults to staged).
  • wiki_harvest: Extracts knowledge from a conversation (current or historical session), defaulting to staged.
  • wiki_sessions: Reads historical sessions. Supports list (list), brief (briefing), walls (recurring obstacles across sessions), and show (details).
  • wiki_review: Views the staged queue and gaps queue.
  • wiki_commit: Moves staged → pages; this is the only gate for promotion into L1.

Implementation Details and Notes

  • Staging Mechanism: staged/ never participates in recall. Items must be committed before they are promoted to L1. This reduces the attack surface for poisoning.
  • Traceability Requirement: Items without sources cannot be committed. Each knowledge item must be traceable to a URL or file.
  • Session Parsing: Session files use a custom frame parsing format with the magic number 28 B5 2F FD. The version number is read from the event stream header; the filename serves only as a copy.
  • Struggle Detection: The default trigger is struggle (stuck), rather than a simple retrieval miss (miss). This avoids noise from new topics.

Learn More

Plugin directory: https://www.skillhub.cn/plugins/Dayi-Z/dsh-learn-wiki

GitHub: https://github.com/Dayi-Z/dsh-learn-wiki