Repository navigation
feat: optional semantic memory search for OpenClaw agents with a local embedding model - #879
Merged
Merged
Conversation
… model OpenClaw 2026.11.6 serves memory.search.provider "local" through its llama.cpp provider plugin, which is not bundled and, left to itself, downloads a llama-server build and the embedding model at run time. - The plugin (@openclaw/llama-cpp-provider 2026.11.6) joins the runtime lock as embeddingPlugin, verified and recorded in the receipt like a search plugin. The lock gains one record; nothing else moved. - The llama.cpp server (release b10809, the build the plugin names, one archive per platform) and the model (EmbeddingGemma 300M QAT Q8_0, 329 MB) are pinned in the manifest by URL, size and SHA-256. - embedding-assets.js installs both below <data>/assistants/embeddings: the server with every new runtime installation (never failing it), the model on demand, through a download that continues a partial file and lands only with the pinned digest. - On Linux the installer adds the OpenMP runtime the server build needs (libgomp1) as an optional library. - Host backups leave the embeddings folder out. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eddings Memory search matched words only. The owner can now switch on OpenClaw's vector search with a local model (EmbeddingGemma 300M through the llama.cpp provider plugin), for all agents of the shared Gateway at once. Keyword search stays the default: with the setting off the compiled openclaw.json is byte for byte the one from before. OpenClaw pauses an agent's whole memory search once the configuration names another embedding provider than its index was built with, and rebuilds an index only while the Gateway is stopped. So: - The compile names the plugin, an absolute model file and the installed server through a start wrapper, with fallback "none": the Gateway never downloads anything and nothing leaves loopback. - Every Gateway start reconciles before the spawn: a marker in the state tree says which search the indexes were built for; when it differs from what the start compiles, one offline `openclaw memory index --force` rebuilds every agent's index, and a rebuild for local embeddings is checked with `openclaw memory status --deep`. - Switching is therefore: prepare the assets, save, restart the Gateway like "Restart now". A failed or unverified rebuild, a runtime without the plugin (a rollback), a missing asset or an AgentPier restart in the middle switch the setting off with a reason and rebuild the keyword indexes, so memory search is never left paused. - The state (off, downloading, rebuilding, on, failed) is pushed over the live topic runtime.semantic-memory. - An embedding server a killed Gateway left behind is stopped by its pid. - Hermes reports the new capability semanticMemory as unavailable. A native contract runs it end to end on the pinned Gateway with the real plugin, server and model: a German note found by a query without a shared word, agent isolation, a deleted note leaving the index, the way back to keyword search, and the fallback after a failed and an interrupted rebuild. It runs in assistant-runtime.yml, with the model cached per pin, not in the merge queue's core contracts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Agents › Runtime gets the group "Semantic memory search". It states what the setting does and costs (a one-time download of the model's size, the same disk space, about 550 to 750 MB of memory while agents search), follows the live topic runtime.semantic-memory through every step (downloading with its bytes, rebuilding with the agents done, on, or off with the reason of a failure) and switches through a confirmation that says the agent service restarts, running agent work is interrupted and the model comes under Google's Gemma Terms of Use. Where it cannot run, the switch is locked with the reason. An OpenClaw agent's memory page says when its search works by meaning; a Hermes agent's page shows nothing and reads nothing (capability semanticMemory). The group is in the ⌘K search under its German and English names. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The owner's view in the agents guide, the design in the gateway guide (what OpenClaw 2026.11.6 does, what AgentPier pins and compiles, the reconcile at every Gateway start, failure and crash handling, measured cost on macOS and Linux, limits and what a release's Upgrade notes must say), the contract in the memory qualification, the lock addition in the release qualification, updates and rollbacks in the runtime update guide, the live topic in the architecture guide, the optional libgomp1 in the installation guides, the backup exclusion, the Hermes gap, an amendment to ADR 0002 and both READMEs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…runs Where the semantic memory contract runs, stated correctly (the message of ea33a2a37 left out that it is Linux only): - assistant-runtime.yml, native-contracts, on Linux runners only: pull requests that touch the assistant runtime (x64), and nightly, on demand and before a release through full.yml (x64 and arm64), in the one shard of four that the shard list assigns it to; - not in the merge queue: assistant-runtime-queue.yml names its core contracts itself and does not read scripts/assistant-contract-shards.json; - not on hosted macOS runners (the server computes on Metal there). The pinned llama.cpp server and embedding model are cached per pin, runner OS and architecture. On a cache miss scripts/assistant-embedding-assets.mjs fetches them from GitHub and Hugging Face. If that fails, a pull request that changes semantic memory search (or whose changes cannot be read) fails; every other run gets a warning annotation and runs its other contracts without this one, so it is never a silent pass for a change of the feature and never a blocked merge for anything else. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…wers With the indexes built, a local embedding provider that stops working does not pause the search: OpenClaw 2026.11.6 answers by keyword alone, and the setting kept reading "on". Of what that version offers, only a memory search's own result tells (details.provider "none" instead of "local"); memory.status and doctor.memory.status report the same either way. The state is now "degraded" with a reason code, pushed over the same live topic: - the installed server and model are looked at with every status read (stat and receipts, no hash); the model is hashed once per Gateway start, and changed bytes fall back to keyword search like a failed rebuild; - a memory search AgentPier issues reports its answer; - a check search (a query no note answers, per OpenClaw agent with memory) runs when the owner opens the Runtime tab, once per Gateway process, and at most every ten minutes after an agent's own memory_search ended. Nothing is timed. "Repair" (PUT with repair: true) installs the server anew, fetches the model if it is missing or changed, restarts the Gateway and rebuilds and verifies every index; a failure takes the existing fallback to keyword search. The native contract breaks the embeddings of a real Gateway, expects degraded, repairs and expects search by meaning again (run on macOS arm64 and Linux arm64). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An OpenClaw agent finds its notes by keyword only: a note about "Ferien an der Ostsee" is not found by asking for "Urlaub am Meer". OpenClaw can search by meaning with a local embedding model, but AgentPier compiled no embedding provider, and left alone OpenClaw's local provider downloads its server and model at run time (AGENTPIER-507).
Result
An optional, installation-wide owner setting under Agents › Runtime: semantic memory search with Google's EmbeddingGemma 300M running locally. Keyword search stays the default; with the setting off every compiled configuration is byte-identical to before. Nothing leaves the machine and no remote provider is offered. Hermes reports the new capability
semanticMemoryas unavailable and shows nothing.Provisioning
@openclaw/llama-cpp-provider) joins the runtime lock. The llama.cpp server (four platform archives) and the model (embeddinggemma-300m-qat-Q8_0.gguf, 329 MB) are pinned by digest inruntime-manifest.js.<data>/assistants/embeddings/. The dialog names the Gemma Terms of Use.fallback: "none".libgomp1.Switching
OpenClaw 2026.11.6 pauses
memory_searchafter any provider change until the index is rebuilt with the Gateway stopped. Every Gateway start therefore reconciles first: a marker records which search the indexes were built for, and on a mismatch or an unfinished rebuild one offline rebuild runs for all agents. Because a rebuild whose local provider cannot start still exits 0 with a keyword-only index, each local rebuild is verified withmemory status --deep. The owner is told that running agent work is interrupted.A failed download or rebuild, a missing asset, or an AgentPier restart in the middle switches the setting off with a reason and rebuilds the keyword indexes. The marker travels with update snapshots and backups.
States
Off, downloading, rebuilding, on, failed and degraded, over the new live topic
runtime.semantic-memory. Degraded means the setting is on but keyword search is answering: detected from a size check of the assets on each status read, a full hash of the model once per Gateway start, and from the provider a memory search reports (AgentPier's own searches, a check search when the owner opens the Runtime tab, and at most every ten minutes after an agent's own search). Repair reinstalls, re-downloads only what is missing or changed, restarts and rebuilds.Decisions and limits
Measured with two agents and three short notes: server memory 544 MB (macOS arm64, Metal) and 737 MB (Linux arm64, CPU), freed after ten idle minutes; switching on 15–20 s; first search about 3 s, later ones under 40 ms.
Validation
assistant-semantic-memory-contractagainst the real Gateway and the real model: a German query without shared words and an English query both find the German note, agents stay isolated, a deleted note is gone, switching off restores keyword search, and a stopped server and a corrupted model lead to degraded and back through Repair. Passes on macOS arm64 and in a Linux arm64 container. Linux x64 first runs in this pull request.npm run check: lint, format, structure and build pass; the only failures are three tests inmanaged-logins.test.jsthat come from the local shell environment.connections-long-list.spec.js:16,file-explorer-accessibility-fix.spec.js:82) that pass alone. The feature's spec passes 10 of 10 in English, including degraded and repair.Docs
Updated:
README.md,README.de.md,docs/agents.md,docs/assistant-gateway.md(section "Semantic memory search", including what a release's Upgrade notes must say),docs/assistant-memory-qualification.md,docs/assistant-release-qualification.md,docs/assistant-runtime-updates.md,docs/architecture.md(live topic),docs/installation.md,docs/linux.md,docs/backups.md,docs/hermes-runtime.md,docs/adr/0002-managed-openclaw-assistants.md,THIRD_PARTY_NOTICES.md. Checked without change:docs/ui-guide.md,docs/ui-glossary.md,GLOSSARY.md,docs/testing.md,docs/memory.md.Screenshots of all states were taken locally and are not attached here.
🤖 Generated with Claude Code