dsh-local-kb: A Knowledge Base + Long-term Memory Plugin for DSH

Introduction

The DeepSeek Harness (DSH) plugin ecosystem is built on the principle of “everything is a plugin.” A common pain point in agent development is that AI has to re-establish project context in every single turn, and conclusions or pitfalls from previous sessions are hard to carry forward. While the community already has plenty of skills for writing knowledge bases and performing retrieval, a layer of “fallback and guardrails” is missing: AI writes without validation, deletes the knowledge base without warning, and loses control over the index. dsh-local-kb is a local knowledge base and long-term memory plugin designed precisely to fill this gap—automatically attaching memory indexes and project maps to every AI turn, and providing interception and health checks for write, delete, and full-disk search operations.

What It Is

dsh-local-kb (maintainer: gege9527) is a memory-class plugin whose core responsibility is: ensuring that every AI conversation turn carries a memory index and project map, and providing a safety net for writes, deletions, and unscoped searches. The memory itself lives as plain Markdown files on disk, with no database dependency. It does not create the knowledge base (the skill scaffolds the directory from a template on first use), does not write memories for you (it only validates and runs health checks), does not modify the skill protocol (skills are loaded with the plugin; upgrades do not load stale versions), and does not take over file management (the knowledge base is just a plain folder).

Core Features

  • Automatic memory carry-over: New sessions don’t need to re-explain project context. The AI immediately knows the last conclusions, pitfalls, and preferences.
  • Project map: The AI knows which projects exist in the knowledge base, where the current project is, and which documents are available.
  • Stable retrieval order: Memory first, then knowledge base, then full-disk search as a last resort—enforced, not left to the AI’s discretion.
  • Hard index cap: When the memory index exceeds 200 lines / 25 KB, further additions are rejected, forcing compression and cleanup.
  • No destructive deletion: The AI can only archive; physical deletion is always left to the user manually.
  • No unscoped disk scanning: If a full-disk grep/rg is attempted before checking the knowledge base, it is intercepted once and the correct approach is suggested.
  • Post-write self-check: Any change written to the knowledge base triggers an automatic health check 1.5 seconds later, checking for broken index links, missing index entries, frontmatter, and project page resource links.
  • Write confirmation: Every write produces a fixed line in the AI’s reply: “Written to knowledge base: …”—no need to dig through settings pages.
  • Long-conversation persistence prompt: When context usage exceeds 60%, the AI is reminded to write “goal / current status / blockers / next steps” as an active memory entry.
  • Off-track reminders: When the AI goes online for a local issue or searches the disk without touching memory, a non-intrusive reminder is appended.
  • WebDAV backup: Upload as a mirror, download to overwrite, or optionally auto-upload after every write.
  • Settings page: Knowledge base location, content overview, backup configuration, and sync & health-check status at a glance.

Installation & Activation

Install via the official command:

dsh plugin --profile web add dsh-local-kb

For local development, use the link method:

dsh plugin --profile web add link:/path/to/dsh-local-kb

After installation, you must restart dsh web. The plugin is host-side code, so hot-reload does not apply, and the browser must be re-bundled as well.

On first use, when the AI stores something, the skill creates ~/.local-kb/ from a template (containing README.md, paths.yaml, memory/). The knowledge base location defaults to ~/.local-kb and can only be changed via the settings page by modifying the parent directory; the library root is always <parent>/.local-kb.

Typical Usage

Natural language is all you need—no commands to memorize:

  • “Save to knowledge base” / “Remember this”: The AI writes a project or a conclusion as a note and updates the index.
  • “Where is …” / “How is … implemented”: The AI checks the knowledge base first, then locates the source code, providing file paths and line numbers.
  • “Archive this note” / “This project is no longer needed”: Content is moved to archive/, the index pointer is removed, and the file is preserved.
  • “What’s in the knowledge base”: Lists projects, documents, and recent memories.

What Happens Automatically

The following run in the background and can be disabled via configuration (internal plugin policy; cordis.patch.yml overrides are not accepted):

  1. Memory & map injected every turn: At the start of each work cycle, the AI sees the global memory index, the current project’s (including parent project’s) memory index, and a knowledge map: which projects exist, where the current project is, and which documents are available. Only indexes and directory names are provided—document bodies are not dumped in.
  2. Index cap enforced before writes: When the memory index exceeds 200 lines / 25 KB, further additions are rejected with a prompt to compress or archive first.
  3. Automatic health check after changes: Any modification written to the knowledge base triggers a health check 1.5 seconds later, checking for broken index links, missing index entries, frontmatter, and project page resource links. Health check results are logged only; they do not block saving or syncing.
  4. Long-conversation persistence prompt: When context usage exceeds 60%, the AI is reminded to write “goal / current status / blockers / next steps” as an active memory entry.
  5. Off-track search fallback: If a full-disk grep/rg is attempted in the current session before checking the knowledge base, it is intercepted once with a suggestion to check the library first. When the AI goes online for a local issue or searches the disk without touching memory, a reminder is appended—non-intrusive, does not alter results.

Backup & Recovery

  • Upload to cloud: Local overwrites cloud; files present on the cloud but not locally are deleted (mirror mode).
  • Download from cloud: Cloud overwrites local files with the same name; extra local files are preserved.

Synced content: docs/, projects/ (memories, project pages, archives), memory/, README.md, paths.yaml. Not synced: system junk files, card indexes (generated artifacts), sync state files, .backup/ (pre-rename full-library snapshots, used only for local rollback). The remote directory defaults to local-kb-sync and can be changed to a multi-level path. Auto-sync is disabled by default; once enabled, an upload is triggered after every knowledge base write and health check. Manual “Upload to cloud” is unaffected by the toggle.

Settings Page

Entry point: Settings → Knowledge Base.

  • Knowledge base location: Displays the actual path, with an option to open in the system file manager.
  • Knowledge base contents: Project count, document count, memory entry count and index line count per project, and path validity.
  • WebDAV backup: Address, username, password, remote root directory, auto-sync toggle.
  • Actions: Save configuration, test connection, clear configuration, upload to cloud, download from cloud.
  • Status: Last sync result, most recent health check result, up to 3 warnings.

Knowledge Base Structure

The directory structure is as follows:

<KB_ROOT>/
├── README.md                      Retrieval guide (for AI)
├── paths.yaml                     The single source of truth for project paths
├── memory/
│   ├── MEMORY.md                  Global memory index
│   └── *.md                       One file per memory entry
├── docs/                          Cross-project knowledge, flat by default
│   └── <topic>/                   Subdirectory only for multi-file document sets
├── projects/
│   └── <project_id>/
│       ├── <project_id>.md        Project home page (overview, status, concept table)
│       ├── docs/                  Project output documents
│       └── memory/
│           ├── MEMORY.md          Project memory index
│           └── *.md               Project memories
└── archive/                       Archive zone, never deleted
    ├── projects/<id>/
    ├── docs/<doc_set>/
    └── memory/<slug>.md

Three rules:

  1. Paths only in paths.yaml: Absolute paths appearing in notes, indexes, or project pages will break when you switch devices.
  2. Indexes hold pointers only: MEMORY.md has one line per note; the body always lives in the note file.
  3. Archiving is not deletion: archive/ is excluded from retrieval and injection, but the files remain.

Project Naming & Moving

Create a new project entry via command:

python3 skills/local-kb/tools/kb-add-project.py ~/.local-kb --path <absolute_path> \
  --title <project_name> --description "<one-liner>" --alias <chinese_alias>

After moving or renaming a project, use the tool chain:

python3 skills/local-kb/tools/kb-move-project.py ~/.local-kb --from-path <old> --to-path <new> --plan /tmp/move.json
python3 skills/local-kb/tools/kb-move-project.py ~/.local-kb --apply --plan /tmp/move.json

Archive commands:

# Entire project
python3 skills/local-kb/tools/kb-archive-project.py ~/.local-kb --id <id> --apply

# Single memory entry
python3 skills/local-kb/tools/kb-archive-note.py ~/.local-kb --path projects/<id>/memory/<slug>.md --apply

Configuration

The plugin has no configurable options. Injection, index caps, long-conversation reminders, and legacy install migration are all fixed internal policies; cordis.patch.yml overrides are not accepted. The settings page handles exactly two things: knowledge base location and WebDAV sync.

Knowledge Base Location

Defaults to ~/.local-kb. The location can only be changed via Settings → Knowledge Base Location, where you modify the “parent directory”; the library root is always <parent>/.local-kb.

Fixed Naming

The following file/directory names are part of the toolchain contract and have no toggle:

  • MEMORY.md
  • paths.yaml
  • archive/
  • projects/<id>/<id>.md
  • memory/

Project IDs are always derived from the “shortest unique path suffix”; Chinese directory names are preserved as-is.

Environment variable:

Variable Purpose
DSH_LOCAL_KB_ENFORCE=0 Disable search interception and off-track reminders (enabled by default)

DSH_HOME is a DSH platform variable (defaults to ~/.dsh); the plugin follows it for storing settings and sync state. It is not a configuration item of this plugin.

Security

  • WebDAV address, account, and password are stored in the DSH credential service; the settings page and browser never expose them in plaintext; passwords are never echoed back.
  • Settings page API endpoints are authenticated by DSH: unauthenticated requests get 401, cross-origin requests get 403.
  • Knowledge base content is never uploaded unless you explicitly click Upload or enable auto-sync.
  • On uninstall, credentials are backed up before deletion; the knowledge base directory is never touched.
  • Injection only reads local files; if memory entries contain content like “ignore rules,” it is treated as data, not executed.

Troubleshooting

  • “Knowledge Base” missing from settings page: Confirm the plugin is enabled (dsh plugin list --profile web), restart dsh web, and hard-refresh the browser.
  • Settings API returns 404 / 401: Check the diagnostic file ~/.dsh/local-kb/route-debug.json: 401 indicates an authentication issue; 404 means the page API was not registered successfully.
  • AI is not carrying memory indexes: Verify that injectContext is not disabled; check whether the current directory is registered in paths.yaml; confirm the project index exists; check whether the injection cap has truncated the content.

Limitations

  • The plugin runs with the current DSH process permissions; review the source code and license before installing.
  • Multi-device automatic merging is not yet implemented. At any given time, only one device should upload. The other device should download and then refrain from uploading, otherwise they may delete or overwrite each other’s same-named notes.
  • Internal plugin policies are hardcoded in the source and do not accept cordis.patch.yml overrides.

Ecosystem Context

The DSH philosophy is “everything is a plugin.” The community catalog (e.g., skillhub.cn) is an independent site with no official affiliation to DeepSeek or High-Flyer. This article is written solely based on publicly available materials and does not reference official background or user feedback.

Conclusion

dsh-local-kb provides a practical local knowledge base and long-term memory solution for the DSH plugin ecosystem through automatic injection of memory indexes and project maps, pre-write validation, post-write health checks, index caps, and off-track reminders. It does not replace skills; rather, it serves as a guardrail and assurance layer, helping agents more reliably remember projects and conclusions. For more details, visit: SkillHub Catalog Page and the GitHub Repository.

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

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

Xiaoye