frankensearch searches by keyword and by meaning at once, on your own machine. It answers twice: a first ranking right away, then a better one from a stronger model a few milliseconds later. Use it as a Rust library, or point the fsfs command at a folder and search it from a terminal or a coding agent.
the selected files before cache lookup. The complete /// identity is part of the key, so equal names or dimensions cannot mix two /// models. Construction and qualification share the existing single
both
2
crates/frankensearch-fusion/src/refresh.rs:681
bootstrap replacement cannot mix vector spaces. BootstrapReplaceable, /// At least one tier is an attested FSVI v2 artifact, every gate (space /// join, SameProducer, quality republication capability
both
3
crates/frankensearch-index/src/two_tier.rs:3209
admission( &doc_id, fast_embedding, self.fast_dimension, &self.fast_ids, "fast", )?; if let Some(quality_embedding) = quality_embedding { validate_record_admission( &doc_id, quality_embedding, self
embedding row end overflows usize"); (start, end) } /// Form one embedding row only after calculating its bounds with checked arithmetic. [inline] fn model2vec_embedding_row(embeddings: &[f32], index
meaning
keywordmeaningboth↑2 promoted by refinementnew added by refinement
Real fsfs 1.13.0 output over 534 files of this repository, on an Apple M5 Ultra through fsfs’s warm query daemon. Times are when the calling process received each phase, and that clock moves in steps of about 11 ms. The replay runs 70× slower than real time.
For software that has to find things in local text: code, notes, chat logs, mail, agent memory. It is already the search engine inside six public tools.
Add the crate, index your own documents, and get each search back in two phases: the first ranking, then the refined one. The async API takes the caller’s context and stops cleanly on cancellation. It doesn’t need Tokio.
cargo add frankensearch --features hybrid
For coding agents
Agents find code by describing what it does. --compact output is about a third the size of full JSON, every hit carries a line number, and fsfs explain 1 shows why a result ranked where it did.
fsfs search "where do we retry failed uploads" --compact
On your own files
Index notes, docs and source once, then keep the index current with fsfs watch. An edited file is searchable from another shell within seconds.
fsfs index ~/notes && fsfs search "that idea about caching"
Pick the right tool
Tool
Good at
Where it stops
grep, ripgrep
Exact text and regular expressions, very fast
No notion that “retry” and “backoff” are related
ctags, an IDE index
Jumping to a known symbol
Doesn’t rank documents by relevance
frankensearch
Ranking by words and meaning, with a first answer at once
Heavier: about 621 MB of models and an index to keep
Keep rg for exact matches. Use fsfs when you know what you want but not what it’s called. The manual compares them.
01How a search runs
Fast first, better second.
Every search has two passes. The first merges what a keyword index and a small, quick embedding model found, and returns it. The second asks a larger model about the leaders and re-ranks them. If the second pass is slow or broken, you still have the first.
Before searching, frankensearch decides what kind of query it has. An identifier such as TwoTierSearcher or bd-123 doubles the keyword budget and halves the meaning budget; a question of four or more words does the reverse. The rules are plain string checks; no model is involved.
No spaces, and it mixes upper and lower case (camelCase or PascalCase).
Keyword candidates60
Meaning candidates15
The same rules as QueryClass::classify in frankensearch-core, run in your browser. The budgets assume a 10-result search and the default candidate multiplier of 3.
Step 2 · Merge two rankings
Merge by position.
A BM25 score of 15 and a cosine similarity of 0.83 can’t be compared. Reciprocal rank fusion ignores both numbers and uses positions: each list a document appears in adds 1 / (K + rank), with ranks counted from 1. Documents that both searches found rise to the top, and ties break the same way every time.
Documents found by both searches take the top three places.
The eight documents fsfs returned for “merge ranked lists from keyword search and vector search”, with their real positions in each list; gaps in a list belong to files that didn’t make the final eight. At K = 60, these merged scores equal fsfs’s own to six decimal places.
Step 3 · Refine the leaders
A second opinion on the top results.
The quality model (all-MiniLM-L6-v2, 384 dimensions) embeds the query and re-scores the leading candidates. Its score is blended 70/30 with the fast model’s, and the lists are merged again. Asked to “merge ranked lists from keyword search and vector search”, the first pass missed rrf.rs, the file that does exactly that. Refinement put it fourth.
Recorded with the replay above. A dot’s colour is the search that found the file: amber for keyword, cyan for meaning, lime for both. Lime lines are files the quality model promoted; a file marked new entered the ranking in the second pass.
When a stage fails
The first answer stays.
Each failure has a defined outcome and a typed reason. The first ranking is delivered before the expensive work starts, so a slow or missing model costs you the refinement and nothing else.
Two rankings. On all three BEIR sets the second scores higher than the first.
0.4 msInitial
Delivered as usual.
500 msRefinementFailed
error: SearchTimeout. The default quality_timeout_ms is 500.
The caller already holds the Initial results and is told why there is no second ranking.
0.4 msInitial
Delivered as usual.
·Skipped
skip_reason = "no_quality_embedder". fsfs doctor reports semantic.quality_generation as a warning.
Search works on the first tier until you install the model and re-index.
0.4 msInitial
Delivered as usual.
·Skipped
skip_reason = "fast_only", set with --fast-only or FRANKENSEARCH_FAST_ONLY=true.
The lowest latency, at the quality of the first pass.
·Initial
The vector tiers answer alone; the keyword source contributes nothing.
·Refined
Refinement proceeds on the vector candidates.
A broken keyword index lowers ranking quality, and the search still answers.
·Initial
In the library: keyword results only.
·Error
fsfs is stricter. Its hybrid modes require an admitted vector generation and the matching fast model, so it returns a typed error; keyword-only search has to be asked for.
No silent downgrade in the shipped CLI.
From the README’s failure table. Times are the library’s measured medians and the default deadline.
02Long files
Meaning from every part of a file.
Embedding models read about 2,000 characters at a time, so a vector made from the start of a file knows nothing about page twelve. fsfs embeds each file as overlapping windows, up to 128 of them, and ranks the file by its best window. It’s on by default.
Windows are 2,000 characters long and overlap by 200. Past the cap, fsfs keeps the first and last windows and spreads the rest evenly; the gaps are recorded, so the index never claims coverage it doesn’t have. The quality model still reads one 2,000-character prefix, so on a long file its share of the blend shrinks to match.
The plan is fsfs’s own plan_for_chars, ported line for line. Lengths count the file’s text after whitespace is collapsed: for traits.rs that is 90,873 characters, which gives the same quality weight, 0.015, as the recorded explanation in chapter 4.
Measured on code
Why hybrid is the default.
With one vector per file, made from its opening, hybrid search scored 0.35 on code against 0.59 for keyword search alone. With windows it scores 0.58, level with keyword search, and finds more of the relevant files. On BEIR’s abstract-length documents, windows move Refined by less than 0.002.
Compare hybrid search with and without windows.
Measured
Keyword only (BM25)0.590
Hybrid, prefix only · Initial0.310
Hybrid, prefix only · Refined0.349
Hybrid, 128 windows · Initial0.577
Hybrid, 128 windows · Refined0.581
00.350.70
What windows cost on that tree
89 → 106 MBindex size
23 → 28 scold build
21 → 26 mssearch, both phases
nDCG@10 on 253 judged code queries over a 579-file, 35 MB tree, measured by the code evaluation harness. The two windowed results sit inside the confidence interval of keyword search. Recall@100 is 0.93 with windows against 0.89 for keywords.
03Index integrity
It refuses to guess.
Vectors from two different models look alike and mean nothing together. A half-written index looks fine until a search reads the missing half. frankensearch records exactly which model produced every vector, publishes an index only as a complete set of files, and keeps repair data beside the vectors.
Each vector file records the full identity of the model that wrote it: name, revision, tokenizer, vocabulary, pooling, normalization, dimension and the input rules around it. A query vector is compared with the index only when every field matches. A model with the same dimension but different weights produces numbers that look valid and rank nonsense, so it is refused.
Point a different model at an index built with potion-multilingual-128M.
Worked example
The model that built the index.
Field
Index
Query model
Model ID
recorded
matches
Revision
recorded
matches
Tokenizer
recorded
matches
Vocabulary
recorded
matches
Pooling and normalization
recorded
matches
Dimension
recorded
matches
Input contract (adapter)
recorded
matches
Kind
recorded
matches
A dimension check aloneAccepts
frankensearchSearches
Every field matches, so the query vector and the index share one vector space.
Identical weights read through the adapter of an older release. fsfs 1.10.0 changed it, and old indexes needed a rebuild.
Field
Index
Query model
Model ID
recorded
matches
Revision
recorded
matches
Tokenizer
recorded
matches
Vocabulary
recorded
matches
Pooling and normalization
recorded
matches
Dimension
recorded
matches
Input contract (adapter)
recorded
differs
Kind
recorded
matches
A dimension check aloneAccepts
frankensearchRefuses
1 of 8 fields differ. The search returns a typed error and the index is left untouched; rebuild it with the new model to switch.
A smaller registered Model2Vec model with the same 256 dimensions.
Field
Index
Query model
Model ID
recorded
differs
Revision
recorded
differs
Tokenizer
recorded
differs
Vocabulary
recorded
differs
Pooling and normalization
recorded
matches
Dimension
recorded
matches
Input contract (adapter)
recorded
matches
Kind
recorded
matches
A dimension check aloneAccepts
frankensearchRefuses
4 of 8 fields differ. The search returns a typed error and the index is left untouched; rebuild it with the new model to switch.
Another registered fast model, with 512 dimensions.
Field
Index
Query model
Model ID
recorded
differs
Revision
recorded
differs
Tokenizer
recorded
differs
Vocabulary
recorded
differs
Pooling and normalization
recorded
matches
Dimension
recorded
differs
Input contract (adapter)
recorded
matches
Kind
recorded
matches
A dimension check aloneRejects
frankensearchRefuses
5 of 8 fields differ. The search returns a typed error and the index is left untouched; rebuild it with the new model to switch.
The FNV hashing control used in tests. It has no notion of meaning.
Field
Index
Query model
Model ID
recorded
differs
Revision
recorded
differs
Tokenizer
recorded
differs
Vocabulary
recorded
differs
Pooling and normalization
recorded
differs
Dimension
recorded
matches
Input contract (adapter)
recorded
differs
Kind
recorded
differs
A dimension check aloneAccepts
frankensearchRefuses
7 of 8 fields differ. The search returns a typed error and the index is left untouched; rebuild it with the new model to switch.
Field names follow EmbeddingSpaceIdentityV1 in frankensearch-core, which also fingerprints the artifact files and the query and document instructions. Its rule: equality is exact, and names, folder names and dimension-only matches never establish compatibility.
Complete generations
A whole index, or the last one.
An index is published as one sealed bundle: keyword segments, both vector tiers and the catalog. A pointer file switches to a new bundle only after it is complete, so a search running in another process during fsfs watch always sees one consistent generation, and a crash mid-build leaves the previous one in service.
fsfs writes keyword segments, both vector tiers and the catalog into a new generation, seals it, then points FSFS-CURRENT at it.
FSFS-CURRENT g1
g1current
keyword
fast
quality
catalog
search A
$ fsfs search "cache eviction"
The search pins g1 for every phase, including the snippets it reads. Nothing that happens next can change what it sees.
FSFS-CURRENT g1
g1current
keyword
fast
quality
catalog
search A
g2building
keyword
fast
quality
catalog
$ fsfs watch ~/notes
The watcher builds g2 beside g1, sharing the keyword segments that didn’t change. Readers can’t select an unsealed generation, so no one sees half of it.
FSFS-CURRENT g2
g1previous
keyword
fast
quality
catalog
search A
g2current
keyword
fast
quality
catalog
search B
g2 is sealed and FSFS-CURRENT switches to it in one step. New searches use g2; search A finishes on g1. The edit is searchable from another process within seconds.
FSFS-CURRENT g2
g1previous
keyword
fast
quality
catalog
g2current
keyword
fast
quality
catalog
g3unsealed
keyword
fast
quality
catalog
The machine loses power while g3 is being written. g3 was never sealed, so it was never selectable: searches carry on with g2.
FSFS-CURRENT g4
g2previous
keyword
fast
quality
catalog
g4current
keyword
fast
quality
catalog
The next publication keeps the current generation and its predecessor, the rollback target for fsfs search --previous. It removes older ones and abandoned builds, but never a generation that a live reader in any process still holds.
FSFS-CURRENT g4
g2previous
keyword
fast
quality
catalog
g4current
keyword
fast
quality
catalog
$ fsfs doctor
Both vector files carry RaptorQ repair sidecars (index.fsvi.fec, quality.fsvi.fec). fsfs doctor checks them and reports the damage.
FSFS-CURRENT g5
g4previous
keyword
fast
quality
catalog
g5current
keyword
fast
quality
catalog
$ fsfs compact
fsfs compact restores the drifted vectors from the sidecar before it merges. Keyword segments carry no sidecar because they rebuild from your files in seconds: a segment that fails its check on open is quarantined and its documents are indexed again.
1 / 8
Generation names are illustrative. Each step describes behaviour documented in the README’s “Complete generations” section, which is the default for new indexes on Linux and macOS.
04For agents
Output an agent can act on.
Coding agents call fsfs like any other command. They get stable JSON field names, a stream that delivers the first ranking before the second exists, a compact shape about a third the size, and an explain command that shows the arithmetic behind any result.
--format picks table, JSON, JSONL, TOON or CSV. --stream sends each phase the moment it is ready. --compact keeps only an id, the path, score, rank, snippet and line. Each payload carries a version number, so a parser can tell when the shape changes.
Recorded with fsfs search "refuse to mix vectors from two different embedding models" --limit 3. At ten hits, compact JSON is 3,223 bytes against 8,661 for full JSON. The JSONL stream shown here was a replay from the daemon’s cache, and says so in its second line.
Explanations
Every score, taken apart.
fsfs explain 1 reports how the last search scored a result: each query word’s BM25 contribution, both models’ similarity and weight, and the merge arithmetic. fsfs search --explain attaches the same evidence to every hit.
Recorded with fsfs explain 1 after a search for “refuse to mix vectors from two different embedding models”. The picture is drawn from the JSON form of the same explanation.
Errors
Failures that say what to do next.
Errors arrive in the same envelope as results, with a stable code, the setting at fault, an exit status and the next command to try. There is a tutorial for searching from Claude Code.
Read an error the way an agent does.
Recorded output
{
"v": 1,
"ts": "2026-12-04T21:47:44Z",
"ok": false,
"error": {
"code": "invalid_config",
"message": "Invalid config: cli.index_dir = \"./empty-store\" — no index found; run `fsfs` for guided setup or `fsfs index <dir>` first",
"field": "cli.index_dir",
"exit_code": 2,
"suggestion": "Check the command line.\nno index found; run `fsfs` for guided setup or `fsfs index <dir>` first\nRun: fsfs help"
},
"meta": {
"command": "search",
"format": "json"
}
}
codeinvalid_configA stable code to branch on.
fieldcli.index_dirThe setting at fault.
exit_code2The process exit status, for scripts.
suggestionCheck the command line.What to run next.
Recorded by searching a directory with no index in it, with --format json.
05Evidence
Measured, misses included.
Ranking quality is measured through the shipped fsfs binary on public BEIR datasets, with paired bootstrap confidence intervals. Latency comes from committed receipts that name the machine and the corpus. Experiments that lost are written down too: the negative-evidence log has more than 450 entries.
Refined beats keyword-only BM25 on all three datasets, significantly on each. The first pass alone is mixed: worse on SciFact, level on NFCorpus, better on ArguAna. That is what the second pass is for.
Keyword only (Quill BM25)Initial (BM25 + fast model)Refined (+ quality model)
nDCG@10 on held-out BEIR test queries through the release fsfs binary with default settings, 2026-09-22, measured by the BEIR evaluation harness. Higher is better.
Latency
Where the milliseconds go.
The first ranking is ready in 0.40 ms. The quality model’s 5 ms embedding is most of the rest. The README’s design budgets were 15 ms and 150 ms; the receipts beat both by a wide margin. A cold fsfs search with no daemon spends about 0.75 s loading models, which is why fsfs keeps a query daemon warm for ten idle minutes.
Embed the query, fast modelpotion-multilingual-128M, p95 0.17 ms
0.10 ms
Keyword search (Quill BM25)1,000 documents, p95 0.38 ms
0.23 ms
Vector search, fast tiertop 10 of 1,000; 0.29 ms on 10,000
0.07 ms
Merge with RRF1,000 + 1,000 candidates
0.023 ms
First ranking deliveredlibrary, warm; p95 0.58 ms, p99 2.4 ms
0.40 ms
Embed the query, quality modelall-MiniLM-L6-v2, p95 6.1 ms
5.1 ms
Refined ranking deliveredlibrary, both phases; p95 6.8 ms
5.5 ms
fsfs search through its daemonwhole command, both phases; p95 13.9 ms
12.7 ms
0.01 ms0.1110 ms
Medians from the committed receipts library-two-tier-latency-20260903 and fsfs-latency-20260903: release build, AMD Ryzen Threadripper PRO 5975WX, potion-multilingual-128M and all-MiniLM-L6-v2, 1,000 documents (659 KB), 50 timed queries. Log scale.
Keyword engine
Its own BM25, checked against Tantivy.
Keyword search runs on Quill, a BM25 engine written for frankensearch in Rust with #![forbid(unsafe_code)]. Tantivy stays in the repository as the reference: a differential harness, the Quill gauntlet, compares Quill’s results with a pinned Tantivy 0.26.2. Keyword segments are verified when opened, and one that fails is quarantined and rebuilt from your files.
The repository keeps a log of experiments that lost, with their numbers, so nobody runs them twice. Read NEGATIVE_EVIDENCE.md.
Reranking stays opt-in
The cross-encoder raised nDCG@10 on NFCorpus by 0.016, did nothing significant on SciFact and lowered ArguAna by 0.013. It also costs hundreds of milliseconds, so it is off by default.
ANN is not the default
HNSW against an exact parallel scan at 10,000 documents traded recall for latency without a clear win. Approximate search stays behind a feature flag for larger corpora.
Four accumulators, 49% slower
Unrolling the f16 dot product into four accumulators was neutral at 256 dimensions and 1.49× slower at 384. The single accumulator stays, with the measurement beside it.
A faster parser that ranked differently
A shortcut for plain queries was about 20× faster to set up but did not rank exactly like the reference parser. Reverted.
06Get started
Running in four commands.
Install fsfs, fetch and verify the two default models, index a folder, search it. Or add the crate to a Rust project and build the same engine into your own program.
About 621 MB, pinned and checked. Add --verify to check them again later.
3Index a folder
fsfs index ./my-project
A one-shot build. fsfs watch keeps it current instead.
4Search
fsfs search "how does retry backoff work" --limit 5
Add --format json, --stream or --compact for scripts and agents.
Check your platform.
Platform
fsfs 1.13.0 archive
Linux x86-64 (glibc 2.39+, Ubuntu 24.04 and later)
Full
macOS, Apple Silicon
Full
Linux x86-64 or ARM64 (musl)
Lite
macOS, Intel
Lite, or build with --native
Windows
No archive yet
Full archives include both search models’ loaders; lite archives search by keyword only and are installed only when asked for with --lite. Elsewhere, install.sh --native builds from source with a Rust nightly toolchain.
frankensearch, the Rust crate
The same engine, in your program.
The crate is frankensearch on crates.io. It runs on asupersync rather than Tokio: your program owns the runtime and passes a context that carries cancellation into every phase.
Embeddings plus the Quill keyword index. Start here.
persistent
Hybrid, plus durable metadata and an embedding queue
durable
Persistent, plus repair sidecars for the index files
full
Everything: reranking, ANN, model download and more
The default feature set is hash only: no downloads, for tests. The workspace builds with Rust nightly, edition 2024.
Index and search
use frankensearch::{EmbedderStack, IndexBuilder, TwoTierConfig, TwoTierIndex, TwoTierSearcher};
// Verified models from ./models; refuses to fall back to the hash control.
let stack = EmbedderStack::auto_detect_semantic_with(Some(Path::new("./models")))?;
IndexBuilder::new("./my_index")
.with_embedder_stack(stack.clone())
.add_document("doc-1", "Rust ownership and borrowing")
.add_document("doc-2", "Structured concurrency with asupersync")
.build(&cx)
.await?;
let index = Arc::new(TwoTierIndex::open(Path::new("./my_index"), TwoTierConfig::default())?);
let mut searcher = TwoTierSearcher::new(index, stack.fast_arc(), TwoTierConfig::default());
if let Some(quality) = stack.quality_arc() {
searcher = searcher.with_quality_embedder(quality);
}
let (results, metrics) = searcher.search_collect(&cx, "ownership rules", 10).await?;
Abridged from the README. An integration test runs the same path with the real models. cx is the asupersync capability context your program passes in.
Who uses it
Already inside six tools.
Public projects whose search runs on frankensearch. Improvements to the engine reach all of them.