Skip to main content

Plugin SDK Migration

OpenClaw has moved from a broad backwards-compatibility layer to a modern plugin architecture with focused, documented imports. If your plugin was built before the new architecture, this guide helps you migrate.

What is changing

The old plugin system provided two wide-open surfaces that let plugins import anything they needed from a single entry point:
  • openclaw/plugin-sdk/compat — a single import that re-exported dozens of helpers. It was introduced to keep older hook-based plugins working while the new plugin architecture was being built.
  • openclaw/extension-api — a bridge that gave plugins direct access to host-side helpers like the embedded agent runner.
Both surfaces are now deprecated. They still work at runtime, but new plugins must not use them, and existing plugins should migrate before the next major release removes them.
The backwards-compatibility layer will be removed in a future major release. Plugins that still import from these surfaces will break when that happens.

Why this changed

The old approach caused problems:
  • Slow startup — importing one helper loaded dozens of unrelated modules
  • Circular dependencies — broad re-exports made it easy to create import cycles
  • Unclear API surface — no way to tell which exports were stable vs internal
The modern plugin SDK fixes this: each import path (openclaw/plugin-sdk/\<subpath\>) is a small, self-contained module with a clear purpose and documented contract. Legacy provider convenience seams for bundled channels are also gone. Imports such as openclaw/plugin-sdk/slack, openclaw/plugin-sdk/discord, openclaw/plugin-sdk/signal, openclaw/plugin-sdk/whatsapp, openclaw/plugin-sdk/whatsapp-surface, and openclaw/plugin-sdk/telegram-core were private mono-repo shortcuts, not stable plugin contracts. Use narrow generic SDK subpaths instead. Inside the bundled plugin workspace, keep provider-owned helpers in that plugin’s own api.ts or runtime-api.ts. Current bundled provider examples:
  • Anthropic keeps Claude-specific stream helpers in its own api.ts / contract-api.ts seam
  • OpenAI keeps provider builders, default-model helpers, and realtime provider builders in its own api.ts
  • OpenRouter keeps provider builder and onboarding/config helpers in its own api.ts

How to migrate

1

Audit Windows wrapper fallback behavior

If your plugin uses openclaw/plugin-sdk/windows-spawn, unresolved Windows .cmd/.bat wrappers now fail closed unless you explicitly pass allowShellFallback: true.
// Before
const program = applyWindowsSpawnProgramPolicy({ candidate });

// After
const program = applyWindowsSpawnProgramPolicy({
  candidate,
  // Only set this for trusted compatibility callers that intentionally
  // accept shell-mediated fallback.
  allowShellFallback: true,
});
If your caller does not intentionally rely on shell fallback, do not set allowShellFallback and handle the thrown error instead.
2

Find deprecated imports

Search your plugin for imports from either deprecated surface:
grep -r "plugin-sdk/compat" my-plugin/
grep -r "openclaw/extension-api" my-plugin/
3

Replace with focused imports

Each export from the old surface maps to a specific modern import path:
// Before (deprecated backwards-compatibility layer)
import {
  createChannelReplyPipeline,
  createPluginRuntimeStore,
  resolveControlCommandGate,
} from "openclaw/plugin-sdk/compat";

// After (modern focused imports)
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth";
For host-side helpers, use the injected plugin runtime instead of importing directly:
// Before (deprecated extension-api bridge)
import { runEmbeddedPiAgent } from "openclaw/extension-api";
const result = await runEmbeddedPiAgent({ sessionId, prompt });

// After (injected runtime)
const result = await api.runtime.agent.runEmbeddedPiAgent({ sessionId, prompt });
The same pattern applies to other legacy bridge helpers:
Old importModern equivalent
resolveAgentDirapi.runtime.agent.resolveAgentDir
resolveAgentWorkspaceDirapi.runtime.agent.resolveAgentWorkspaceDir
resolveAgentIdentityapi.runtime.agent.resolveAgentIdentity
resolveThinkingDefaultapi.runtime.agent.resolveThinkingDefault
resolveAgentTimeoutMsapi.runtime.agent.resolveAgentTimeoutMs
ensureAgentWorkspaceapi.runtime.agent.ensureAgentWorkspace
session store helpersapi.runtime.agent.session.*
4

Build and test

pnpm build
pnpm test -- my-plugin/

Import path reference

Import pathPurposeKey exports
plugin-sdk/plugin-entryCanonical plugin entry helperdefinePluginEntry
plugin-sdk/coreLegacy umbrella re-export for channel entry definitions/buildersdefineChannelPluginEntry, createChatChannelPlugin
plugin-sdk/config-schemaRoot config schema exportOpenClawSchema
plugin-sdk/provider-entrySingle-provider entry helperdefineSingleProviderPluginEntry
plugin-sdk/channel-coreFocused channel entry definitions and buildersdefineChannelPluginEntry, defineSetupPluginEntry, createChatChannelPlugin, createChannelPluginBase
plugin-sdk/setupShared setup wizard helpersAllowlist prompts, setup status builders
plugin-sdk/setup-runtimeSetup-time runtime helpersImport-safe setup patch adapters, lookup-note helpers, promptResolvedAllowFrom, splitSetupEntries, delegated setup proxies
plugin-sdk/setup-adapter-runtimeSetup adapter helperscreateEnvPatchedAccountSetupAdapter
plugin-sdk/setup-toolsSetup tooling helpersformatCliCommand, detectBinary, extractArchive, resolveBrewExecutable, formatDocsLink, CONFIG_DIR
plugin-sdk/account-coreMulti-account helpersAccount list/config/action-gate helpers
plugin-sdk/account-idAccount-id helpersDEFAULT_ACCOUNT_ID, account-id normalization
plugin-sdk/account-resolutionAccount lookup helpersAccount lookup + default-fallback helpers
plugin-sdk/account-helpersNarrow account helpersAccount list/account-action helpers
plugin-sdk/channel-setupSetup wizard adapterscreateOptionalChannelSetupSurface, createOptionalChannelSetupAdapter, createOptionalChannelSetupWizard, plus DEFAULT_ACCOUNT_ID, createTopLevelChannelDmPolicy, setSetupChannelEnabled, splitSetupEntries
plugin-sdk/channel-pairingDM pairing primitivescreateChannelPairingController
plugin-sdk/channel-reply-pipelineReply prefix + typing wiringcreateChannelReplyPipeline
plugin-sdk/channel-config-helpersConfig adapter factoriescreateHybridChannelConfigAdapter
plugin-sdk/channel-config-schemaConfig schema buildersChannel config schema types
plugin-sdk/telegram-command-configTelegram command config helpersCommand-name normalization, description trimming, duplicate/conflict validation
plugin-sdk/channel-policyGroup/DM policy resolutionresolveChannelGroupRequireMention
plugin-sdk/channel-lifecycleAccount status trackingcreateAccountStatusSink
plugin-sdk/inbound-envelopeInbound envelope helpersShared route + envelope builder helpers
plugin-sdk/inbound-reply-dispatchInbound reply helpersShared record-and-dispatch helpers
plugin-sdk/messaging-targetsMessaging target parsingTarget parsing/matching helpers
plugin-sdk/outbound-mediaOutbound media helpersShared outbound media loading
plugin-sdk/outbound-runtimeOutbound runtime helpersOutbound identity/send delegate helpers
plugin-sdk/thread-bindings-runtimeThread-binding helpersThread-binding lifecycle and adapter helpers
plugin-sdk/agent-media-payloadLegacy media payload helpersAgent media payload builder for legacy field layouts
plugin-sdk/channel-runtimeDeprecated compatibility shimLegacy channel runtime utilities only
plugin-sdk/channel-send-resultSend result typesReply result types
plugin-sdk/runtime-storePersistent plugin storagecreatePluginRuntimeStore
plugin-sdk/runtimeBroad runtime helpersRuntime/logging/backup/plugin-install helpers
plugin-sdk/runtime-envNarrow runtime env helpersLogger/runtime env, timeout, retry, and backoff helpers
plugin-sdk/plugin-runtimeShared plugin runtime helpersPlugin commands/hooks/http/interactive helpers
plugin-sdk/hook-runtimeHook pipeline helpersShared webhook/internal hook pipeline helpers
plugin-sdk/lazy-runtimeLazy runtime helperscreateLazyRuntimeModule, createLazyRuntimeMethod, createLazyRuntimeMethodBinder, createLazyRuntimeNamedExport, createLazyRuntimeSurface
plugin-sdk/process-runtimeProcess helpersShared exec helpers
plugin-sdk/cli-runtimeCLI runtime helpersCommand formatting, waits, version helpers
plugin-sdk/gateway-runtimeGateway helpersGateway client and channel-status patch helpers
plugin-sdk/config-runtimeConfig helpersConfig load/write helpers
plugin-sdk/telegram-command-configTelegram command helpersFallback-stable Telegram command validation helpers when the bundled Telegram contract surface is unavailable
plugin-sdk/approval-runtimeApproval prompt helpersExec/plugin approval payload, approval capability/profile helpers, native approval routing/runtime helpers
plugin-sdk/approval-auth-runtimeApproval auth helpersApprover resolution, same-chat action auth
plugin-sdk/approval-client-runtimeApproval client helpersNative exec approval profile/filter helpers
plugin-sdk/approval-delivery-runtimeApproval delivery helpersNative approval capability/delivery adapters
plugin-sdk/approval-native-runtimeApproval target helpersNative approval target/account binding helpers
plugin-sdk/approval-reply-runtimeApproval reply helpersExec/plugin approval reply payload helpers
plugin-sdk/security-runtimeSecurity helpersShared trust, DM gating, external-content, and secret-collection helpers
plugin-sdk/ssrf-policySSRF policy helpersHost allowlist and private-network policy helpers
plugin-sdk/ssrf-runtimeSSRF runtime helpersPinned-dispatcher, guarded fetch, SSRF policy helpers
plugin-sdk/collection-runtimeBounded cache helperspruneMapToMaxSize
plugin-sdk/diagnostic-runtimeDiagnostic gating helpersisDiagnosticFlagEnabled, isDiagnosticsEnabled
plugin-sdk/error-runtimeError formatting helpersformatUncaughtError, isApprovalNotFoundError, error graph helpers
plugin-sdk/fetch-runtimeWrapped fetch/proxy helpersresolveFetch, proxy helpers
plugin-sdk/host-runtimeHost normalization helpersnormalizeHostname, normalizeScpRemoteHost
plugin-sdk/retry-runtimeRetry helpersRetryConfig, retryAsync, policy runners
plugin-sdk/allow-fromAllowlist formattingformatAllowFromLowercase
plugin-sdk/allowlist-resolutionAllowlist input mappingmapAllowlistResolutionInputs
plugin-sdk/command-authCommand gating and command-surface helpersresolveControlCommandGate, sender-authorization helpers, command registry helpers
plugin-sdk/secret-inputSecret input parsingSecret input helpers
plugin-sdk/webhook-ingressWebhook request helpersWebhook target utilities
plugin-sdk/webhook-request-guardsWebhook body guard helpersRequest body read/limit helpers
plugin-sdk/reply-runtimeShared reply runtimeInbound dispatch, heartbeat, reply planner, chunking
plugin-sdk/reply-dispatch-runtimeNarrow reply dispatch helpersFinalize + provider dispatch helpers
plugin-sdk/reply-historyReply-history helpersbuildHistoryContext, buildPendingHistoryContextFromMap, recordPendingHistoryEntry, clearHistoryEntriesIfEnabled
plugin-sdk/reply-referenceReply reference planningcreateReplyReferencePlanner
plugin-sdk/reply-chunkingReply chunk helpersText/markdown chunking helpers
plugin-sdk/session-store-runtimeSession store helpersStore path + updated-at helpers
plugin-sdk/state-pathsState path helpersState and OAuth dir helpers
plugin-sdk/routingRouting/session-key helpersresolveAgentRoute, buildAgentSessionKey, resolveDefaultAgentBoundAccountId, session-key normalization helpers
plugin-sdk/status-helpersChannel status helpersChannel/account status summary builders, runtime-state defaults, issue metadata helpers
plugin-sdk/target-resolver-runtimeTarget resolver helpersShared target resolver helpers
plugin-sdk/string-normalization-runtimeString normalization helpersSlug/string normalization helpers
plugin-sdk/request-urlRequest URL helpersExtract string URLs from request-like inputs
plugin-sdk/run-commandTimed command helpersTimed command runner with normalized stdout/stderr
plugin-sdk/param-readersParam readersCommon tool/CLI param readers
plugin-sdk/tool-sendTool send extractionExtract canonical send target fields from tool args
plugin-sdk/temp-pathTemp path helpersShared temp-download path helpers
plugin-sdk/logging-coreLogging helpersSubsystem logger and redaction helpers
plugin-sdk/markdown-table-runtimeMarkdown-table helpersMarkdown table mode helpers
plugin-sdk/reply-payloadMessage reply typesReply payload types
plugin-sdk/provider-setupCurated local/self-hosted provider setup helpersSelf-hosted provider discovery/config helpers
plugin-sdk/self-hosted-provider-setupFocused OpenAI-compatible self-hosted provider setup helpersSame self-hosted provider discovery/config helpers
plugin-sdk/provider-auth-runtimeProvider runtime auth helpersRuntime API-key resolution helpers
plugin-sdk/provider-auth-api-keyProvider API-key setup helpersAPI-key onboarding/profile-write helpers
plugin-sdk/provider-auth-resultProvider auth-result helpersStandard OAuth auth-result builder
plugin-sdk/provider-auth-loginProvider interactive login helpersShared interactive login helpers
plugin-sdk/provider-env-varsProvider env-var helpersProvider auth env-var lookup helpers
plugin-sdk/provider-model-sharedShared provider model/replay helpersProviderReplayFamily, buildProviderReplayFamilyHooks, normalizeModelCompat, shared replay-policy builders, provider-endpoint helpers, and model-id normalization helpers
plugin-sdk/provider-catalog-sharedShared provider catalog helpersfindCatalogTemplate, buildSingleProviderApiKeyCatalog, supportsNativeStreamingUsageCompat, applyProviderNativeStreamingUsageCompat
plugin-sdk/provider-onboardProvider onboarding patchesOnboarding config helpers
plugin-sdk/provider-httpProvider HTTP helpersGeneric provider HTTP/endpoint capability helpers
plugin-sdk/provider-web-fetchProvider web-fetch helpersWeb-fetch provider registration/cache helpers
plugin-sdk/provider-web-searchProvider web-search helpersWeb-search provider registration/cache/config helpers
plugin-sdk/provider-toolsProvider tool/schema compat helpersProviderToolCompatFamily, buildProviderToolCompatFamilyHooks, Gemini schema cleanup + diagnostics, and xAI compat helpers such as resolveXaiModelCompatPatch / applyXaiModelCompat
plugin-sdk/provider-usageProvider usage helpersfetchClaudeUsage, fetchGeminiUsage, fetchGithubCopilotUsage, and other provider usage helpers
plugin-sdk/provider-streamProvider stream wrapper helpersProviderStreamFamily, buildProviderStreamFamilyHooks, composeProviderStreamWrappers, stream wrapper types, and shared Anthropic/Bedrock/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot wrapper helpers
plugin-sdk/keyed-async-queueOrdered async queueKeyedAsyncQueue
plugin-sdk/media-runtimeShared media helpersMedia fetch/transform/store helpers plus media payload builders
plugin-sdk/media-understanding-runtimeMedia-understanding runtime facadeMedia-understanding runner facade and typed result helpers
plugin-sdk/text-runtimeShared text helpersAssistant-visible-text stripping, markdown render/chunking/table helpers, redaction helpers, directive-tag helpers, safe-text utilities, and related text/logging helpers
plugin-sdk/text-chunkingText chunking helpersOutbound text chunking helper
plugin-sdk/speech-runtimeSpeech runtime facadeTTS resolution and synthesis helpers
plugin-sdk/speech-coreShared speech coreSpeech provider types, registry, directives, normalization
plugin-sdk/realtime-transcriptionRealtime transcription helpersProvider types and registry helpers
plugin-sdk/realtime-voiceRealtime voice helpersProvider types and registry helpers
plugin-sdk/image-generation-coreShared image-generation coreImage-generation types, failover, auth, and registry helpers
plugin-sdk/video-generationVideo-generation provider typesVideo-generation provider/request/result types for provider plugins
plugin-sdk/video-generation-coreShared video-generation coreVideo-generation types, failover helpers, provider lookup, and model-ref parsing
plugin-sdk/video-generation-runtimeVideo-generation runtime facadeShared runtime generateVideo / listRuntimeVideoGenerationProviders facade
plugin-sdk/interactive-runtimeInteractive reply helpersInteractive reply payload normalization/reduction
plugin-sdk/channel-config-primitivesChannel config primitivesNarrow channel config-schema primitives
plugin-sdk/channel-config-writesChannel config-write helpersChannel config-write authorization helpers
plugin-sdk/channel-plugin-commonShared channel preludeShared channel plugin prelude exports
plugin-sdk/channel-statusChannel status helpersShared channel status snapshot/summary helpers
plugin-sdk/allowlist-config-editAllowlist config helpersAllowlist config edit/read helpers
plugin-sdk/group-accessGroup access helpersShared group-access decision helpers
plugin-sdk/direct-dmDirect-DM helpersShared direct-DM auth/guard helpers
plugin-sdk/extension-sharedShared extension helpersPassive-channel/status helper primitives
plugin-sdk/webhook-targetsWebhook target helpersWebhook target registry and route-install helpers
plugin-sdk/webhook-pathWebhook path helpersWebhook path normalization helpers
plugin-sdk/web-mediaShared web media helpersRemote/local media loading helpers
plugin-sdk/zodZod re-exportRe-exported zod for plugin SDK consumers
plugin-sdk/memory-coreBundled memory-core helpersMemory manager/config/file/CLI helper surface
plugin-sdk/memory-core-engine-runtimeMemory engine runtime facadeMemory index/search runtime facade
plugin-sdk/memory-core-host-engine-foundationMemory host foundation engineMemory host foundation engine exports
plugin-sdk/memory-core-host-engine-embeddingsMemory host embedding engineMemory host embedding engine exports
plugin-sdk/memory-core-host-engine-qmdMemory host QMD engineMemory host QMD engine exports
plugin-sdk/memory-core-host-engine-storageMemory host storage engineMemory host storage engine exports
plugin-sdk/memory-core-host-multimodalMemory host multimodal helpersMemory host multimodal helpers
plugin-sdk/memory-core-host-queryMemory host query helpersMemory host query helpers
plugin-sdk/memory-core-host-secretMemory host secret helpersMemory host secret helpers
plugin-sdk/memory-core-host-statusMemory host status helpersMemory host status helpers
plugin-sdk/memory-core-host-runtime-cliMemory host CLI runtimeMemory host CLI runtime helpers
plugin-sdk/memory-core-host-runtime-coreMemory host core runtimeMemory host core runtime helpers
plugin-sdk/memory-core-host-runtime-filesMemory host file/runtime helpersMemory host file/runtime helpers
plugin-sdk/memory-lancedbBundled memory-lancedb helpersMemory-lancedb helper surface
plugin-sdk/testingTest utilitiesTest helpers and mocks
This table is intentionally the common migration subset, not the full SDK surface. The generated full list of 200+ entrypoints lives in scripts/lib/plugin-sdk-entrypoints.json. That generated list still includes some bundled-plugin helper seams such as plugin-sdk/feishu, plugin-sdk/feishu-setup, plugin-sdk/zalo, plugin-sdk/zalo-setup, and plugin-sdk/matrix*. Those remain exported for bundled-plugin maintenance and compatibility, but they are intentionally omitted from the common migration table and are not the recommended target for new plugin code. The same rule applies to other generated bundled-helper families such as:
  • browser: plugin-sdk/browser*
  • Matrix: plugin-sdk/matrix*
  • LINE: plugin-sdk/line*
  • IRC: plugin-sdk/irc*
  • bundled helper/plugin surfaces like plugin-sdk/googlechat, plugin-sdk/whatsapp-surface, plugin-sdk/zalouser, plugin-sdk/bluebubbles*, plugin-sdk/mattermost*, plugin-sdk/msteams, plugin-sdk/nextcloud-talk, plugin-sdk/nostr, plugin-sdk/tlon, plugin-sdk/twitch, plugin-sdk/openai, plugin-sdk/moonshot, plugin-sdk/qwen*, plugin-sdk/modelstudio*, plugin-sdk/provider-moonshot, plugin-sdk/cloudflare-ai-gateway, plugin-sdk/byteplus, plugin-sdk/chutes, plugin-sdk/deepseek, plugin-sdk/google, plugin-sdk/huggingface, plugin-sdk/kimi-coding, plugin-sdk/kilocode, plugin-sdk/minimax, plugin-sdk/mistral, plugin-sdk/nvidia, plugin-sdk/ollama*, plugin-sdk/opencode, plugin-sdk/opencode-go, plugin-sdk/qianfan, plugin-sdk/sglang, plugin-sdk/synthetic, plugin-sdk/venice, plugin-sdk/vllm, plugin-sdk/xai, plugin-sdk/volcengine, plugin-sdk/github-copilot-login, plugin-sdk/github-copilot-token, plugin-sdk/diagnostics-otel, plugin-sdk/diffs, plugin-sdk/llm-task, plugin-sdk/thread-ownership, and plugin-sdk/voice-call
plugin-sdk/github-copilot-token currently exposes the narrow token-helper surface DEFAULT_COPILOT_API_BASE_URL, deriveCopilotApiBaseUrlFromToken, and resolveCopilotApiToken. plugin-sdk/whatsapp-surface currently exposes DEFAULT_WEB_MEDIA_BYTES, WhatsApp auth/account helpers, directory-config helpers, group-policy helpers, outbound-target resolution, and the narrow WebChannelStatus / WebInboundMessage / WebListenerCloseReason / WebMonitorTuning types. For Qwen specifically, prefer the canonical plugin-sdk/qwen and plugin-sdk/qwen-definitions seams. plugin-sdk/modelstudio* remains exported as a compatibility alias for older plugin code. Use the narrowest import that matches the job. If you cannot find an export, check the source at src/plugin-sdk/ or ask in Discord.

Removal timeline

WhenWhat happens
NowDeprecated surfaces emit runtime warnings
Next major releaseDeprecated surfaces will be removed; plugins still using them will fail
All core plugins have already been migrated. External plugins should migrate before the next major release.

Suppressing the warnings temporarily

Set these environment variables while you work on migrating:
OPENCLAW_SUPPRESS_PLUGIN_SDK_COMPAT_WARNING=1 openclaw gateway run
OPENCLAW_SUPPRESS_EXTENSION_API_WARNING=1 openclaw gateway run
This is a temporary escape hatch, not a permanent solution.