Skip to main content

Plugin Setup and Config

Reference for plugin packaging (package.json metadata), manifests (velaclaw.plugin.json), setup entries, and config schemas.
Looking for a walkthrough? The how-to guides cover packaging in context: Channel Plugins and Provider Plugins.

Package metadata

Your package.json needs an velaclaw field that tells the plugin system what your plugin provides: Channel plugin:
Provider plugin / ClawHub publish baseline:
velaclaw-clawhub-package.json
If you publish the plugin externally on ClawHub, those compat and build fields are required. The canonical publish snippets live in docs/snippets/plugin-publish/.

velaclaw fields

velaclaw.channel

velaclaw.channel is cheap package metadata for channel discovery and setup surfaces before runtime loads. Example:
exposure supports:
  • configured: include the channel in configured/status-style listing surfaces
  • setup: include the channel in interactive setup/configure pickers
  • docs: mark the channel as public-facing in docs/navigation surfaces
showConfigured and showInSetup remain supported as legacy aliases. Prefer exposure.

velaclaw.install

velaclaw.install is package metadata, not manifest metadata. If minHostVersion is set, install and manifest-registry loading both enforce it. Older hosts skip the plugin; invalid version strings are rejected. allowInvalidConfigRecovery is not a general bypass for broken configs. It is for narrow bundled-plugin recovery only, so reinstall/setup can repair known upgrade leftovers like a missing bundled plugin path or stale channels.<id> entry for that same plugin. If config is broken for unrelated reasons, install still fails closed and tells the operator to run velaclaw doctor --fix.

Deferred full load

Channel plugins can opt into deferred loading with:
When enabled, Velaclaw loads only setupEntry during the pre-listen startup phase, even for already-configured channels. The full entry loads after the gateway starts listening.
Only enable deferred loading when your setupEntry registers everything the gateway needs before it starts listening (channel registration, HTTP routes, gateway methods). If the full entry owns required startup capabilities, keep the default behavior.
If your setup/full entry registers gateway RPC methods, keep them on a plugin-specific prefix. Reserved core admin namespaces (config.*, exec.approvals.*, wizard.*, update.*) stay core-owned and always resolve to operator.admin.

Plugin manifest

Every native plugin must ship an velaclaw.plugin.json in the package root. Velaclaw uses this to validate config without executing plugin code.
For channel plugins, add kind and channels:
Even plugins with no config must ship a schema. An empty schema is valid:
See Plugin Manifest for the full schema reference.

ClawHub publishing

For plugin packages, use the package-specific ClawHub command:
The legacy skill-only publish alias is for skills. Plugin packages should always use clawhub package publish.

Setup entry

The setup-entry.ts file is a lightweight alternative to index.ts that Velaclaw loads when it only needs setup surfaces (onboarding, config repair, disabled channel inspection).
This avoids loading heavy runtime code (crypto libraries, CLI registrations, background services) during setup flows. Bundled workspace channels that keep setup-safe exports in sidecar modules can use defineBundledChannelSetupEntry(...) from velaclaw/plugin-sdk/channel-entry-contract instead of defineSetupPluginEntry(...). That bundled contract also supports an optional runtime export so setup-time runtime wiring can stay lightweight and explicit. When Velaclaw uses setupEntry instead of the full entry:
  • The channel is disabled but needs setup/onboarding surfaces
  • The channel is enabled but unconfigured
  • Deferred loading is enabled (deferConfiguredChannelFullLoadUntilAfterListen)
What setupEntry must register:
  • The channel plugin object (via defineSetupPluginEntry)
  • Any HTTP routes required before gateway listen
  • Any gateway methods needed during startup
Those startup gateway methods should still avoid reserved core admin namespaces such as config.* or update.*. What setupEntry should NOT include:
  • CLI registrations
  • Background services
  • Heavy runtime imports (crypto, SDKs)
  • Gateway methods only needed after startup

Narrow setup helper imports

For hot setup-only paths, prefer the narrow setup helper seams over the broader plugin-sdk/setup umbrella when you only need part of the setup surface: Use the broader plugin-sdk/setup seam when you want the full shared setup toolbox, including config-patch helpers such as moveSingleAccountChannelSectionToDefaultAccount(...). The setup patch adapters stay hot-path safe on import. Their bundled single-account promotion contract-surface lookup is lazy, so importing plugin-sdk/setup-runtime does not eagerly load bundled contract-surface discovery before the adapter is actually used.

Channel-owned single-account promotion

When a channel upgrades from a single-account top-level config to channels.<id>.accounts.*, the default shared behavior is to move promoted account-scoped values into accounts.default. Bundled channels can narrow or override that promotion through their setup contract surface:
  • singleAccountKeysToMove: extra top-level keys that should move into the promoted account
  • namedAccountPromotionKeys: when named accounts already exist, only these keys move into the promoted account; shared policy/delivery keys stay at the channel root
  • resolveSingleAccountPromotionTarget(...): choose which existing account receives promoted values
Matrix is the current bundled example. If exactly one named Matrix account already exists, or if defaultAccount points at an existing non-canonical key such as Ops, promotion preserves that account instead of creating a new accounts.default entry.

Config schema

Plugin config is validated against the JSON Schema in your manifest. Users configure plugins via:
Your plugin receives this config as api.pluginConfig during registration. For channel-specific config, use the channel config section instead:

Building channel config schemas

Use buildChannelConfigSchema from velaclaw/plugin-sdk/core to convert a Zod schema into the ChannelConfigSchema wrapper that Velaclaw validates:

Setup wizards

Channel plugins can provide interactive setup wizards for velaclaw onboard. The wizard is a ChannelSetupWizard object on the ChannelPlugin:
The ChannelSetupWizard type supports credentials, textInputs, dmPolicy, allowFrom, groupAccess, prepare, finalize, and more. See bundled plugin packages (for example the Discord plugin src/channel.setup.ts) for full examples. For DM allowlist prompts that only need the standard note -> prompt -> parse -> merge -> patch flow, prefer the shared setup helpers from velaclaw/plugin-sdk/setup: createPromptParsedAllowFromForAccount(...), createTopLevelChannelParsedAllowFromPrompt(...), and createNestedChannelParsedAllowFromPrompt(...). For channel setup status blocks that only vary by labels, scores, and optional extra lines, prefer createStandardChannelSetupStatus(...) from velaclaw/plugin-sdk/setup instead of hand-rolling the same status object in each plugin. For optional setup surfaces that should only appear in certain contexts, use createOptionalChannelSetupSurface from velaclaw/plugin-sdk/channel-setup:
plugin-sdk/channel-setup also exposes the lower-level createOptionalChannelSetupAdapter(...) and createOptionalChannelSetupWizard(...) builders when you only need one half of that optional-install surface. The generated optional adapter/wizard fail closed on real config writes. They reuse one install-required message across validateInput, applyAccountConfig, and finalize, and append a docs link when docsPath is set. For binary-backed setup UIs, prefer the shared delegated helpers instead of copying the same binary/status glue into every channel:
  • createDetectedBinaryStatus(...) for status blocks that vary only by labels, hints, scores, and binary detection
  • createCliPathTextInput(...) for path-backed text inputs
  • createDelegatedSetupWizardStatusResolvers(...), createDelegatedPrepare(...), createDelegatedFinalize(...), and createDelegatedResolveConfigured(...) when setupEntry needs to forward to a heavier full wizard lazily
  • createDelegatedTextInputShouldPrompt(...) when setupEntry only needs to delegate a textInputs[*].shouldPrompt decision

Publishing and installing

External plugins: publish to ClawHub or npm, then install:
Velaclaw tries ClawHub first and falls back to npm automatically. You can also force ClawHub explicitly:
There is no matching npm: override. Use the normal npm package spec when you want the npm path after ClawHub fallback:
In-repo plugins: place under the bundled plugin workspace tree and they are automatically discovered during build. Users can install:
For npm-sourced installs, velaclaw plugins install runs npm install --ignore-scripts (no lifecycle scripts). Keep plugin dependency trees pure JS/TS and avoid packages that require postinstall builds.