Skip to main content

Overview

brv swarm query searches all active memory providers simultaneously and returns results ranked by Reciprocal Rank Fusion (RRF). No LLM is involved — this is pure algorithmic search that typically completes in under 500ms.
Output:
Each result shows:
  • Provider label — which source the result came from
  • Path/ID — the document or page identifier
  • Score — RRF-fused relevance score
  • Match typekeyword (BM25) or semantic (vector)
  • Content preview — first portion of the matching content

Flags

Query Classification

Before searching, the query is automatically classified to determine which providers are relevant:
Use --explain to see the classification:
Output:
The explain output shows:
  • Which query type was detected
  • Which providers were selected (and why any were excluded)
  • Enrichment chains that were executed
  • How many results survived RRF fusion and precision filtering

JSON Output

For programmatic use or piping to other tools:

How Ranking Works

RRF Fusion

Results from each provider are ranked by position, not raw score. This solves the problem of incomparable score scales across providers (BM25 vs cosine similarity vs ts_rank):

Precision Filtering

After RRF fusion, two filters remove noise:
  1. Score floor (min_rrf_score: 0.005) — drops results below the minimum threshold
  2. Gap ratio (rrf_gap_ratio: 0.5) — drops results scoring below 50% of the top result
These defaults are tuned for balanced precision/recall. Adjust in .brv/swarm/config.yaml under routing.

Result Caching

Identical queries within a 10-second window return cached results (LRU cache, max 20 entries). This is transparent — cached responses have the same format as fresh ones. Cache is invalidated on any write operation.

Swarm Query vs Context Tree Query

Use brv swarm query when you want raw search results across multiple sources. Use brv query when you want a synthesized answer from the context tree.

Examples

Search with limited results:
Search with full explain output:
Pipe JSON results to jq: