memory_search
Retrieve the most relevant stored facts for a query from a namespace, combining vector and full-text search. Use it to recall prior context, preferences, or past decisions before answering.
Instructions
Retrieve the facts most relevant to a query from a namespace's memory.
Read-only with respect to memory content: it never modifies or deletes stored facts (searching a namespace that does not exist yet returns "No facts found.", though the empty store file is created as a side effect). Returns up to k facts as a bulleted list, deduplicated, most relevant first.
Use it before answering anything that may depend on prior context — preferences, past decisions, earlier sessions. Facts only exist here if something wrote them via memory_add; memory_clear deletes a whole namespace. With the [models] extra installed, the first call in a fresh environment downloads model weights (one-time); the call blocks until done.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Maximum number of facts to return (top-k after reranking). | |
| query | Yes | Natural-language search query; matched against stored facts by hybrid vector + full-text retrieval, then reranked. | |
| namespace | Yes | Isolation key for one memory store. Each namespace is a separate local SQLite file under LM_DATA_ROOT (default ~/.lean_memory); namespaces never see each other's facts. Use one per agent, project, or user whose memory must stay separate. Created on first access. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |