Skip to main content
The search command runs BM25 full-text search over the titles and bodies of all indexed notes and returns a ranked list of results. BM25 scoring accounts for term frequency, inverse document frequency, and document length, so results are ordered by relevance rather than recency or alphabetical position.

Synopsis

Arguments and flags

string
required
The search query. Multi-word queries should be quoted in your shell. Terms are matched against note titles and body text.
string
Restrict results to vault-relative paths beginning with this prefix. Use --path Notes/ to search curated notes without mixing in Journal/, Inbox/, or other source material. The same filter applies to both sides of hybrid search.
string
Restrict results to notes whose frontmatter type field exactly matches this value. For example, --type blog returns only notes with type: blog in their frontmatter. Case-sensitive. Use smolbren types to discover what type values exist in your vault.
integer
default:"10"
Maximum number of results to return, ordered by descending BM25 score. Must be a positive integer. Increasing this value does not affect search quality, only how many results are returned.
boolean
Fuse BM25 with vector similarity search using Reciprocal Rank Fusion. Requires embeddings — run smolbren embed first (exit code 6 otherwise). See Hybrid search below.

Output

Returns a JSON array of result objects, sorted by descending score. An empty array is returned when no notes match.

Examples

Basic search across all note types
Filter by note type
Restrict search to curated notes
search --hybrid runs the query through both backends — BM25 keyword matching and vector similarity over embedded chunks (see similar) — and fuses the two rankings with Reciprocal Rank Fusion (k=60): each note scores Σ 1/(60 + rank) across the lists it appears in, so notes ranked well by both backends rise to the top. This is the strongest default for agent retrieval: BM25 contributes keyword precision, embeddings contribute semantic recall. The output shape is a superset of plain search:
The vault must be indexed before running search. If the index is missing, smolbren exits with code 5 and prints {"error":"index missing for vault '...' — run smolbren index first","code":"index_missing"} to stderr. Run smolbren index once after registering a vault, and again whenever your notes change. --hybrid additionally requires smolbren embed (exit code 6 when embeddings are missing).