Getting Started
Choose a starting point
Section titled “Choose a starting point”The fastest way to build a plugin is to start from one of the example directories in examples/plugins/.
hello-worldfor the smallest Rust example.ts-hello-worldfor an AssemblyScript plugin with a lightweight TypeScript-style workflow.web-searchfor a Rust-based plugin.obsidian-wikifor a more featureful workspace-oriented plugin.
For desktop UI tab examples, also review:
apps/desktop/plugins/calendarapps/desktop/plugins/pomodoro
For most new plugin authors, ts-hello-world is the best starting point.
Copy the example plugin
Section titled “Copy the example plugin”Start from the AssemblyScript example in this repository:
cp -r examples/plugins/ts-hello-world my-plugincd my-pluginnpm installUnderstand the plugin layout
Section titled “Understand the plugin layout”The copied example gives you the pieces Khadim expects:
plugin.tomldefines plugin metadata, config fields, and permissions.assembly/index.tscontains your exported plugin functions and tools.assembly/sdk.tsprovides helper functions for logging, HTTP, JSON, and tool responses.- Optional
ui.jsand[ui]manifest entries add desktop sidebar/content tabs. build.shornpm run buildcompiles the plugin toplugin.wasm.
What to edit first
Section titled “What to edit first”- Update your plugin metadata in
plugin.toml. - Rename the example tool to match your plugin.
- If your plugin ships UI, register your custom elements in
ui.jsand add[[ui.tabs]]entries. - Build the WebAssembly bundle used by the desktop host.
Build the plugin
Section titled “Build the plugin”npm run buildThis should produce plugin.wasm for the host to load.
Install the plugin
Section titled “Install the plugin”If the example includes a deploy script, use it:
npm run deployOtherwise, copy the built plugin directory into the Khadim plugins location used by your environment.
What the host expects
Section titled “What the host expects”At runtime, Khadim loads your manifest, reads the permission declarations, and calls exported plugin functions to:
- initialize plugin config
- list available tools
- execute a selected tool with JSON arguments
- optionally load plugin UI bundles and mount declared tab elements in the desktop app
Next steps
Section titled “Next steps”- Learn the manifest format in Manifest
- Explore helper APIs in AssemblyScript SDK
- Review host permissions in Host Capabilities