Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Build with MuBit

Query patterns

Use routed retrieval, direct semantic search, and control filters for structured MuBit retrieval.

MuBit provides several retrieval patterns depending on your use case:

PatternWhen to use
control.query with mode: "agent_routed"Default retrieval path — routes through the control plane for answer-oriented results
control.query with entry_types, include_working_memory, agent_id, user_idScoped retrieval with fine-grained filters
control.contextModel-ready context block with token budgeting before an LLM call
client.core.search(...)Direct semantic search when you need raw core hits (policy-gated)

Routed retrieval example

answer = client.recall(
    session_id="claim-123",
    query="What changed in the claimant's story after the second interview?",
)

Structured control query example

result = client.query(
    run_id="claim-123",
    query="Show failure lessons from prior fraud reviews",
    entry_types=["lesson", "rule"],
    include_working_memory=False,
    mode="agent_routed",
)

Direct semantic search example

results = client.core.search(
    query_text="windshield replacement invoice",
    k=5,
    run_id="claim-123",
)

Guidance

  • Prefer control.query for app and agent retrieval.
  • Prefer control.context before an LLM step.
  • Use direct semantic search only for advanced compatibility cases where you need raw core hits.
  • Treat user_id as a logical sub-scope tag only. It narrows retrieval inside the authenticated actor boundary and never expands access.