Introduction

DeepSeek Harness (DSH) conversations are usually temporary. As turns increase, the history consumes the context window. This plugin freezes meaningful turns into documents instead of injecting all of them into the prompt.

Plugin Overview

Name: dsh-knowledge-sync

Maintainer: liugu2023

License: MIT

This plugin freezes each turn of a DSH session into a knowledge base document, allowing later conversations to search for them. When a session ends, the questions asked, conclusions reached, and tools executed are recorded as a Markdown file and are not sent to the model for processing.

Core Features

The plugin provides the following core capabilities:

  • Markdown Documents and YAML Front Matter: Each document is a Markdown file with YAML front matter recording metadata, such as ID, title, session, turn, type, and so on.
  • Significance Filtering: Only turns that pass significance filtering are saved. Depending on the configuration, overly short turns or turns lacking substantive content, such as status reports only, are discarded.
  • Credential Redaction: Before writing to disk, sensitive information in tool parameters, such as tokens, passwords, PEM keys, and so on, is automatically removed. Additional redaction regular expressions can be configured.
  • Full-Text Search: Full-text search is implemented based on an in-memory BM25 index and supports searching document bodies, not only titles.
  • Workspace Isolation: The knowledge base is scoped to the current directory, ensuring that knowledge from different projects does not interfere with each other.
  • Tools and UI: Provides knowledge_search and knowledge_read tools, and includes a knowledge management and configuration interface in the settings page of the Web UI.

Installation and Enabling

Run the following command in the terminal to install the plugin:

dsh plugin --profile web add dsh-knowledge-sync

After installation, you can view the status in the Knowledge section of the settings page in the Web UI.

Typical Usage

Document Storage Location: Documents are stored by default under the ./knowledge directory, or in the location specified by the environment variable DSH_KNOWLEDGE_ROOT. The file path is usually <root>/<session>/<id>-<slug>.md.

Document Types:
* raw: A raw turn that passed significance filtering.
* note: A record generated when the agent manually calls the knowledge_note tool during execution.
* distilled: A compressed turn summary produced by the optional distillation feature.

Tool Usage:
During a conversation, the agent can operate on the knowledge base using the following tools:
* knowledge_search: Search the document library, with support for filtering by type, tags, or tools.
* knowledge_read: Read the full document for a specific ID.

Configuration:
In the settings page of the Web UI, go to the Knowledge section. In the Config tab, you can modify the configuration in real time, including the root directory path, redaction rules, significance threshold, distillation toggle, and more.

Notes

  • Search Mechanism: The current implementation is BM25-based lexical search and does not support semantic search with embeddings. This means phrases that have never appeared cannot be searched.
  • Directory Isolation: Knowledge retrieval is limited to the current directory. Sessions located in a subdirectory of the workspace where knowledge is recorded cannot access that knowledge base.
  • Dependency Versions: Developing the plugin requires consistent versions of the @deepseek-ai/* packages published in the DSH installation package. Exact versions are recommended instead of version ranges to avoid introducing outdated packages.

Conclusion

dsh-knowledge-sync addresses DSH session context management by structuring conversation turns into searchable documents. It provides directory-based isolation and efficient in-memory retrieval, making it suitable for development scenarios that require maintaining a knowledge base across long sessions.

This plugin is available in the community directory: https://www.skillhub.cn/plugins/liugu2023/dsh-knowledge-sync
Source code repository: https://github.com/liugu2023/dsh-knowledge-sync