dsh-plugin-agents-loader: Automatic Discovery and Loading of Local Agent Configurations

Preface

In the DSH (DeepSeek Harness) plugin architecture, extending agent capabilities typically involves manually configuring MCP servers or writing slash commands. The dsh-plugin-agents-loader plugin automatically scans the ~/.agents directory, mounting local configurations directly into the runtime environment with hot-reload support, thereby reducing repetitive manual orchestration work.

Core Features

The plugin provides the following capabilities:

  1. MCP Server Loading: Reads ~/.agents/mcp.json, automatically creates ctx.plugin(dsh-mcp-client, ...), and supports both http and stdio transport protocols.
  2. Slash Command Registration: Scans ~/.agents/commands/*.md, registers the filename as the command name, and injects the body content into the Agent upon triggering.
  3. Agent Instruction Migration: On first run, links ~/.agents/AGENTS.md to DSH’s native instruction location (~/.dsh/AGENTS.md); subsequent changes to the source file are automatically synced.
  4. Hot Reload: Monitors configuration file changes and automatically rebuilds dynamic resources via a 500ms debounce mechanism, without requiring a process restart.

Installation & Prerequisites

Before using this plugin, ensure your environment meets the following conditions:

  • dsh version: 0.1.7-rc.2 (corresponding to cordis 4.0.4). Peer dependencies are precisely locked; mismatches will cause the installation to fail directly.
  • pnpm: Plugin installation depends on the pnpm environment.

The installation command is as follows:

dsh plugin --profile web add https://github.com/CrazyPigHead/dsh-plugin-agents-loader.git

If you need to modify the source code, it is recommended to clone the repository and install using a local path:

git clone https://github.com/CrazyPigHead/dsh-plugin-agents-loader.git
dsh plugin --profile web add /path/to/dsh-plugin-agents-loader

Configuration

The plugin primarily relies on three files/directories under the ~/.agents directory.

MCP Server Configuration

Create ~/.agents/mcp.json. Configuration entries support the enabled field to control loading, and timeoutMs to set the timeout.

{
  "mcpServers": {
    "context-7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp",
      "headers": { "Authorization": "Bearer {CONTEXT7_API_KEY}" }
    },
    "local-tool": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "some-mcp-server"]
    }
  }
}

Slash Command Configuration

Create .md files under ~/.agents/commands/. The filename serves as the command name, and the description in the frontmatter serves as the command description.

---
description: Create conventional git commit
---

## Goal
Create conventional git commits...

## Workflow
1. `git diff --staged`
2. `git commit -m "feat: add new feature"`

Verification & Debugging

After installation, you can verify whether the plugin has been mounted via the CLI:

dsh --profile <name> --dump-config | grep -A1 agents-loader

In an Agent session, type / to view the command list, or try executing a registered slash command. After modifying the configuration file, the log should display reload scheduled and the changes will take effect automatically.

Notes

  1. Version Compatibility: You must use dsh version 0.1.7-rc.2 or above, and the pnpm environment is required.
  2. Source Code Modifications: After installing via pnpm link, if you modify the source code, you need to restart the dsh process for changes to take effect (due to Node.js module caching).
  3. Local Installation: When installing via a local path, the cloned directory must be retained; subsequent updates should be done via git pull.
  4. Profile Management: Do not manually modify package.json under the profile directory or run pnpm directly, as this will bypass version checks and write locks.
羽毛球分组比赛记分
小程序二维码

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

Xiaoye