dsh-knowledge-bridge: Zero-Configuration Host-Level Knowledge Base Access and Security Protection

Preface

DeepSeek Harness (DSH) agents typically run in sandbox environments and cannot directly read the file system on the host machine. This leads to two common issues: first, agents cannot access team-shared knowledge bases (such as Antigravity’s ~/.gemini directory), and are prone to misjudging “file does not exist” when encountering file permission issues; second, agents may mistakenly execute destructive commands such as git reset --hard or rm -rf, resulting in data loss.

dsh-knowledge-bridge is a Cordis plugin that runs at the host machine level. It uses host process permissions to read the file system, provides three retrieval tools to agents, and injects an instruction to inform the model of the existence of the knowledge base. At the same time, it has a built-in destructive Shell command safety mechanism.

Core Features

Retrieval Tools

The plugin exposes the following three tools to agents:

  • knowledge_search: Keyword-based search. It has a clear weighting system: title 10, ID 8, alias 8, tag 6, reference 4, summary 3, artifact name 2, body 1. Search results include ID, title, score, truncated summary, and artifact list, without directly returning file content.
  • knowledge_read: Reads the full document or a specific artifact (such as master_guide.md) on demand.
  • knowledge_list: Provides a directory outline of the knowledge base, including ID, title, number of artifacts, and a one-line preview.

Configuration & Discovery

  • Zero-configuration discovery: The plugin automatically finds knowledge bases from the environment variable DSH_KNOWLEDGE_PATHS or a series of known locations. Default paths include ~/.gemini/antigravity-ide/knowledge, ~/.antigravity-ide/knowledge, ~/.dsh/knowledge, ~/.codex/knowledge, and ./knowledge and ./docs/knowledge under the current directory.
  • Rule injection: The plugin discovers AGENTS.md, GEMINI.md, or CLAUDE.md from the workspace and injects them into the system prompt.
  • Version & update information: The knowledge_info tool returns the currently installed version, update command, restart requirements, and version check results.

Security Protection

  • Safety guardrails: The plugin intercepts commands matching forbidden patterns (such as git reset --hard, rm -rf, etc.) in bash, pwsh, cmd, or terminal invocations to prevent agents from performing destructive operations.
  • Token optimization: Tool summaries are truncated to avoid token overflow caused by overly long outputs in subsequent conversations.

Installation & Activation

Environment Requirements

  • Node.js version must be >= 20.0.0.
  • The plugin itself has no external dependencies and only uses Node.js built-in modules (node:fs, node:path, node:os).

Installation Steps

Execute the following command in the DeepSeek Harness terminal:

dsh plugin --profile <profile> add https://github.com/Babydunx1/dsh-knowledge-bridge

After installation is complete, DeepSeek Harness needs to be restarted to load the new JavaScript modules.

Typical Usage

After installing the plugin, you can verify its functionality through the project’s built-in scripts. These commands can run without DeepSeek Harness intervention:

# Run the test suite
npm test

# Validate static checks for the build contract
npm run validate

# Demo: Index an example knowledge base and print what the agent will see
npm run demo

Use Cases & Notes

  • Positioning statement: This is not a memory system that loads the entire knowledge base (2MB may produce about 1M tokens) into the prompt, nor is it a vector database. It uses deterministic keyword scoring without relying on embedding services.
  • Permission statement: The plugin runs with host machine permissions and can access paths specified by environment variables, but it does not automatically mount the entire directory into the agent’s context; instead, it retrieves on demand.
  • Environment variables: You can override the default discovery paths by setting the DSH_KNOWLEDGE_PATHS environment variable.
  • Platform support: Supports Windows, macOS, and Linux.

Summary

dsh-knowledge-bridge solves the risks of agents being unable to obtain external knowledge and making erroneous operations in sandbox environments. It provides reliable knowledge layer support for DeepSeek Harness through zero-configuration discovery, on-demand retrieval, and anti-destruction mechanisms.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye