dsh-plugin-dev

A guide for building and debugging plugins for DeepSeek Harness, a developer-preview tool built on the Cordis component framework. It explains how plugins are exported, loaded, and connected to services.

In plain words
What is it for?
Use it when creating a TypeScript plugin, fixing a plugin that does not load or inject correctly, or understanding Cordis component lifecycles.
Why use it?
It helps avoid loading failures caused by incorrect exports, dependencies, or file paths, especially while the preview tool may still change.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pingfanfan/hello-dsh/dsh-plugin-dev
Any agent
npx skills add pingfanfan/hello-dsh --skill dsh-plugin-dev
Clone the repo
git clone --depth 1 https://github.com/pingfanfan/hello-dsh

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,758 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.01758
Opus 5 $0.00028 $0.00879
Sonnet 5 $0.00011 $0.00352
Haiku 4.5 $0.00006 $0.00176

Measured 3d ago against content hash a1b20e5fdbf3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dsh-plugin-dev scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/skills/dsh-plugin-dev/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

给 DSH 写插件

插件是 TypeScript 模块,跑在 Cordis 之上。DSH 处于 developer preview,官方明确警告有破坏性变更,所以任何行为都要在当前版本上验证。

先问一句:这件事非要插件不可吗? 如果用自然语言就能说清楚要模型做什么,写技能(一个 Markdown 文件)成本低一个数量级,也不会被上游 API 变更打挂。需要执行代码、接外部服务、挂生命周期钩子的,才需要插件。

最小形态

import type { Context } from '@deepseek-ai/cordis'

export const name = 'my-plugin'
export const inject = ['tools']

export function apply(ctx: Context) {
  // 在这里注册能力
}

加载方式是写一个 overlay:

- insert:
    - id: my-plugin
      name: '/absolute/path/to/my-plugin.ts'
dsh web --patch ./my-plugin/cordis.yml

路径必须是绝对路径,官方文档明确要求,相对路径不会被解析。

第一个致命陷阱:不要写 default export

这条有官方事故复盘(docs/postmortem/0001),值得完整理解。

export const name = 'acp'
export const inject = ['agents', 'sessions']
export function apply(ctx, config) { }
export default apply          // ← 这一行会让插件彻底失效

Loader 的 unwrapExports 逻辑是 exports.default ?? exports,优先取默认导出。有 export default 时,它解析出来的是裸的 apply 函数,而 injectnameConfig 是挂在模块命名空间上的同级命名导出,取 .default 那一步把整个命名空间丢掉了。

Loader 于是用一个空的 inject 构建 fiber。插件在什么服务都没注入的环境里运行,第一次访问 ctx.xxx 时沿 fiber 树一路找到根,抛出 cannot get property "agents" without inject

崩在加载时,不是请求处理时。

当时这个 bug 有 178 个绿色测试和 100% 行覆盖率,因为所有测试都是手动挂载插件的,绕过了真实 Loader 路径。

规则:命名空间插件只用命名导出,绝不加 default export。

第二个致命陷阱:!!js 只在 config 里有效

同样有官方复盘(docs/postmortem/0002)。

- insert:
    - id: fs
      name: '@deepseek-ai/dsh-tool-fs'
      disabled: !!js ctx.mode !== 'full'    # ← 永远为真
      config:
        root: !!js process.cwd()            # ← 这里才有效

Cordis 只对插件的 config 做递归插值。disabledisolateintercept 这些配置项元数据是直接读取的,拿到的是表达式对象,而对象恒为 truthy。结果是插件在所有模式下永久禁用,且无任何诊断。

规则:条件组合用显式的 overlay 文件,不要在元数据字段上写表达式。

注册工具的两个实测坑

ctx.tools.register() 的参数形态跟直觉不一样,这两条是实际跑出来的报错:

一、必须用 defineTool() 包裹,且必须声明 output

tool "xxx" must declare output { schema, render, presentationMeta? }

output 里要有 schema(返回值的 JSON Schema)和 render(渲染函数)。

二、parameters 不是标准 JSON Schema,且 required 只能填 true

Read the full file on GitHub · 178 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 178 lines · 55 tokens per session scan A a1b20e5fdbf3

Subscribe to this mod's changes

dsh-plugin-dev is a skill published in the GitHub repository pingfanfan/hello-dsh (87 stars, last pushed 19d ago), licensed MIT. It adds 55 tokens to every session and 1,758 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

dsh-plugin-guide

Use when developing, reviewing, packaging, debugging, or answering questions about DeepSeek Harness (DSH) plugins — the plugin-based agent harness on vendored Cordis. Applies the official plugin-development constraints (plugin contract, cordis.yml layers, services/events/effects, tool DSL, bundles/profiles) backed by…

PerryLink/dsh-plugin-guide · 76 tokens

dsh-web-release

Release and publish the dsh-web monorepo (DSH Web GUI plugin family + skin collection) — bump all packages to one unified version, commit and tag (tags are cut from main after dev integration; dev is the integration branch), push the vX.Y.Z tag that triggers the GitHub Actions publish pipeline, and verify the npm…

zhu1090093659/dsh-web · 151 tokens

dsh-web-community-plugin-developer

Develop a DSH community plugin and register it in the dsh-web Community Plugins index — author the plugin in the contributor's own repository following the official cordis bundle standard, add its entry to packages/dsh-community-plugins/community.json, regenerate the index with scripts/community-index, rebuild and…

zhu1090093659/dsh-web · 123 tokens

dsh-web-skin-developer

Build a new skin for the dsh-web skin collection (DSH Web GUI) and publish it into the Skin Center — the first-level settings section — scaffold with scripts/dsh-skin-new, author the v2 skin.json manifest plus skin.css token remap (pure asset directory, no package.json, no build step), validate with scripts/dsh-skin…

zhu1090093659/dsh-web · 120 tokens

dsh-web-pre-push-checks

Use before pushing, opening or updating a pull request, or claiming dsh-web checks pass. Selects the required repository gates and diff-specific generation, build, and GUI evidence.

zhu1090093659/dsh-web · 45 tokens

dsh-web-documentation

Use when adding or editing dsh-web README files, docs, AGENTS.md instructions, user-facing configuration text, or bilingual documentation pairs.

zhu1090093659/dsh-web · 34 tokens