Learn the basics
Associative Retrieval
Use MuBit routed retrieval and context assembly to produce grounded, scoped answers and reusable prompt context.
Associative retrieval in MuBit is not just vector similarity. It is the control-plane contract that combines scoped memory selection, evidence ranking, and answer or context synthesis.
For most applications, the primary retrieval surfaces are:
recall()for answer-oriented retrievalgetContext()/get_context()for prompt-ready context assembly- raw
control.querywhen you need wire-level control
Mental model
- Default to the routed retrieval path.
- Keep
run_id/session_idstable. - Use
entry_typeswhen you need only facts, lessons, or rules. - Use explicit context budgeting when the downstream model window matters.
Minimal helper-first example
query_payload.json
{
"run_id": "support-thread-42",
"query": "What customer preferences are already known?",
"mode": "agent_routed",
"limit": 5,
"entry_types": ["fact", "lesson", "rule"]
}ℹ️Note
The query/recall response includes a citations array — 0-based indices into evidence marking which items grounded final_answer (empty when the answer cites no specific evidence, such as an abstention). It is a response field, not a request parameter, and is validated server-side so every index is a valid position in evidence. Use it to render citations or audit answer grounding.
Failure modes and troubleshooting
| Symptom | Root cause | Fix |
|---|---|---|
| Sparse evidence | Scope mismatch or weak memory writes | Keep one stable run scope and tag memory intentionally |
| Context is too wide | No token budget or type restriction | Use getContext() budgeting and entry_types |
| Retrieval still looks weak | Memory quality degraded | Use diagnose() and memoryHealth() / memory_health() |
Next steps
- Compare retrieval styles at Associative retrieval vs RAG.
- Implement retrieval patterns at Retrieve data.