2026-01-11 12:11:12 +00:00
---
2026-01-31 21:13:13 +09:00
summary: "OpenClaw plugins/extensions: discovery, config, and safety"
2026-01-11 12:11:12 +00:00
read_when:
- Adding or modifying plugins/extensions
- Documenting plugin install or load rules
2026-01-31 16:04:03 -05:00
title: "Plugins"
2026-01-11 12:11:12 +00:00
---
2026-01-31 18:31:49 +09:00
2026-01-11 12:11:12 +00:00
# Plugins (Extensions)
2026-01-12 01:27:05 +00:00
## Quick start (new to plugins?)
2026-01-30 03:15:10 +01:00
A plugin is just a **small code module ** that extends OpenClaw with extra
2026-01-12 01:27:05 +00:00
features (commands, tools, and Gateway RPC).
Most of the time, you’ ll use plugins when you want a feature that’ s not built
2026-01-30 03:15:10 +01:00
into core OpenClaw yet (or you want to keep optional features out of your main
2026-01-12 01:27:05 +00:00
install).
Fast path:
2026-01-31 18:31:49 +09:00
1. See what’ s already loaded:
2026-01-12 01:27:05 +00:00
``` bash
2026-01-30 03:15:10 +01:00
openclaw plugins list
2026-01-12 01:27:05 +00:00
```
2026-01-31 18:31:49 +09:00
2. Install an official plugin (example: Voice Call):
2026-01-12 01:27:05 +00:00
``` bash
2026-01-30 03:15:10 +01:00
openclaw plugins install @openclaw/voice-call
2026-01-12 01:27:05 +00:00
```
2026-01-31 18:31:49 +09:00
3. Restart the Gateway, then configure under `plugins.entries.<id>.config` .
2026-01-12 01:27:05 +00:00
See [Voice Call ](/plugins/voice-call ) for a concrete example plugin.
2026-01-15 09:07:14 +00:00
## Available plugins (official)
2026-01-30 03:15:10 +01:00
- Microsoft Teams is plugin-only as of 2026.1.15; install `@openclaw/msteams` if you use Teams.
2026-01-18 02:12:01 +00:00
- Memory (Core) — bundled memory search plugin (enabled by default via `plugins.slots.memory` )
2026-01-18 15:47:56 +00:00
- Memory (LanceDB) — bundled long-term memory plugin (auto-recall/capture; set `plugins.slots.memory = "memory-lancedb"` )
2026-01-30 03:15:10 +01:00
- [Voice Call ](/plugins/voice-call ) — `@openclaw/voice-call`
- [Zalo Personal ](/plugins/zalouser ) — `@openclaw/zalouser`
- [Matrix ](/channels/matrix ) — `@openclaw/matrix`
- [Nostr ](/channels/nostr ) — `@openclaw/nostr`
- [Zalo ](/channels/zalo ) — `@openclaw/zalo`
- [Microsoft Teams ](/channels/msteams ) — `@openclaw/msteams`
2026-01-17 09:33:56 +00:00
- Google Antigravity OAuth (provider auth) — bundled as `google-antigravity-auth` (disabled by default)
- Gemini CLI OAuth (provider auth) — bundled as `google-gemini-cli-auth` (disabled by default)
2026-01-17 20:28:15 +00:00
- Qwen OAuth (provider auth) — bundled as `qwen-portal-auth` (disabled by default)
2026-01-18 16:06:45 +00:00
- Copilot Proxy (provider auth) — local VS Code Copilot Proxy bridge; distinct from built-in `github-copilot` device login (bundled, disabled by default)
2026-01-15 09:07:14 +00:00
2026-01-30 03:15:10 +01:00
OpenClaw plugins are **TypeScript modules ** loaded at runtime via jiti. **Config
2026-01-19 21:13:51 -06:00
validation does not execute plugin code**; it uses the plugin manifest and JSON
Schema instead. See [Plugin manifest ](/plugins/manifest ).
Plugins can register:
2026-01-11 12:11:12 +00:00
- Gateway RPC methods
2026-01-15 05:03:50 +00:00
- Gateway HTTP handlers
2026-01-11 12:11:12 +00:00
- Agent tools
- CLI commands
- Background services
- Optional config validation
2026-01-23 00:49:32 +00:00
- **Skills** (by listing `skills` directories in the plugin manifest)
2026-01-23 03:17:10 +00:00
- **Auto-reply commands** (execute without invoking the AI agent)
2026-01-11 12:11:12 +00:00
Plugins run **in‑ process ** with the Gateway, so treat them as trusted code.
2026-01-18 04:07:19 +00:00
Tool authoring guide: [Plugin agent tools ](/plugins/agent-tools ).
2026-01-11 12:11:12 +00:00
2026-01-25 09:29:50 +00:00
## Runtime helpers
Plugins can access selected core helpers via `api.runtime` . For telephony TTS:
``` ts
const result = await api . runtime . tts . textToSpeechTelephony ( {
2026-01-31 21:13:13 +09:00
text : "Hello from OpenClaw" ,
2026-01-25 09:29:50 +00:00
cfg : api.config ,
} ) ;
```
Notes:
2026-01-31 18:31:49 +09:00
2026-01-25 09:29:50 +00:00
- Uses core `messages.tts` configuration (OpenAI or ElevenLabs).
- Returns PCM audio buffer + sample rate. Plugins must resample/encode for providers.
- Edge TTS is not supported for telephony.
2026-01-11 12:11:12 +00:00
## Discovery & precedence
2026-01-30 03:15:10 +01:00
OpenClaw scans, in order:
2026-01-11 12:11:12 +00:00
2026-01-31 18:31:49 +09:00
1. Config paths
2026-01-17 09:33:56 +00:00
- `plugins.load.paths` (file or directory)
2026-01-11 12:11:12 +00:00
2026-01-31 18:31:49 +09:00
2. Workspace extensions
2026-01-30 03:15:10 +01:00
- `<workspace>/.openclaw/extensions/*.ts`
- `<workspace>/.openclaw/extensions/*/index.ts`
2026-01-11 12:11:12 +00:00
2026-01-31 18:31:49 +09:00
3. Global extensions
2026-01-30 03:15:10 +01:00
- `~/.openclaw/extensions/*.ts`
- `~/.openclaw/extensions/*/index.ts`
2026-01-17 09:33:56 +00:00
2026-01-31 18:31:49 +09:00
4. Bundled extensions (shipped with OpenClaw, **disabled by default ** )
2026-01-30 03:15:10 +01:00
- `<openclaw>/extensions/*`
2026-01-17 09:33:56 +00:00
Bundled plugins must be enabled explicitly via `plugins.entries.<id>.enabled`
2026-01-30 03:15:10 +01:00
or `openclaw plugins enable <id>` . Installed plugins are enabled by default,
2026-01-17 09:33:56 +00:00
but can be disabled the same way.
2026-01-30 03:15:10 +01:00
Each plugin must include a `openclaw.plugin.json` file in its root. If a path
2026-01-19 21:13:51 -06:00
points at a file, the plugin root is the file's directory and must contain the
manifest.
2026-01-17 09:33:56 +00:00
If multiple plugins resolve to the same id, the first match in the order above
wins and lower-precedence copies are ignored.
2026-01-11 12:11:12 +00:00
### Package packs
2026-01-30 03:15:10 +01:00
A plugin directory may include a `package.json` with `openclaw.extensions` :
2026-01-11 12:11:12 +00:00
``` json
{
"name" : "my-pack" ,
2026-01-30 03:15:10 +01:00
"openclaw" : {
2026-01-11 12:11:12 +00:00
"extensions" : [ "./src/safety.ts" , "./src/tools.ts" ]
}
}
```
Each entry becomes a plugin. If the pack lists multiple extensions, the plugin id
becomes `name/<fileBase>` .
If your plugin imports npm deps, install them in that directory so
`node_modules` is available (`npm install` / `pnpm install` ).
2026-01-20 11:11:42 +00:00
### Channel catalog metadata
2026-01-30 03:15:10 +01:00
Channel plugins can advertise onboarding metadata via `openclaw.channel` and
install hints via `openclaw.install` . This keeps the core catalog data-free.
2026-01-20 11:11:42 +00:00
Example:
``` json
{
2026-01-30 03:15:10 +01:00
"name" : "@openclaw/nextcloud-talk" ,
"openclaw" : {
2026-01-20 11:11:42 +00:00
"extensions" : [ "./index.ts" ] ,
"channel" : {
"id" : "nextcloud-talk" ,
"label" : "Nextcloud Talk" ,
"selectionLabel" : "Nextcloud Talk (self-hosted)" ,
"docsPath" : "/channels/nextcloud-talk" ,
"docsLabel" : "nextcloud-talk" ,
"blurb" : "Self-hosted chat via Nextcloud Talk webhook bots." ,
"order" : 65 ,
"aliases" : [ "nc-talk" , "nc" ]
} ,
"install" : {
2026-01-30 03:15:10 +01:00
"npmSpec" : "@openclaw/nextcloud-talk" ,
2026-01-20 11:11:42 +00:00
"localPath" : "extensions/nextcloud-talk" ,
"defaultChoice" : "npm"
}
}
}
```
2026-01-30 03:15:10 +01:00
OpenClaw can also merge **external channel catalogs ** (for example, an MPM
2026-01-24 00:17:58 +00:00
registry export). Drop a JSON file at one of:
2026-01-31 18:31:49 +09:00
2026-01-30 03:15:10 +01:00
- `~/.openclaw/mpm/plugins.json`
- `~/.openclaw/mpm/catalog.json`
- `~/.openclaw/plugins/catalog.json`
2026-01-24 00:17:58 +00:00
2026-01-30 03:15:10 +01:00
Or point `OPENCLAW_PLUGIN_CATALOG_PATHS` (or `OPENCLAW_MPM_CATALOG_PATHS` ) at
2026-01-24 00:17:58 +00:00
one or more JSON files (comma/semicolon/`PATH` -delimited). Each file should
2026-01-30 03:15:10 +01:00
contain `{ "entries": [ { "name": "@scope/pkg", "openclaw": { "channel": {...}, "install": {...} } } ] }` .
2026-01-24 00:17:58 +00:00
2026-01-11 12:11:12 +00:00
## Plugin IDs
Default plugin ids:
- Package packs: `package.json` `name`
- Standalone file: file base name (`~/.../voice-call.ts` → `voice-call` )
2026-01-30 03:15:10 +01:00
If a plugin exports `id` , OpenClaw uses it but warns when it doesn’ t match the
2026-01-11 12:11:12 +00:00
configured id.
## Config
``` json5
{
plugins: {
enabled: true,
2026-01-31 21:13:13 +09:00
allow: ["voice-call"],
deny: ["untrusted-plugin"],
load: { paths: ["~/Projects/oss/voice-call-extension"] },
2026-01-11 12:11:12 +00:00
entries: {
2026-01-31 21:13:13 +09:00
"voice-call": { enabled: true, config: { provider: "twilio" } },
2026-01-31 18:31:49 +09:00
},
},
2026-01-11 12:11:12 +00:00
}
```
Fields:
2026-01-31 18:31:49 +09:00
2026-01-11 12:11:12 +00:00
- `enabled` : master toggle (default: true)
- `allow` : allowlist (optional)
- `deny` : denylist (optional; deny wins)
- `load.paths` : extra plugin files/dirs
- `entries.<id>` : per‑ plugin toggles + config
Config changes **require a gateway restart ** .
2026-01-19 21:13:51 -06:00
Validation rules (strict):
2026-01-31 18:31:49 +09:00
2026-01-19 21:13:51 -06:00
- Unknown plugin ids in `entries` , `allow` , `deny` , or `slots` are **errors ** .
- Unknown `channels.<id>` keys are **errors ** unless a plugin manifest declares
the channel id.
- Plugin config is validated using the JSON Schema embedded in
2026-01-30 03:15:10 +01:00
`openclaw.plugin.json` (`configSchema` ).
2026-01-19 21:13:51 -06:00
- If a plugin is disabled, its config is preserved and a **warning ** is emitted.
2026-01-18 02:12:01 +00:00
## Plugin slots (exclusive categories)
Some plugin categories are **exclusive ** (only one active at a time). Use
`plugins.slots` to select which plugin owns the slot:
``` json5
{
plugins: {
slots: {
2026-01-31 21:13:13 +09:00
memory: "memory-core", // or "none" to disable memory plugins
2026-01-31 18:31:49 +09:00
},
},
2026-01-18 02:12:01 +00:00
}
```
If multiple plugins declare `kind: "memory"` , only the selected one loads. Others
are disabled with diagnostics.
2026-01-12 01:16:46 +00:00
## Control UI (schema + labels)
The Control UI uses `config.schema` (JSON Schema + `uiHints` ) to render better forms.
2026-01-30 03:15:10 +01:00
OpenClaw augments `uiHints` at runtime based on discovered plugins:
2026-01-12 01:16:46 +00:00
- Adds per-plugin labels for `plugins.entries.<id>` / `.enabled` / `.config`
- Merges optional plugin-provided config field hints under:
`plugins.entries.<id>.config.<field>`
If you want your plugin config fields to show good labels/placeholders (and mark secrets as sensitive),
2026-01-19 21:13:51 -06:00
provide `uiHints` alongside your JSON Schema in the plugin manifest.
2026-01-12 01:16:46 +00:00
Example:
2026-01-19 21:13:51 -06:00
``` json
{
"id" : "my-plugin" ,
"configSchema" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"apiKey" : { "type" : "string" } ,
"region" : { "type" : "string" }
}
2026-01-12 01:16:46 +00:00
} ,
2026-01-19 21:13:51 -06:00
"uiHints" : {
"apiKey" : { "label" : "API Key" , "sensitive" : true } ,
"region" : { "label" : "Region" , "placeholder" : "us-east-1" }
}
}
2026-01-12 01:16:46 +00:00
```
2026-01-11 12:11:12 +00:00
## CLI
``` bash
2026-01-30 03:15:10 +01:00
openclaw plugins list
openclaw plugins info <id>
openclaw plugins install <path> # copy a local file/dir into ~/.openclaw/extensions/<id>
openclaw plugins install ./extensions/voice-call # relative path ok
openclaw plugins install ./plugin.tgz # install from a local tarball
openclaw plugins install ./plugin.zip # install from a local zip
openclaw plugins install -l ./extensions/voice-call # link (no copy) for dev
openclaw plugins install @openclaw/voice-call # install from npm
openclaw plugins update <id>
openclaw plugins update --all
openclaw plugins enable <id>
openclaw plugins disable <id>
openclaw plugins doctor
2026-01-11 12:11:12 +00:00
```
2026-01-16 05:54:47 +00:00
`plugins update` only works for npm installs tracked under `plugins.installs` .
2026-01-30 03:15:10 +01:00
Plugins may also register their own top‑ level commands (example: `openclaw voicecall` ).
2026-01-11 12:11:12 +00:00
## Plugin API (overview)
Plugins export either:
- A function: `(api) => { ... }`
- An object: `{ id, name, configSchema, register(api) { ... } }`
2026-01-18 05:56:59 +00:00
## Plugin hooks
Plugins can ship hooks and register them at runtime. This lets a plugin bundle
event-driven automation without a separate hook pack install.
### Example
```
2026-01-30 03:15:10 +01:00
import { registerPluginHooksFromDir } from "openclaw/plugin-sdk";
2026-01-18 05:56:59 +00:00
export default function register(api) {
registerPluginHooksFromDir(api, "./hooks");
}
```
Notes:
2026-01-31 18:31:49 +09:00
2026-01-18 05:56:59 +00:00
- Hook directories follow the normal hook structure (`HOOK.md` + `handler.ts` ).
- Hook eligibility rules still apply (OS/bins/env/config requirements).
2026-01-30 03:15:10 +01:00
- Plugin-managed hooks show up in `openclaw hooks list` with `plugin:<id>` .
- You cannot enable/disable plugin-managed hooks via `openclaw hooks` ; enable/disable the plugin instead.
2026-01-18 05:56:59 +00:00
2026-01-16 00:39:29 +00:00
## Provider plugins (model auth)
Plugins can register **model provider auth ** flows so users can run OAuth or
2026-01-30 03:15:10 +01:00
API-key setup inside OpenClaw (no external scripts needed).
2026-01-16 00:39:29 +00:00
Register a provider via `api.registerProvider(...)` . Each provider exposes one
or more auth methods (OAuth, API key, device code, etc.). These methods power:
2026-01-30 03:15:10 +01:00
- `openclaw models auth login --provider <id> [--method <id>]`
2026-01-16 00:39:29 +00:00
Example:
``` ts
api . registerProvider ( {
2026-01-31 21:13:13 +09:00
id : "acme" ,
label : "AcmeAI" ,
2026-01-16 00:39:29 +00:00
auth : [
{
2026-01-31 21:13:13 +09:00
id : "oauth" ,
label : "OAuth" ,
kind : "oauth" ,
2026-01-16 00:39:29 +00:00
run : async ( ctx ) = > {
// Run OAuth flow and return auth profiles.
return {
profiles : [
{
2026-01-31 21:13:13 +09:00
profileId : "acme:default" ,
2026-01-16 00:39:29 +00:00
credential : {
2026-01-31 21:13:13 +09:00
type : "oauth" ,
provider : "acme" ,
access : "..." ,
refresh : "..." ,
2026-01-16 00:39:29 +00:00
expires : Date.now ( ) + 3600 * 1000 ,
} ,
} ,
] ,
2026-01-31 21:13:13 +09:00
defaultModel : "acme/opus-1" ,
2026-01-16 00:39:29 +00:00
} ;
} ,
} ,
] ,
} ) ;
```
Notes:
2026-01-31 18:31:49 +09:00
2026-01-16 00:39:29 +00:00
- `run` receives a `ProviderAuthContext` with `prompter` , `runtime` ,
`openUrl` , and `oauth.createVpsAwareHandlers` helpers.
- Return `configPatch` when you need to add default models or provider config.
- Return `defaultModel` so `--set-default` can update agent defaults.
2026-01-15 02:42:41 +00:00
### Register a messaging channel
Plugins can register **channel plugins ** that behave like built‑ in channels
(WhatsApp, Telegram, etc.). Channel config lives under `channels.<id>` and is
validated by your channel plugin code.
``` ts
const myChannel = {
2026-01-31 21:13:13 +09:00
id : "acmechat" ,
2026-01-15 02:42:41 +00:00
meta : {
2026-01-31 21:13:13 +09:00
id : "acmechat" ,
label : "AcmeChat" ,
selectionLabel : "AcmeChat (API)" ,
docsPath : "/channels/acmechat" ,
blurb : "demo channel plugin." ,
aliases : [ "acme" ] ,
2026-01-15 02:42:41 +00:00
} ,
2026-01-31 21:13:13 +09:00
capabilities : { chatTypes : [ "direct" ] } ,
2026-01-15 02:42:41 +00:00
config : {
2026-01-31 21:13:13 +09:00
listAccountIds : ( cfg ) = > Object . keys ( cfg . channels ? . acmechat ? . accounts ? ? { } ) ,
2026-01-15 02:42:41 +00:00
resolveAccount : ( cfg , accountId ) = >
2026-01-31 21:13:13 +09:00
cfg . channels ? . acmechat ? . accounts ? . [ accountId ? ? "default" ] ? ? {
2026-01-31 18:31:49 +09:00
accountId ,
} ,
2026-01-15 02:42:41 +00:00
} ,
outbound : {
2026-01-31 21:13:13 +09:00
deliveryMode : "direct" ,
2026-01-15 02:42:41 +00:00
sendText : async ( ) = > ( { ok : true } ) ,
} ,
} ;
export default function ( api ) {
api . registerChannel ( { plugin : myChannel } ) ;
}
```
Notes:
2026-01-31 18:31:49 +09:00
2026-01-15 02:42:41 +00:00
- Put config under `channels.<id>` (not `plugins.entries` ).
- `meta.label` is used for labels in CLI/UI lists.
- `meta.aliases` adds alternate ids for normalization and CLI inputs.
2026-01-20 11:49:31 +00:00
- `meta.preferOver` lists channel ids to skip auto-enable when both are configured.
- `meta.detailLabel` and `meta.systemImage` let UIs show richer channel labels/icons.
2026-01-15 02:42:41 +00:00
2026-01-15 02:50:03 +00:00
### Write a new messaging channel (step‑ by‑ step)
Use this when you want a **new chat surface ** (a “messaging channel”), not a model provider.
Model provider docs live under `/providers/*` .
2026-01-31 18:31:49 +09:00
1. Pick an id + config shape
2026-01-15 02:50:03 +00:00
- All channel config lives under `channels.<id>` .
- Prefer `channels.<id>.accounts.<accountId>` for multi‑ account setups.
2026-01-31 18:31:49 +09:00
2. Define the channel metadata
2026-01-15 02:50:03 +00:00
- `meta.label` , `meta.selectionLabel` , `meta.docsPath` , `meta.blurb` control CLI/UI lists.
- `meta.docsPath` should point at a docs page like `/channels/<id>` .
2026-01-20 11:49:31 +00:00
- `meta.preferOver` lets a plugin replace another channel (auto-enable prefers it).
- `meta.detailLabel` and `meta.systemImage` are used by UIs for detail text/icons.
2026-01-15 02:50:03 +00:00
2026-01-31 18:31:49 +09:00
3. Implement the required adapters
2026-01-15 02:50:03 +00:00
- `config.listAccountIds` + `config.resolveAccount`
- `capabilities` (chat types, media, threads, etc.)
- `outbound.deliveryMode` + `outbound.sendText` (for basic send)
2026-01-31 18:31:49 +09:00
4. Add optional adapters as needed
2026-01-15 02:50:03 +00:00
- `setup` (wizard), `security` (DM policy), `status` (health/diagnostics)
- `gateway` (start/stop/login), `mentions` , `threading` , `streaming`
- `actions` (message actions), `commands` (native command behavior)
2026-01-31 18:31:49 +09:00
5. Register the channel in your plugin
2026-01-15 02:50:03 +00:00
- `api.registerChannel({ plugin })`
Minimal config example:
``` json5
{
channels: {
acmechat: {
accounts: {
2026-01-31 21:13:13 +09:00
default: { token: "ACME_TOKEN", enabled: true },
2026-01-31 18:31:49 +09:00
},
},
},
2026-01-15 02:50:03 +00:00
}
```
Minimal channel plugin (outbound‑ only):
``` ts
const plugin = {
2026-01-31 21:13:13 +09:00
id : "acmechat" ,
2026-01-15 02:50:03 +00:00
meta : {
2026-01-31 21:13:13 +09:00
id : "acmechat" ,
label : "AcmeChat" ,
selectionLabel : "AcmeChat (API)" ,
docsPath : "/channels/acmechat" ,
blurb : "AcmeChat messaging channel." ,
aliases : [ "acme" ] ,
2026-01-15 02:50:03 +00:00
} ,
2026-01-31 21:13:13 +09:00
capabilities : { chatTypes : [ "direct" ] } ,
2026-01-15 02:50:03 +00:00
config : {
2026-01-31 21:13:13 +09:00
listAccountIds : ( cfg ) = > Object . keys ( cfg . channels ? . acmechat ? . accounts ? ? { } ) ,
2026-01-15 02:50:03 +00:00
resolveAccount : ( cfg , accountId ) = >
2026-01-31 21:13:13 +09:00
cfg . channels ? . acmechat ? . accounts ? . [ accountId ? ? "default" ] ? ? {
2026-01-31 18:31:49 +09:00
accountId ,
} ,
2026-01-15 02:50:03 +00:00
} ,
outbound : {
2026-01-31 21:13:13 +09:00
deliveryMode : "direct" ,
2026-01-15 02:50:03 +00:00
sendText : async ( { text } ) = > {
// deliver `text` to your channel here
return { ok : true } ;
} ,
} ,
} ;
export default function ( api ) {
api . registerChannel ( { plugin } ) ;
}
```
Load the plugin (extensions dir or `plugins.load.paths` ), restart the gateway,
then configure `channels.<id>` in your config.
2026-01-18 04:07:19 +00:00
### Agent tools
2026-01-11 12:11:12 +00:00
2026-01-18 04:07:19 +00:00
See the dedicated guide: [Plugin agent tools ](/plugins/agent-tools ).
2026-01-11 12:11:12 +00:00
### Register a gateway RPC method
``` ts
export default function ( api ) {
2026-01-31 21:13:13 +09:00
api . registerGatewayMethod ( "myplugin.status" , ( { respond } ) = > {
2026-01-11 12:11:12 +00:00
respond ( true , { ok : true } ) ;
} ) ;
}
```
### Register CLI commands
``` ts
export default function ( api ) {
2026-01-31 18:31:49 +09:00
api . registerCli (
( { program } ) = > {
2026-01-31 21:13:13 +09:00
program . command ( "mycmd" ) . action ( ( ) = > {
console . log ( "Hello" ) ;
2026-01-31 18:31:49 +09:00
} ) ;
} ,
2026-01-31 21:13:13 +09:00
{ commands : [ "mycmd" ] } ,
2026-01-31 18:31:49 +09:00
) ;
2026-01-11 12:11:12 +00:00
}
```
2026-01-23 03:17:10 +00:00
### Register auto-reply commands
Plugins can register custom slash commands that execute **without invoking the
AI agent**. This is useful for toggle commands, status checks, or quick actions
that don't need LLM processing.
``` ts
export default function ( api ) {
api . registerCommand ( {
2026-01-31 21:13:13 +09:00
name : "mystatus" ,
description : "Show plugin status" ,
2026-01-23 03:17:10 +00:00
handler : ( ctx ) = > ( {
text : ` Plugin is running! Channel: ${ ctx . channel } ` ,
} ) ,
} ) ;
}
```
Command handler context:
- `senderId` : The sender's ID (if available)
- `channel` : The channel where the command was sent
- `isAuthorizedSender` : Whether the sender is an authorized user
- `args` : Arguments passed after the command (if `acceptsArgs: true` )
- `commandBody` : The full command text
2026-01-30 03:15:10 +01:00
- `config` : The current OpenClaw config
2026-01-23 03:17:10 +00:00
Command options:
- `name` : Command name (without the leading `/` )
- `description` : Help text shown in command lists
2026-01-23 03:21:46 +00:00
- `acceptsArgs` : Whether the command accepts arguments (default: false). If false and arguments are provided, the command won't match and the message falls through to other handlers
- `requireAuth` : Whether to require authorized sender (default: true)
2026-01-23 03:17:10 +00:00
- `handler` : Function that returns `{ text: string }` (can be async)
Example with authorization and arguments:
``` ts
api . registerCommand ( {
2026-01-31 21:13:13 +09:00
name : "setmode" ,
description : "Set plugin mode" ,
2026-01-23 03:17:10 +00:00
acceptsArgs : true ,
requireAuth : true ,
handler : async ( ctx ) = > {
2026-01-31 21:13:13 +09:00
const mode = ctx . args ? . trim ( ) || "default" ;
2026-01-23 03:17:10 +00:00
await saveMode ( mode ) ;
return { text : ` Mode set to: ${ mode } ` } ;
} ,
} ) ;
```
Notes:
2026-01-31 18:31:49 +09:00
2026-01-23 03:17:10 +00:00
- Plugin commands are processed **before ** built-in commands and the AI agent
- Commands are registered globally and work across all channels
- Command names are case-insensitive (`/MyStatus` matches `/mystatus` )
2026-01-23 03:21:46 +00:00
- Command names must start with a letter and contain only letters, numbers, hyphens, and underscores
- Reserved command names (like `help` , `status` , `reset` , etc.) cannot be overridden by plugins
- Duplicate command registration across plugins will fail with a diagnostic error
2026-01-23 03:17:10 +00:00
2026-01-11 12:11:12 +00:00
### Register background services
``` ts
export default function ( api ) {
api . registerService ( {
2026-01-31 21:13:13 +09:00
id : "my-service" ,
start : ( ) = > api . logger . info ( "ready" ) ,
stop : ( ) = > api . logger . info ( "bye" ) ,
2026-01-11 12:11:12 +00:00
} ) ;
}
```
## Naming conventions
- Gateway methods: `pluginId.action` (example: `voicecall.status` )
- Tools: `snake_case` (example: `voice_call` )
- CLI commands: kebab or camel, but avoid clashing with core commands
## Skills
Plugins can ship a skill in the repo (`skills/<name>/SKILL.md` ).
Enable it with `plugins.entries.<id>.enabled` (or other config gates) and ensure
it’ s present in your workspace/managed skills locations.
2026-01-12 01:16:46 +00:00
## Distribution (npm)
Recommended packaging:
2026-01-30 03:15:10 +01:00
- Main package: `openclaw` (this repo)
- Plugins: separate npm packages under `@openclaw/*` (example: `@openclaw/voice-call` )
2026-01-12 01:16:46 +00:00
Publishing contract:
2026-01-30 03:15:10 +01:00
- Plugin `package.json` must include `openclaw.extensions` with one or more entry files.
2026-01-12 01:16:46 +00:00
- Entry files can be `.js` or `.ts` (jiti loads TS at runtime).
2026-01-30 03:15:10 +01:00
- `openclaw plugins install <npm-spec>` uses `npm pack` , extracts into `~/.openclaw/extensions/<id>/` , and enables it in config.
2026-01-12 01:16:46 +00:00
- Config key stability: scoped packages are normalized to the **unscoped ** id for `plugins.entries.*` .
2026-01-11 12:11:12 +00:00
## Example plugin: Voice Call
2026-01-11 23:23:14 +00:00
This repo includes a voice‑ call plugin (Twilio or log fallback):
2026-01-11 12:11:12 +00:00
- Source: `extensions/voice-call`
- Skill: `skills/voice-call`
2026-01-30 03:15:10 +01:00
- CLI: `openclaw voicecall start|status`
2026-01-11 12:11:12 +00:00
- Tool: `voice_call`
2026-01-11 23:23:14 +00:00
- RPC: `voicecall.start` , `voicecall.status`
- Config (twilio): `provider: "twilio"` + `twilio.accountSid/authToken/from` (optional `statusCallbackUrl` , `twimlUrl` )
- Config (dev): `provider: "log"` (no network)
2026-01-11 12:11:12 +00:00
2026-01-12 01:16:46 +00:00
See [Voice Call ](/plugins/voice-call ) and `extensions/voice-call/README.md` for setup and usage.
2026-01-11 12:11:12 +00:00
## Safety notes
Plugins run in-process with the Gateway. Treat them as trusted code:
- Only install plugins you trust.
- Prefer `plugins.allow` allowlists.
- Restart the Gateway after changes.
2026-01-12 01:16:46 +00:00
## Testing plugins
Plugins can (and should) ship tests:
- In-repo plugins can keep Vitest tests under `src/**` (example: `src/plugins/voice-call.plugin.test.ts` ).
2026-01-31 18:31:49 +09:00
- Separately published plugins should run their own CI (lint/build/test) and validate `openclaw.extensions` points at the built entrypoint (`dist/index.js` ).