Skip to main content
Hybrid search is the default way to retrieve memories from MemContext. You ask a normal question, and MemContext returns the most relevant saved memories. The goal is simple: your AI should get the context it needs without your app having to know whether the user used the exact same words when the memory was saved. It works well for:
  • Natural-language questions
  • Exact names, tools, acronyms, and project terms
  • User preferences
  • Decisions and facts
  • Broader context gathering before generation
You do not need to choose or configure a retrieval algorithm. Start with clear queries and add filters only when your app needs them.

Why Hybrid Search Helps

AI memory has two common retrieval problems:
  • Exact text search can miss useful memories when the wording is different.
  • Semantic search can miss exact names, acronyms, product names, or short facts.
Hybrid search combines both signals. That means a query like “What package manager should I use?” can match “User prefers pnpm for JavaScript projects”, while a query like “R2 upload” can still match exact technical terms. For Context Vault document retrieval, MemContext also uses a re-ranking model on the strongest candidate passages before returning results. This improves result order when several chunks are related but only one contains the best answer.
curl "https://api.memcontext.in/api/memories/search?query=What%20package%20manager%20does%20the%20user%20prefer%3F" \
  -H "X-API-Key: mc_your_key"
{
  "found": 1,
  "memories": [
    {
      "id": "a1b2c3d4-...",
      "content": "User prefers pnpm for JavaScript projects.",
      "category": "preference",
      "relevance": 0.92,
      "createdAt": "2026-04-11T12:00:00.000Z"
    }
  ]
}

Search A Specific User Or Tenant

Use scope when one API key serves multiple users, organizations, or tenants. Use the same scope value when saving and searching.
curl "https://api.memcontext.in/api/memories/search?query=What%20billing%20context%20do%20we%20know%3F&scope=user_123" \
  -H "X-API-Key: mc_your_key"
Use project to narrow results inside a scope:
curl "https://api.memcontext.in/api/memories/search?query=What%20package%20manager%20does%20this%20project%20use%3F&scope=user_123&project=memcontext" \
  -H "X-API-Key: mc_your_key"

Query Guidelines

  • Ask full questions instead of short keyword fragments.
  • Include names, tools, dates, or projects when they matter.
  • Use category to narrow results to preference, fact, decision, or context.
  • Increase limit when your AI layer needs more context.
Good:
What package manager does this project use?
Less effective:
package manager

Precision Controls

Most integrations should use the default settings. If you need more control, use threshold.
ThresholdBehaviorUse case
0.2 - 0.4Broader resultsGathering more context before generation
0.6Default balanceMost app and assistant retrieval
0.7 - 0.8Stricter resultsExact or high-confidence lookups
Start with the default and tune only after testing real user queries.

What It Can And Cannot Do

Hybrid search can:
  • Find memories by meaning, even when the words differ.
  • Find exact terms like company names, project names, tools, and acronyms.
  • Improve over time when users submit feedback.
  • Return a ranked set of memories that your app can pass to an LLM.
Hybrid search cannot:
  • Answer a question from information that was never saved.
  • Replace tenant isolation. Use scope or a workspace for isolation.
  • Guarantee a final natural-language answer. It returns context so your app or AI layer can answer with the right evidence.