Skip to main content
How api.registrationMode reports the way a plugin was loaded, and what each mode expects a plugin to register. Part of the Plugin entry points reference.

Registration mode

api.registrationMode tells your plugin how it was loaded: In "cli-metadata" and "setup-only" modes, accessing a runtime capability throws an error naming the plugin and mode. Defer runtime access out of register() or declare root commands in the manifest’s cliCommands so CLI metadata can be collected without executing the plugin. defineChannelPluginEntry handles this split automatically. If you use definePluginEntry directly for a channel, check mode yourself and remember "tool-discovery" skips channel registration:
Long-lived services may emit small invalidation or lifecycle events through their service context:
OpenClaw namespaces this as plugin.<plugin-id>.changed. Event names are one lowercase segment, payloads must be bounded JSON, and the scope must be operator.read, operator.write, or operator.admin. The emitter exists only for the service lifetime and is revoked after stop or failed start. Prefer version or invalidation payloads over full records so authorized clients reread canonical state through the plugin’s scoped Gateway methods. Discovery mode builds a non-activating registry snapshot. It may still evaluate the plugin entry and the channel plugin object so OpenClaw can register channel capabilities and static CLI descriptors. Treat module evaluation in discovery as trusted but lightweight: no network clients, subprocesses, listeners, database connections, background workers, credential reads, or other live runtime side effects at top level. Treat "setup-runtime" as the window where setup-only startup surfaces must exist without re-entering the full bundled channel runtime. Good fits are channel registration, setup-safe HTTP routes, setup-safe gateway methods, and delegated setup helpers. Heavy background services, CLI registrars, and provider/client SDK bootstraps still belong in "full".