All News
TrendingMemory

OpenClaw Just Handed Third-Party Developers the Keys to AI Memory

March 21, 20265 min read

The active memory plugin registers its own system prompt builder callback.

— PR #40126 description, the sentence that changes everything

How the memory system prompt changed

Before PR #40126
system-prompt.ts
Hardcoded “Memory Recall” section
Every agent gets identical memory instructions
Third-party memory plugins inherit misleading guidance
After PR #40126
registerMemoryPromptSection()
Plugin registers a builder callback
Builder generates context-specific prompt section
Each memory system speaks for itself

Let's talk about what just happened, because the PR description makes it sound boring and it is the opposite of boring. In a week where LangChain shipped another SDK wrapper and CrewAI announced a funding round, OpenClaw quietly did something more consequential than either.

Until this week, OpenClaw's memory system had one mode: the built-in one. The “Memory Recall” section of the system prompt — the instructions that tell the AI model how to use stored memories — was hardcoded in system-prompt.ts. If you built a third-party memory plugin with a completely different retrieval architecture, your plugin still got OpenClaw's default memory instructions injected into every conversation. Instructions that described a system your plugin didn't implement.

Contributor jarimustonen fixed this with PR #40126. The change introduces registerMemoryPromptSection() — a registry that lets memory plugins provide their own system prompt builder. The built-in memory-core plugin now registers the same instructions it always had, so existing users see zero change. But any third-party memory plugin can now replace that guidance entirely.

Why This Is a Bigger Deal Than It Sounds

Memory is the most consequential part of an AI agent's personality. It determines what the agent remembers about you, how it retrieves that information, and what it tells the model about itself. Handing control of the memory prompt to third-party developers isn't a minor API addition. It's ceding control of the agent's self-narrative.

Think about what a memory plugin can now do: rewrite the instructions that tell Claude or GPT-4 how to handle recollections. Change the retrieval strategy. Alter the formatting. Inject context about the user that the default system would never include. All of this flows through a single callback that fires every time the system prompt is assembled.

This is either the right architectural decision at the right time, or it's the beginning of a plugin trust problem that OpenClaw will spend the next year trying to contain. I suspect it's both.

The Security Review Was Surprisingly Good

Credit where it's due: the reviewers caught real things here. Three concerns were raised and all three were addressed before merge.

State reset on reload

Memory prompt builder now clears during plugin cache invalidation. Stale builders from previous plugin versions can't leak into new sessions.

Concurrent safety

Prompt state updates are staged before registry activation, preventing race conditions during plugin hot-reload.

Input mutation blocked

The availableTools set is cloned before delegation. A malicious plugin can't modify the tool registry by mutating the reference it receives.

This is the kind of review I wish every OpenClaw PR got. The tool cloning fix in particular shows someone thinking about adversarial plugin behavior, not just happy-path functionality. Thirty-nine checks passed. The test suite covers delegation, state reset, and no-builder edge cases.

The Uncomfortable Question

Here's what I keep coming back to: who builds the third-party memory plugins?

OpenClaw's plugin ecosystem is open. Anyone can publish a plugin. There's no review process, no signing, no capability restrictions beyond what the API surface exposes. A memory plugin that registers a prompt builder now has the ability to shape how the AI model perceives the user and the conversation history. That's a powerful position, and it's one that OpenClaw is handing out with no vetting beyond “does the code compile.”

I'm not saying the API shouldn't exist. It should. The hardcoded approach was clearly wrong — telling third-party memory systems to follow instructions for a different memory system is actively harmful. But the gap between “we made this pluggable” and “we made this safe to plug into” is where the interesting work lives. And that work hasn't started yet.

“Making something pluggable is an engineering decision. Deciding who gets to plug things in is a governance decision. OpenClaw made the first one this week. The second one isn't even on the roadmap.”

What This Enables

Setting aside the trust questions, the technical unlock here is real. Memory plugins can now:

  • Inject retrieval-augmented generation (RAG) instructions tailored to their specific vector store
  • Provide model-specific formatting — different prompt patterns for Claude vs. GPT-4 vs. Llama
  • Include dynamic context about memory freshness, confidence scores, or retrieval metadata
  • Omit the memory section entirely when no memories are relevant, saving tokens

The default behavior is preserved through memory-core's registration. If no plugin registers a builder, the memory section is omitted entirely — a cleaner default than injecting irrelevant instructions.

Full technical details are in PR #40126 on GitHub. For DeployClaw users, this change is already live.

About this coverage: DeployClaw News reports on OpenClaw development independently. DeployClaw is a managed hosting platform for OpenClaw and ships upstream changes automatically. The author holds no position in OpenClaw's governance.