Plugin development reference and workflows based on real development experience (Dirigent, ContractorAgent, PrismFacet). Docs: structure, entry-point, hooks, tools, state, config, debugging Workflows: create-plugin, add-hook Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
1.2 KiB
Markdown
27 lines
1.2 KiB
Markdown
# Plugin Project Structure
|
|
|
|
```
|
|
proj-root/
|
|
plugin/ # Installable plugin (copied to ~/.openclaw/plugins/<id>/)
|
|
index.ts # Entry: export default { id, name, register }
|
|
openclaw.plugin.json # Config schema declaration
|
|
package.json # name, version, type: module
|
|
hooks/ # Hook handlers (one file per hook)
|
|
tools/ # Tool registrations
|
|
core/ # Pure business logic (no plugin-sdk imports)
|
|
web/ # HTTP routes (optional)
|
|
services/ # Sidecar processes (optional, installed alongside plugin)
|
|
skills/ # OpenClaw skills provided by this plugin (optional)
|
|
routers/ # Drop-in modules (plugin-specific, e.g., PrismFacet routers)
|
|
scripts/
|
|
install.mjs # --install / --uninstall / --update
|
|
docs/ # Documentation
|
|
```
|
|
|
|
## Conventions
|
|
|
|
- File names: kebab-case (`before-model-resolve.ts`)
|
|
- Export names: camelCase (`registerBeforeModelResolve`)
|
|
- `plugin/core/` must not import from `openclaw/plugin-sdk` — keeps logic unit-testable
|
|
- Hook registration logic goes in `plugin/hooks/`, not in `index.ts`
|