Ingestion pipeline
When content arrives, it goes through:- Deduplication — a content hash prevents duplicate articles; re-syncs upsert instead of piling up
- Metadata extraction — people, companies, topics, decisions, action items.
When your AI agent supplies these directly on
bestmate ingest, this step is skipped: the agent already did the reading - Chunking — the article is broken into retrievable chunks
- Embedding — each chunk gets a vector for semantic search
- Store routing — the item lands in a context store, either by an explicit
--storeor by a routing rule; unmatched content goes to the suggested pile
Sources
Structure
A twin is the umbrella. Context stores are the compartments under it. Questions route to the relevant stores rather than scanning everything, which is what keeps retrieval sharp as the corpus grows. Visibility is set on stores and twins —private, team, tenant, or
public — not per-article at ingest time.
Context stores
Creating, merging, and auto-routing into stores.
Retrieval
A query is embedded and matched against chunk embeddings, blending vector similarity with lexical matching. Candidates are then re-scored with boosts and penalties before the top results become the answer’s context:
The generated answer then passes a verifier that checks it’s actually
grounded in what was retrieved, which is where the confidence score comes from.
The tuning constants live at the top of
services/rag-v2.ts. They move as
retrieval is benchmarked, so treat the table above as the shape of the system
rather than fixed values.