Write and publish a plugin
When a task goes beyond what SKILL.md or an MCP server can do—such as adding an interactive slash command, registering a new built-in tool, or integrating a custom runtime service—author an omdsh plugin package (an npm package declaring dsh.bundle.patch on DeepSeek Harness’s Cordis plugin architecture).
Make sure pnpm is available on PATH before starting.
Shortcut: Use built-in /agent creator
omdsh ships a dedicated Creator preset equipped with the authoritative dsh-doc authoring guide and read-only runtime inspection tools:
- Start
omdshin a fresh folder and run/agent creator(or chooseLet the agent create a plugininside/plugins). This does not change your default preset. - Describe what your plugin should do; Creator inspects live host interfaces and helps generate the package, patch file, and tests.
To understand every file by hand, follow the five-minute greet-plugin walkthrough below (or inspect the minimal fixture in examples/hello).
Step 1: Check your installed runtime version
Plugins must declare @deepseek-ai/* under peerDependencies matching the DeepSeek Harness (DSH) release shipped by your omdsh installation. Listing them under dependencies causes omdsh plugin to reject the install so the shared runtime tree is never duplicated.
Check the active version and composition with:
omdsh --dump-config | head -n 20
You can also inspect @deepseek-ai/cordis and @deepseek-ai/dsh-commands in your installed @agi-fans/oh-my-dsh/package.json and mirror those versions in peerDependencies.
Step 2: Create the package and its three core files
Create a standalone directory outside the omdsh workspace (never add it to pnpm-workspace.yaml or use workspace: dependencies):
mkdir greet-plugin
cd greet-plugin
A minimal plugin needs three files: package.json, cordis.patch.yml, and index.js.
1. package.json
{
"name": "greet-plugin",
"version": "0.1.0",
"type": "module",
"main": "index.js",
"files": ["index.js", "cordis.patch.yml"],
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
}
},
"peerDependencies": {
"@deepseek-ai/cordis": "~4.2.0-alpha.2",
"@deepseek-ai/dsh-commands": "<DSH version matching your omdsh>"
}
}
Two rules keep installation safe:
- Keep all
@deepseek-ai/*packages inpeerDependencies, neverdependencies. - Keep
dsh.bundle.patchpointing to your patch file. Without it, the package installs only as a plain library and mounts no layer (useful only for helper libraries imported by other plugins).
2. cordis.patch.yml
- insert:
- id: greet
name: greet-plugin
namemust match the npm package name so Node resolves the module.idmust be unique in the plugin tree. A later patch targeting the sameidreplaces itsconfigobject wholesale rather than deep-merging; a patch targeting a missingidis skipped silently at boot.
3. index.js
export const name = 'greet-plugin'
export const inject = ['commands']
export function apply(ctx) {
ctx.effect(function* () {
yield ctx.commands.register({
name: 'greet',
description: 'Print a greeting from this plugin',
input: { hint: '[name]' },
handler(invocation) {
const who = invocation.rawInput.trim() || 'omdsh'
return { kind: 'success', text: `Hello, ${who}.` }
},
})
}, 'greet-plugin')
}
Four boundaries keep your plugin well-behaved inside the terminal:
- Command names: Lowercase with no leading
/.invocation.rawInputcontains the raw text after the command name. - Prompting the user: Inject
'tui'and callctx.tui.prompt(...)for choices, text input, or document readers. Never take over the TTY or read raw terminal bytes directly. - Secrets: Store sensitive credentials through
ctx.credentials, never in plain config files. - Plugin settings: Declare a schema via
ctx.settings—omdsh automatically renders and validates your fields under/settings → Advanced. Do not try to patch the/settingsUI directly.
Step 3: Install locally, verify, and iterate
From the parent directory containing greet-plugin:
omdsh plugin add ./greet-plugin
omdsh --dump-config
Verify in two steps:
- Confirm
greet-pluginappears after@agi-fans/oh-my-dshinomdsh --dump-configwithid: greet. - Restart
omdsh, then test/greet,/greet Ada, and/help:
- In interactive
/help,/greetappears directly in the searchable command picker. - In non-interactive text help, plugin commands are grouped under
Extensions.
Iterating on changes
- With a local path install (
./greet-plugin), your profile links directly to that folder: editindex.jsorcordis.patch.ymland restartomdshto load changes. - To clean up afterwards, run
omdsh plugin remove greet-plugin.
Step 4: Publish and distribute
- npm: Publish to npm so users can install via
/pluginsoromdsh plugin add greet-plugin. - Tarball: Run
pnpm packand share the.tgz; users install withomdsh plugin add ./greet-plugin-0.1.0.tgz. - Git: Users install with
omdsh plugin add github:<owner>/greet-plugin(if the repo builds duringprepare, users may need anallowBuildsentry in$OMDSH_HOME/profiles/omdsh/pnpm-workspace.yaml).
Before publishing, verify that your plugin imports only published package exports and does not assume HTTP or Web UI services (the TUI host does not mount them).
Next steps
- Code examples for custom tools, presentation, prompts, and settings schemas: Plugin internals.
- Full compatibility contract and host boundaries: Plugins and integrations and Architecture.