Skip to main content

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

The command is available in any channel the user has configured. No restart is needed when a plugin loads.

OpenClawPluginCommandDefinition fields

The handler

The handler receives a PluginCommandContext: 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):
Commands with requireAuth: false respond to any sender regardless of channel policy. Do not return sensitive information from unauthenticated commands.

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