๐Ÿง 
Stage 2 ยท Lesson 4 of 4

The Anthropic Embedding Trap

CRITICAL: memory_search silently fails without a separate embedding key. Here's the fix.

~15 min read8 walkthrough steps

This lesson exists because of a trap that has silently broken memory for countless OpenClaw users. It's not documented well, it produces no error message, and it makes your agent appear to have memory while actually having none. If you use Anthropic's Claude as your AI provider, pay close attention.

memory_search uses embeddings. Embeddings are vector representations of text โ€” numerical arrays that capture meaning. They're what allow semantic search to find "database migration" when you search for "schema changes." Here's the problem: Anthropic does not provide an embedding model. Claude can generate text, but it cannot generate embeddings.

When you configure OpenClaw with Anthropic as your provider and try to use memory_search, one of two things happens. Either it silently fails โ€” returning no results even when the information exists in your memory files โ€” or it falls back to basic keyword matching that misses anything not phrased exactly right. There is no error message. No warning. Your agent just... doesn't find things. And you blame your memory organization instead of the actual problem.

The fix is simple: add a separate embedding provider. OpenClaw's config supports a secondary API key specifically for embeddings. You need a key from a provider that offers embedding models โ€” OpenAI (text-embedding-3-small), Google (Gemini embedding), or Voyage AI. Add this key to your config under the embeddings section, and memory_search suddenly works as intended.

This is the single most common "why isn't my memory working?" issue in the OpenClaw community. The cost is negligible โ€” embedding API calls are cheap (fractions of a cent per search). But without this key, your semantic memory is silently broken. Check your config right now.

Walkthrough

  1. 1
    Check your openclaw.json โ€” is there an embeddings configuration section?
  2. 2
    If using Anthropic as your main provider, verify you have a SEPARATE embedding key configured
  3. 3
    Get an embedding API key from OpenAI (recommended: text-embedding-3-small) or Google Gemini
  4. 4
    Add the embedding configuration to your openclaw.json: set the embedding provider and key
  5. 5
    Test BEFORE the fix: try memory_search for something you know exists โ€” note the results (or lack thereof)
  6. 6
    Apply the fix: add the embedding key and restart OpenClaw
  7. 7
    Test AFTER the fix: run the same search โ€” results should now appear correctly
  8. 8
    Verify semantic matching works: search for a concept using different words than what's stored

Checkpoint

You have a working embedding provider configured separately from your main AI provider. memory_search returns accurate semantic results. You can find stored information using natural language that doesn't match the exact words in the file.