agentleFS
mahingbun-devmahingbun-dev/dsh-plugin-dev-kit/skills/dsh-plugin-dev/SKILL.md

dsh-plugin-dev

Skill0 starsChanged 34 days agoMITView on GitHub

Build, test, install, and debug plugins for DeepSeek Harness (dsh, built on the vendored Cordis framework): model-facing tools, web UI plugins, MCP connections, service providers for capability seams, or wrapping an existing app/API into dsh. Use whenever the user wants to add a tool, capability, widget, or integration to dsh / DeepSeek Harness, author a Cordis plugin or bundle, or connect their own project or service to a dsh agent — even if they only say "add a tool to my agent" while working in a dsh checkout, a profile, or a dsh plugin workspace.

14 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every registration (ctx.provide, ctx.on, ctx.tools.register, ...) must return or register a disposer via ctx.effect — uninstall unrolls …

    line 38
  2. Very specific:

    Keep the export form the template uses.

    line 98
  3. Very specific:

    If the plugin needs options, export Config (Schemastery z) and put defaults in the patch row's config.

    line 102
  4. Very specific:

    Check syntax: node --check index.js — run it inside the package directory (the type: module in package.json is what makes ESM imports …

    line 104
  5. Very specific:

    Read the installer result: warnings and failure fields decide the next step, not terminal vibes.

    line 130

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

dsh plugin development

Turn a user request into a working, installed, verified dsh plugin. Everything in DeepSeek Harness is a plugin (the model adapters, the tool registry, the session log, the agent loop itself), and plugins are composed from YAML patch layers — so the fastest correct route is: pick the right template, change the fewest things, install through dsh plugin, and verify through the composed config before celebrating.

Baseline: written against dsh 0.1.7-rc.x. dsh APIs are pre-stable and evolve; when anything here disagrees with the runtime, trust dsh --dump-config, cordis_inspect_query, and the installed packages' own .d.ts files, then fix this skill's assumption rather than working around the framework.

Mental model in ten lines

  1. A plugin is an ES module exporting apply(ctx, config) (plus optional name, inject, Config), or a service class as default export. Never mix both forms in one module.
  2. ctx is a service repository: a service claims a stable ctx.<key> (ctx.tools, ctx.llm, ctx.shell, ctx.fs, ...). Plugins find services by key via inject, never by importing another plugin's implementation.
  3. A capability seam has three roles: Service Definition (abstract class owning ctx.<key>), Service Provider (implements it), Consumer (injects the key). Providers are swappable; consumers never change.
  4. Every registration (ctx.provide, ctx.on, ctx.tools.register, ...) must return or register a disposer via ctx.effect — uninstall unrolls them in reverse order.
  5. Events are the extension points. emit observes; waterfall is middleware: call next() to delegate, return without it to veto.
  6. The session log is the only durable fact source. What the model sees must be reconstructable from the log; tools get this for free via tool/result.
  7. Composition: a bundle (npm package declaring dsh.bundle.patch) contributes a YAML patch layer; a profile lists bundles in order; later layers override earlier rows by id, replacing the whole config.
  8. A patch row is { id, name, config? }; name is the module specifier Node resolves. insert adds rows; a later row with the same id replaces it.
  9. config is validated by the plugin's Config schema (Schemastery) at activation; .volatile() fields hot-update without remounting.
  10. disabled (boolean or !!js expression) is the only manifest field allowed to be an expression; id/name/inject/config statics must be literal.

Step 1 — Decide the path

User wantsPathStart from
A tool the model can call (weather, query_db, ...)Tool plugintemplates/tool-plugin/ + references/tool-plugin.md
A widget/card/page in the Harness Web UIUI plugintemplates/ui-plugin/ + references/ui-and-mcp.md
Connect an existing MCP serverConfig-only MCP bundle (no code)templates/mcp-config-only/ + references/ui-and-mcp.md
Make their existing app/API callable by the agentWrap existing projecttemplates/wrap-existing/ + references/wrap-existing-project.md
Implement or swap a platform capability (shell, fs, llm adapter, sandbox...)Seam provider / in-repo packagereferences/seam-provider.md

In-repo packages (inside the dsh monorepo, @deepseek-ai/dsh-*) follow the maintainer cookbook instead of the bundle flow — see references/seam-provider.md § "In-repo packages".

Step 2 — Discover before you write

  • dsh --profile "$DSH_PROFILE" --dump-config prints the composed plugin tree; every row it prints can be overridden by a patch. Keyless, fast, always do this first when a dsh shell is available.
  • Inside a running Harness agent session, cordis_inspect_list / cordis_inspect_query are agent tools (not shell commands): they answer exact Service methods, Event modes, installed Config schemas (Config.listConfigs), available Tools, and live Client Slots. Query the two or three APIs you will actually touch; do not enumerate. In a CLI-only environment without them, --dump-config plus the installed packages' .d.ts files are the fallback.
  • Installed packages ship lib/index.js + lib/types/**/*.d.ts with JSDoc under their resolved packageDir — read the .d.ts of any service you inject.

Step 3 — Write from the template

Copy the chosen template's files into ONE workspace directory (never install or edit in place), then:

  1. Rename — and know the three different names:
    NameMust beUsed by
    package nameyour choice (e.g. dsh-my-tool or @local/my-tool)install + Node resolution
    patch row nameexactly the package nameNode resolves the installed code
    patch row idunique across the profilelayer overrides match on it
    export const nameplugin metadata, free-formdisplay / diagnostics only
  2. Keep the export form the template uses. A tool plugin is export const inject = ['tools'] + export function apply(ctx, config).
  3. Register inside apply through the owning registry (ctx.tools.register) or ctx.effect/ctx.on, never at module top level.
  4. If the plugin needs options, export Config (Schemastery z) and put defaults in the patch row's config. Prefer defaults users keep.
  5. Check syntax: node --check index.js — run it inside the package directory (the type: module in package.json is what makes ESM imports parse) and JSON/YAML-parse the manifest.

Step 4 — Install and verify

dsh plugin --profile demo add ./your-plugin        # local checkout
dsh plugin --profile demo add github:you/your-plugin  # git (see pitfall P3)
dsh plugin --profile demo add ./your-plugin-0.1.0.tgz # tarball / npm: no build step
dsh --profile demo --dump-config                   # your layer must appear

dsh plugin add is the only supported installer: it runs pnpm in the profile and appends the bundle to dsh.profile.bundles. Never hand-edit the profile's package.json / cordis.patch.yml, never create packages under $DSH_HOME, never run pnpm in the profile directory.

Verification ladder, in order — do not skip to "it should work":

  1. --dump-config shows your rows (composition correct).
  2. Boot and exercise the capability; for UI plugins the installed plugin in the connected page is the first preview (no mock shells before this).
  3. Durable proof: a REAL-composition test (real Loader + cordis.yml fixture) — see references/testing.md.

Read the installer result: warnings and failure fields decide the next step, not terminal vibes. restart-required means the change is not live yet.

Red lines (each has bitten someone)

#RuleWhy
P1Package must declare dsh.bundle.patchWithout it the package installs as a plain dependency and activates no layer — plugin looks installed but never loads
P2Stateful dsh packages go under peerDependencies and devDependencies (same range); stateless utils and third-party deps under dependenciesA dependencies copy of a stateful dsh package creates a second instance; peers resolve to the running installation's copy
P3Git installs need a self-contained prepare build script and user allowBuilds allowanceGit fetches sources, not built artifacts; pnpm ≥10 blocks prepare until allowlisted — treat the allowance as executing the author's code
P4Patch rows replace the whole config; overriding a row restates every keyPatches do not deep-merge; dropping keys silently changes behavior
P5Never hand-edit profile manifests; never $DSH_HOME packages; never pnpm in profiledsh plugin owns those files with locking and reconciliation
P6One export form per module (function plugin or default-export service class)Mixing makes the Loader drop the function-plugin namespace
P7Every registration returns a disposerWithout it HMR/uninstall leaks listeners and tools
P8@deepseek-ai/cordis in both peer + dev with the same rangeRequired by package hygiene; peer placeholder triggers runtime resolution

Full list with fixes: references/pitfalls.md.

Read next

TaskFile
Framework mental model, dispatch modes, layer order, session logreferences/architecture-map.md
Tool plugin contract (defineTool, output schema, guards, events)references/tool-plugin.md
Implementing/swapping a capability seam; in-repo packagesreferences/seam-provider.md
Wrapping an existing app/API/CLI into dshreferences/wrap-existing-project.md
UI plugins (Client module loader, slots) and MCP bundlesreferences/ui-and-mcp.md
Testing: unit, REAL-composition, profile harness, verification limitsreferences/testing.md
All pitfalls with concrete fixesreferences/pitfalls.md
Installed but not working? Symptom-organized diagnosis treesreferences/troubleshooting.md
Starting points (inside this skill directory)templates/{tool-plugin,ui-plugin,mcp-config-only,wrap-existing}/
Complete worked example (in the kit repo checkout)examples/dice-tool/

Chinese mirrors of every reference live under zh/; prefer them when the user converses in Chinese.

Environment facts

  • DSH_PROFILE (profile name) and DSH_PROFILE_DIR (its directory) are set in every shell of a profile-launched Harness; absent without a profile. Bash reads $DSH_PROFILE; PowerShell reads $env:DSH_PROFILE.
  • Profiles live under $DSH_HOME/profiles/<name>; profile node_modules holds only out-of-tree installed bundles. In-box @deepseek-ai/dsh-* packages resolve from the dsh installation itself — your bundle can rely on @deepseek-ai/dsh-base being present and current.
  • Loader patch dialect reference: patch is a YAML array; rows support id, name, inject, config, disabled (expression allowed), insert blocks.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.