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>
1.3 KiB
1.3 KiB
Development & Debugging
Dev Loop
# 1. Modify code in plugin/
# 2. Reinstall
node scripts/install.mjs --install
# 3. Restart gateway
openclaw gateway restart
# 4. Watch logs
openclaw logs --follow
# 5. Test
Log Keywords
| Keyword | Meaning |
|---|---|
plugin registered |
register() completed |
startSideCar called / already running |
Sidecar status |
must NOT have additional properties |
Schema vs config mismatch |
EADDRINUSE |
Port conflict (sidecar or HTTP server) |
Checklist Before Deploy
General
- All hook handlers have event dedup (globalThis, not module-level)
- Gateway lifecycle events protected by globalThis flag
- Business state on globalThis
openclaw.plugin.jsonschema matches actual config fields- Install script doesn't set schema-absent fields
- Sensitive fields not set by install script
- Install script cleans old dist before copying
Connection-type plugins
- Start flag on globalThis (not module-level
let) - Runtime reference on globalThis
- Shared registries/callbacks on globalThis, init once
- Cross-plugin API object overwritten every register() but runtime started once
- Consumer plugins defend against provider not loaded