Skip to content

Search Memory

Retrieve memories using the Adaptive Retrieval Engine.

Unlike standard vector search which applies a single logic to all queries, Search Memory utilizes an Intent-Based Routing architecture.
Incoming queries are analyzed to detect specific signals (Temporal, Entity-based, or Semantic) and are routed to the execution strategy that yields the highest relevance.

Retrieval Architecture showing Intent Detection Layer and Strategy Selection

1. Default Behavior (Automatic Intent Detection)

Section titled “1. Default Behavior (Automatic Intent Detection)”

Recommended for 90% of use cases.
When the strategy parameter is omitted in the API request, the system activates the Intent Detection Layer.

Instead of forcing a single path, the system evaluates the query against multiple models to orchestrate the retrieval:

  • Route Selection: Determines if the query requires Entity Anchors (graph traversal), Temporal Filtering (date ranges), or Vector Search.
  • Parallel Execution: May execute multiple strategies simultaneously for complex queries (e.g., “Emails from Matteo [Entity] last week [Temporal]”).
  • Result Fusion: The outputs are aggregated in the Fusion Layer, where deduplication occurs and scores are normalized based on the active strategies.

Advanced users can bypass Intent Detection and force a specific execution path using the strategy parameter.

  • Architectural Role: Corresponds to the Semantic Strategy.
  • Behavior: Activates Centroid Analysis. The system measures the distance between the query and the user’s semantic centroid to automatically decide between:
    • META Mode: Broad, exploratory search (High-k).
    • SPECIFIC Mode: Narrow, precision search (Low-k).
  • Best for: Abstract concepts, themes, or when you specifically want to leverage the user’s interest profile.
  • Architectural Role: Corresponds to the Entity-Based Strategy.
  • Behavior: Traverses the Virtual Knowledge Graph. It locks onto specific nodes (People, Places, Organizations) and retrieves connected memories regardless of semantic vector similarity.
  • Best for: Queries focused on specific subjects where “hallucination” or fuzzy matching is unacceptable.
  • Architectural Role: Corresponds to the Temporal Strategy.
  • Behavior: Converts the query into deterministic date-range filters. It leverages the Shift-Left timestamps (resolved at ingestion) to perform strict chronological filtering, bypassing semantic similarity.
  • Best for: Queries strictly bound by time (e.g., “History from last Q3”, “Updates from yesterday”) where chronological precision is the primary intent.
  • Architectural Role: Corresponds to the Direct Match Strategy.
  • Behavior: Executes an O(1) lookup bypassing the embedding engine.
  • Best for: Retrieving by known IDs or exact codes.

Execute a search query against the memory cluster.

FieldTypeStatusDescription
queryStringREQUIREDThe natural language query.
useDynamicScoringBooleanOPTIONALDefault: true. Enables the Fusion Layer’s re-ranking logic based on recency and authority.
strategyStringOPTIONALLeave empty for Automatic Intent Detection.
Use only to force a path: direct_lookup, centroid_aware, entity_anchor, temporal_range.
options.limitNumberOPTIONALDefault: 5. Max memories to return.
Terminal window
curl -X POST "https://api.memorymodel.dev/v1/search" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "x-end-user-id: user_123" \
-d '{
"query": "What is the new deadline?",
"useDynamicScoring": true,
"options": {
"limit": 3
}
}'

The response includes the finalScore (0.0 to 1.0) and searchedWithNode metadata, providing explainability on which graph node anchored the search.

{
"data": [
{
"id": "mem_abc123",
"finalScore": 0.92,
"payload": {
"memory_type": "movie_preference",
"content": "I love sci-fi movies like Blade Runner.",
"movie_genre": "sci-fi",
"sentiment": "positive",
"mentioned_titles": ["Blade Runner"],
"user_id": "user_123",
"created_at": 1700000000000
},
"searchedWithNode": "node_preferences_01"
}
]
}

Execute a visual similarity search using an image. The system extracts visual and semantic embeddings from the provided image and retrieves visually or contextually related memories.

FieldTypeStatusDescription
queryImageStringREQUIREDBase64-encoded image string to use as the search query.
options.limitNumberOPTIONALDefault: 5. Max memories to return.
Terminal window
curl -X POST "https://api.memorymodel.dev/v1/search" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "x-end-user-id: user_123" \
-d '{
"queryImage": "iVBORw0KGgoAAAANSUhEUgAAAAE...",
"options": {
"limit": 3
}
}'