Introduction

The DeepSeek Harness (DSH) plugin ecosystem emphasizes “all as plugins.” When developing or using an Agent, the transient nature of conversational context is a common problem. After a session ends, historical information is often difficult to reuse. dsh-okf-memory is designed to solve this problem. It automatically distills high-value content from conversations into long-term memory according to the OKF v0.1 specification, and supports automatic recall across sessions.

This plugin is maintained by ZHI-QI and is driven by neural self-learning. It can continuously update memory weights based on user feedback (such as selections or corrections), becoming more accurate with use.

Installation and Activation

The plugin is published on npm and supports any profile (such as web). No build script is required during installation.

dsh plugin --profile web add dsh-okf-memory

After installation, the plugin injects a “memory discipline” system prompt into the Agent, allowing it to autonomously decide whether to record or query during a session. It has zero runtime dependencies and can be used immediately after installation.

Core Features

1. Four-Stage Memory Closed Loop

The plugin establishes a complete memory processing pipeline: capture (identify high-value content) → conceptualization (structured organization) → consolidation (persist to disk) → recall (retrieve on demand).

2. OKF v0.1 Specification Compliance

Each concept is stored as a standard Markdown document. Every file must include the type field in its frontmatter. The directory structure uses index.md (progressive index) and log.md (change history), and supports cross-linking using absolute paths within the package.

3. Neural Self-Learning Driven

  • Predictive recall: Make a prediction before retrieval, then validate through retrieval.
  • Uncertainty quantification: When confidence is low, expand the exploration range.
  • Prediction-error-driven capture: Writes are triggered when the user corrects the Agent or discloses a new fact for the first time.
  • Weight decay and archival: Weight decay implements forgetting, while an archival mechanism consolidates memories.

4. Reinforcement Feedback Loop

Memory weight updates follow the formula: score = relevance × weight × recency. When a user selects a candidate memory, its weight increases; when a candidate is skipped, its weight decreases, enabling dynamic adjustment.

5. Technology Choice Memory

For dimensions such as frontend, backend, language, solution, and configuration, the plugin captures candidate lists and current usage status. The processing rules have three levels:
* If 2 or more candidates are matched: Show all of them to the user for selection.
* If 1 candidate is matched: Use it directly.
* If the user does not specify a choice but a dimension keyword is matched: Process it according to that dimension’s memory.

6. Write Permission Gate

The write process includes strict validation: checking type validity → deduplication (complementary entries are not copied; cross-links are created between them) → OKF compliance validation.

7. Memory Graph Visualization

The DSH web chat view provides a force-directed graph view (web profile only). Node size represents weight, color represents type, and edges represent cross-links. It supports wheel zoom, drag panning, node dragging, and hover to view details.

Typical Usage

Writing Memory

The Agent automatically determines when to call the okf_remember tool. Users can also trigger it manually, for example:

记住,我的三家门店是韶山/湘乡/塘厦,共用局域网共享文件夹

The Agent will consolidate it as fact/门店布局.

Recording Technology Choices

Once the user makes a final decision, the Agent records the technology choice:

前端就用 React 18 + Vite 吧

The Agent will consolidate it as techchoice/前端方案, including the candidate list and current active status.

Recalling Memory

When a user asks a related question, the Agent automatically performs okf_search. For example:

查一下记忆里关于XX的

Or when directly asking a database-related question, the Agent first retrieves memory, then executes the relevant service.

Memory Repository Structure

The default memory repository root is ~/.dsh/memory/, which can be overridden by the environment variable OKF_MEMORY_ROOT.

~/.dsh/memory/
├── index.md              ← 渐进式目录(okf_version: "0.1")
├── log.md                ← 变更历史(## YYYY-MM-DD)
├── fact/                 ← Fact 背景事实
├── preference/           ← Preference 用户偏好
├── decision/             ← Decision 决策
├── method/               ← Method 方法论
├── insight/              ← Insight 洞察
├── idea/                 ← Idea 未成型灵感
├── lesson/               ← Lesson 经验教训
├── techchoice/           ← TechChoice 技术选型
└── .meta/weights.json    ← 学习权重元数据

Notes

  1. Visualization Limitations: Memory graph visualization is supported only in the web profile and can be accessed via the /okf-graph route.
  2. Running Permissions: The plugin runs with the permissions of the current DSH process. Check the source code and license before installation.
  3. Filtering Mechanism: The plugin does not record small talk, one-off tasks, or duplicate content from existing memory.
  4. Graph Interface: Graph data can be obtained via the okf_graph tool or the /okf-graph route, in {nodes,edges,timeline} JSON format.

Conclusion

By introducing the OKF v0.1 standard and neural self-learning mechanisms, dsh-okf-memory provides DSH Agent with a practical solution for knowledge consolidation. It is suitable for developers who need to maintain long-term project context, manage technology choice decisions, or accumulate team experience.