Pipeline stages
Search Strategies
Brain supports three search strategies, automatically selected based on query characteristics:RAG (Retrieval-Augmented Generation)
The default hybrid strategy. Combines BM25 keyword matching with vector cosine similarity using Reciprocal Rank Fusion (RRF).BM25 (Keyword Search)
Pure full-text search using PostgreSQL’stsvector and tsquery. Fast, deterministic, and great for exact term matching.
Vector (Semantic Search)
Pure vector similarity using Gemini embeddings and pgvector cosine distance. Finds semantically related content even when exact terms don’t match.Confidence Scoring
Every search result carries a confidence score between 0 and 1:| Level | Score Range | Meaning |
|---|---|---|
| High | 0.80 - 1.00 | Strong match — content directly answers the query |
| Medium | 0.50 - 0.79 | Relevant — related content, may need context |
| Low | 0.30 - 0.49 | Tangential — loosely related |
| Noise | 0.00 - 0.29 | Dropped by default |
- Search score — BM25/vector relevance
- Source type weight — decisions and domains score higher than raw notes
- Frontmatter confidence — documents can declare their own confidence level
- Provenance — derived content is capped below its source’s confidence
Filtering by Confidence
Strategy Segments
For advanced use cases, you can route specific query patterns to specific strategies. Segments are rules that override the default strategy based on query characteristics.Listing Segments
Search Options
The full set of options available when searching:| Option | Type | Default | Description |
|---|---|---|---|
brainId | string | required | Brain to search |
limit | number | 10 | Maximum results to return |
minConfidence | number | 0.3 | Drop results below this threshold |
strategy | string | auto | Force a specific strategy (rag, bm25, vector) |
explain | boolean | false | Include scoring breakdown in results |
modality | string | all | Filter by content modality (text, image, audio) |
Explain Mode
When debugging search quality, use explain mode to see the scoring breakdown:TypeScript API
Multimodal Search
Brain embeds text, images, and documents into the same vector space using Gemini’s multimodal embeddings. This means you can search for images with text queries and vice versa:text— markdown, plain textimage— PNG, JPG, SVG, WebPaudio— transcribed audio filespdf— extracted PDF text
Performance Tips
Keep your vault focused
Keep your vault focused
A brain with 500 high-quality documents outperforms one with 5,000 low-quality ones. Curate what goes in.
Use frontmatter confidence
Use frontmatter confidence
Mark authoritative documents with
confidence: high in frontmatter. This boosts their ranking in search results.Run brain health regularly
Run brain health regularly
brain health detects stale content, missing embeddings, and structural issues. Fix them before they degrade search quality.Use strategy segments for specialized queries
Use strategy segments for specialized queries
If you know certain query patterns work better with BM25 or vector search, set up segments to route them automatically.
Link boost
After RRF fusion and authority weighting, the pipeline runs a link-boost pass over the top-N results. For every hit, it uplifts any linked document’s score by +0.15, capped at +0.45 total per document. A weak BM25 match that’s linked to a strong vector match gets pulled into the result set — the way a human researcher follows citations. Link generation itself is covered in Knowledge graph operations. Dense linking is the single biggest driver of retrieval quality over time.What’s next
Closed-loop intelligence
How
brain auto-kb uses the retrieval pipeline to self-optimize.Knowledge graph
The graph operations that make retrieval smarter over time.