Preface¶
If you are developing plugins for DeepSeek Harness (dsh), you will encounter a practical problem: dsh plugins have a strict contract specification, including the apply(ctx) lifecycle function, defineTool tool definition, and Schema DSL hard constraints. For humans, this means consulting documentation; for models, it is even more troublesome. Since dsh was released not long ago, models lack targeted training data. Letting an Agent “help me create a XX plugin” directly in a session easily leads to API hallucinations and produces non-functional code.
dsh-plugin-factory addresses this issue: it provides a complete plugin development toolchain for the Agent within a dsh session, allowing the Agent to read contract documentation, generate valid skeletons, self-validate, and finally output installable snippets, with no manual coding required throughout the process.
What is it¶
As defined in the original README: enabling the dsh AI to write dsh plugins itself, a self-bootstrapping plugin generation tool. Maintained by ktziy, License MIT, current version 0.3.2.
The approach is to package the contract specifications into three tools: “Documentation + Scaffold + Validator”, constraining Agent output at the source to ensure the legality of the generated code. The README also notes that this plugin was created by a DeepSeek model (with a high AI content ratio of 99.99%): due to the model’s recent release and lack of relevant training data, the DeepSeekV4 Flash version organized it, and the Pro version distributed it as a prompt package for the model to use. This background itself explains the plugin’s purpose—to fill in contract knowledge for models without training data.
Three Core Tools¶
plugin_doc: Read contract documentation by topic¶
Before writing a plugin, the Agent checks the specification rather than guessing APIs from memory. plugin_doc supports reading contract documentation by topic. Topics include:
core / tools / services / llm / compose / preset / client / api
Additionally, it supports file= to read official structured references (ref/) and official raw text (official/) by path.
plugin_scaffold: Generate six types of plugin skeletons¶
plugin_scaffold generates plugin skeletons, supporting 6 kinds:
| kind | Description |
|---|---|
tool |
Host tool (defineTool) |
service |
Host Service class |
event |
Host event listener |
llm-adapter |
Host LLM adapter |
client |
Web UI plugin (settings.section slots) |
client-node |
Web UI conversation node |
plugin_validate: Static self-check before persistence¶
plugin_validate performs static self-check based on guard rules, covering defineTool rules for tools and apply/inject/slots for clients. After generating the skeleton, a validation run is performed before entering the persistence phase.
Host Side and Client Side Coverage¶
According to the development roadmap in the README, the capabilities on both sides are as follows.
Host Side:
- Tools: Documentation + Scaffold + Validation
- Services: Scaffold (Service class + declare module)
- Event Listening/Interception: Scaffold (ctx.on + dispatch pattern hints)
- Configuration: Documentation + Scaffold with Config examples
- LLM Adapter: Scaffold (LlmAdapter + StreamChunk protocol)
- Packaging/Release: Documentation + The bundle itself is the package
Client Side:
- Client UI Plugin (settings.section slots): Documentation + Scaffold + Validation + Build + Mount testing
- Conversation Node UI: Scaffold (ConversationNodeDefinition complete set)
- Other slots: Documentation coverage (client.md §3 complete list) + two representative templates
Self-test results recorded in the README: Model self-test passed all 6 kinds, compilation passed, package size 29KB.
Installation¶
The README provides three installation methods, recommending tarball (build-free):
# Method 1: tarball (Recommended, build-free)
dsh plugin --profile web add ./dsh-plugin-factory-0.3.2.tgz
# Method 2: Git repository
dsh plugin --profile web add github:ktziy/dsh-plugin-factory
# Method 3: NPM
dsh plugin --profile web add dsh-plugin-factory
All three commands specify --profile web; adjust according to your actual profile situation.
Typical Usage¶
After installation, simply tell the Agent in a dsh session:
Use plugin_scaffold to create a plugin named weather-tool with toolName get_weather.
The Agent will automatically return two things: a valid plugin skeleton source code, and an installable --patch snippet.
The full workflow behind this is:
- Agent calls
plugin_docto read contract specifications - Agent calls
plugin_scaffoldto generate a valid skeleton - Agent calls
plugin_validatefor self-validation - Uses dsh’s fs/bash tools to persist
- Loads the plugin via
dsh plugin add
For a more complete workflow and advanced usage, refer to the core documentation docs/CORE.md in the repository. The “Effect Preview” section in the README is currently marked as pending, so actual results depend on running it in your own environment.
Use Cases and Precautions¶
Suitable for two types of people: developers who frequently write dsh plugins and want to save the effort of repeatedly consulting contract documentation; and those who want the Agent to handle plugin generation in the session to reduce debugging costs caused by API hallucinations.
Two points to note before use:
- Plugins run with the current dsh process permissions, and the fs/bash persistence operations in the workflow above execute under these permissions. Before installing any third-party plugins, it is recommended to check the source code and license. The source code for this plugin is open on GitHub, License is MIT, and the
licensefield in package.json is also MIT. - The plugin itself was made by a model, so it is still recommended to manually review the Agent’s generated results, especially after passing
plugin_validate.
Summary¶
dsh-plugin-factory compresses the plugin development process of “humans read docs, humans write code, humans debug” into a single toolchain call within an Agent session. For the dsh plugin ecosystem, such self-bootstrapping tools lower the barrier to writing plugins and make the concept of “everything is a plugin” easier to implement.
- Community Directory Page: https://www.skillhub.cn/plugins/ktziy/dsh-plugin-factory (Community independent site, no official affiliation with DeepSeek / Huafang)
- GitHub Repository: https://github.com/ktziy/dsh-plugin-factory