Plugin SDK reference
Plugin SDK memory and context slots
The registrars that allow only one active implementation at a time, and the memory adapter contracts that sit on top of them. Part of the Plugin SDK overview.
Exclusive slots
| Method | What it registers |
|---|---|
api.registerContextEngine(id, factory) |
Context engine (one active at a time). Use info.acceptedHostParams to restrict accepted host-added lifecycle fields, including optional maintain() cancellation; undeclared engines receive all current host fields. |
api.registerMemoryCapability(capability) |
Unified memory capability |
To participate in durable admitted turns, context engines must declare
currentTurnFence: "before-current-turn-entry-v1" and
turnAdvancementIdempotency: "atomic-idempotent-v1" under
info.transcriptSemantics, then implement commitTurn(...) as an atomic,
idempotent write keyed by advancementKey. OpenClaw supplies only the inclusive
accepted turn, from its admitted user entry through its terminal entry; use the
readSessionTranscriptVisibleMessageDelta(...) cursor API to bootstrap or
rebuild earlier history. Without the full contract, OpenClaw uses the legacy
context path for the whole logical turn and its retries, leaves the configured
engine unchanged, and tries that engine again on the next logical turn.
Memory embedding adapters
registerMemoryCapabilityis the exclusive memory-plugin API.registerMemoryCapabilitymay also exposepublicArtifacts.listArtifacts(...)for host-managed exports. Companion plugins that enumerate those declared artifacts still uselistActiveMemoryPublicArtifacts(...)from the retainedopenclaw/plugin-sdk/memory-host-corefacade until a focused public consumer API exists; they must not reach into another plugin's private layout.- A memory runtime that can return session-transcript hits should implement
runtime.authorizeSearchHits(...). The host calls this hook before raw search hits reach caller-visible surfaces and supplies the requesting agent, session key, and sandbox state. Return only hits the requester may observe. If the hook is absent, OpenClaw fails closed by withholding session-source hits while retaining ordinary memory hits. Keep transcript identity and visibility policy in the owning memory plugin; callers must not infer authorization from paths or duplicate plugin-specific rules. MemoryFlushPlan.modelcan pin the flush turn to an exactprovider/modelreference, such asollama/qwen3:8b, without inheriting the active fallback chain.- Embedding providers use
api.registerEmbeddingProvider(...)andcontracts.embeddingProviders; there is no separate memory-only registry.