๐Ÿง 
Stage 2 ยท Lesson 3 of 4

Built-in Memory Search

Semantic search finds by meaning. Exact search finds by name. Both are essential.

~15 min read6 walkthrough steps

Structured folders solve the organization problem, but as your memory grows, you need a way to find things without knowing exactly where they are. OpenClaw has two built-in memory tools: memory_search and memory_get. Understanding when to use each is key to effective recall.

memory_search is semantic search. It finds information by meaning, not by exact words. Ask your agent "what was the database decision we made last week?" and memory_search looks through your memory files for content that's about database decisions โ€” even if the words "database decision" never appear literally. It uses embeddings (vector representations of text) to match concepts, not strings. This is powerful for natural language recall.

memory_get is exact retrieval. When you know the specific file you want โ€” "get memory/projects/client-portal.md" โ€” this tool fetches it directly. Fast, precise, no ambiguity. This is what you use when you know where the information lives and just need to load it.

In practice, you use both. Your agent reads preference files at session start with memory_get (you know exactly which files to load). During the conversation, when it needs to recall something specific, it uses memory_search to find the relevant context across all memory files. The combination of proactive loading (get) and reactive search (search) gives your agent comprehensive recall.

The pattern that works best: add to your agents.md that the agent should always read the preferences folder at session start, and use memory_search whenever it encounters a question about previous work, decisions, or context it might have stored. This creates an agent that both remembers your defaults and can look up specifics on demand.

Walkthrough

  1. 1
    Verify memory tools are enabled in your openclaw.json
  2. 2
    Add several memory files with different content โ€” at least 3 files across different folders
  3. 3
    Test memory_search: ask your agent 'What do you know about my tech stack?' โ€” it should find the preferences file
  4. 4
    Test memory_get: ask your agent to 'Read the file memory/projects/[your-project].md'
  5. 5
    Test a cross-file search: store related information across two different files and ask a question that requires finding both
  6. 6
    Update your agents.md: 'At session start, use memory_get to load memory/preferences/. When I reference past work, use memory_search to find relevant context.'

Checkpoint

You can use both memory_search (semantic) and memory_get (exact) effectively. Your agents.md includes instructions for when to use each. Your agent successfully recalls information from previous sessions.