Developing Plugins - Extending DeepSeek Harness
In DeepSeek Harness, you extend capabilities not by editing source, but by mounting plugins alongside other plugins. This page covers the basics of Cordis plugins and where common capabilities should attach.
Cordis plugin basics
Cordis is the framework underneath dsh: plugins contribute services, typed events, and reversible side effects to a shared context.
- Loading & unloading: the Cordis meta-framework handles only plugin loading, unloading, and dependencies
- Services: plugins offer capabilities to other plugins through services
- Events: plugins observe or intercept in-flight work through typed events
- Reversible side effects: every registration is a side effect, undone when its plugin unloads — so there's no privileged kernel to patch
Where new behavior belongs
New behavior attaches to documented extension points. Common goals and their mechanisms:
| Goal | Mechanism |
|---|---|
| Add a model provider | Register its adapter on ctx.llm |
| Add a model-facing capability | Register on ctx.tools; its schema joins prompt assembly |
| Give a session a different capability set | Assemble an agent preset |
| Add shell execution | Register a ctx.shell backend |
| Add persistent terminal execution | Register a ctx.terminals backend |
| Add a user command | Register on ctx.commands |
| Add background work | Register on ctx.jobs; job_* tools collect or stop |
| Add filesystem access or policy | Register a ctx.fs provider, or listen to fs/* events |
| Constrain launched processes | Use a ctx.sandbox backend |
| Intercept requests, tools, or turns | Use the relevant agent/* or tools/* events |
| Add model-visible context | Call agent.inject() |
| Add UI or editor integration | Drive ctx.agents and render from session/event |
| Add persistent session state | Extend SessionEventMap; render and replay from the log |
Events are the extension points
Choosing the right event domain is the first decision in most changes:
- Session events: persistent facts appended to the log and broadcast via
session/event— use when a fact must survive reload - Agent events (
agent/*): carry the activeAgent— inbox, steps, state, requests, validation, resumption — use to observe or intercept in-flight work - Capability events: attach policy and adapters to a seam (
fs/*,tools/*,telemetry/*) without import cycles
Publish your plugin
- Declare the profile and bundle in
package.jsonvia thedshfield:dsh.profilelists a profile's bundles,dsh.bundlepoints to a bundle's patch file - Add the
dsh-plugintopic to your repository for discoverability - Share and discuss via GitHub Discussions
Want to get hands-on?
The official repo offers an extension cookbook with step-by-step guides (adding a package, a tool, an LLM adapter, a chat node), plus the Cordis tutorial.