Skip to main content

Description

search_memory finds relevant memories using hybrid retrieval — combining vector similarity and PostgreSQL full-text search, merged with Reciprocal Rank Fusion (RRF). Both semantic queries and exact-match lookups work well.

Parameters

ParameterTypeRequiredDefaultDescription
querystringYesNatural language description of what to find. Full sentences produce the best results.
limitnumberNo5Number of results to return (1-10). Use higher values for broad topics.
categorystringNoallFilter to a single category: preference, fact, decision, or context.
projectstringNoallFilter to a specific project. Omit to search all memories (recommended for most searches).
thresholdnumberNo0.6Maximum vector distance (0-1). Higher values return more results (broader search).

Threshold guide

ValueUse case
0.2 - 0.4Strict, high-precision matching
0.6Default — good balance of precision and recall
0.7 - 0.8Broad recall — returns more results, including loosely related ones

How search works

  1. Query variants are generated automatically to improve coverage
  2. Embeddings are created for the original query and all variants
  3. Vector search runs against all query forms
  4. PostgreSQL full-text search runs in parallel
  5. Results are merged with Reciprocal Rank Fusion (RRF)

Response

{
  "found": 2,
  "memories": [
    {
      "id": "a1b2c3d4-...",
      "content": "User prefers TypeScript over JavaScript",
      "category": "preference",
      "project": null,
      "relevance": 0.92,
      "createdAt": "2026-04-11T12:00:00.000Z"
    }
  ]
}
Each result includes a relevance score from 0 (least relevant) to 1 (most relevant).

Example

search_memory({
  query: "What package manager does the user prefer?"
})

Query guidelines

  • Good: "What package manager does the user prefer?" (full sentence, clear intent)
  • Bad: "package manager" (keywords alone reduce match quality)