Chat commands
Plugins can register chat commands that the gateway handles directly — without involving the LLM. When a user sends/my-command arg1 arg2, the gateway routes it to your handler and sends the reply immediately. Use this for fast utility responses, status lookups, or in-chat controls that don’t need an AI agent.
Chat commands are distinct from agent tools: tools extend what the agent can call during a run; commands intercept messages before the agent runs.
Registering a command
OpenClawPluginCommandDefinition fields
The handler
The handler receives aPluginCommandContext:
Return a
ReplyPayload from the handler:
Using command arguments
Access control
requireAuth: true (the default) means only senders on the channel’s allowFrom list can invoke the command. Unauthorized senders receive no response and the invocation is silently dropped.
Set requireAuth: false for commands intended for all users (e.g. a public status command):
Name collision
If two plugins register the same command name, both register but only one runs (last registration wins). Use namespaced names to avoid collisions:my-plugin_status rather than status.
Async safety
Handlers are called in the gateway’s event loop. Do not perform synchronous blocking I/O inside a handler.What’s next
- Agent tools — extend what the AI agent can call during a run
- Hooks — observe or modify the run lifecycle
- Plugin SDK reference — full exported surface