Skip to main content

Query Intelligence

When you query the context tree (via /query or brv query), ByteRover uses a 5-tier strategy that routes each query to the fastest path capable of producing a high-quality answer.
TierNameSpeedHow It Works
0Exact cache~0msMatches a previously seen query by MD5 fingerprint. Cached results expire after 60 seconds.
1Fuzzy cache~50msFinds a cached query with ≥60% token similarity (Jaccard). Returns the cached result if the context tree hasn’t changed.
2BM25 direct~100–200msRuns a BM25 full-text search. If the top result scores ≥0.85 with a clear gap over the runner-up, returns it directly — no LLM needed.
3LLM pre-fetch<5sPre-fetches the top BM25 results and injects them as context for the LLM, which synthesizes a focused answer.
4Agentic loop8–15sFull multi-step reasoning: the agent reads files, follows relations, and iteratively gathers context before answering.
Tiers 0–2 bypass the LLM entirely for speed. Tier 3 uses a single LLM call with pre-fetched context. Tier 4 gives the agent full tool access for complex, multi-hop questions.

Out-of-Domain Detection

When the top search result scores below the relevance threshold, or significant query terms have no matches in the index, ByteRover recognizes the topic is outside the context tree. Instead of returning a low-quality guess, it tells you the topic isn’t covered and suggests curating relevant knowledge first.

Compound Scoring

Search results are ranked using a compound score that balances three signals, boosted by the file’s maturity tier:
score = (0.6 × BM25 + 0.25 × importance + 0.15 × recency) × tierBoost
ComponentWeightRangeDescription
BM25 relevance60%0–1Full-text relevance, normalized via score / (1 + score)
Importance25%0–100Accumulated value from search hits (+3) and curation updates (+5)
Recency15%0–1Exponential decay since last update (e^(-days/30))
Tier boosts amplify the score for mature knowledge:
MaturityBoost
core×1.15
validated×1.08
draft×1.0
This means a core knowledge file with moderate BM25 relevance can outrank a draft file with slightly higher text relevance — surfacing the most trusted knowledge first.

Path-Scoped Queries

Beyond plain full-text queries, ByteRover automatically detects path-like patterns in your query and uses them to scope the search. Slash-separated paths — When your query contains /, ByteRover splits it into a path prefix (used as scope) and remaining text (used as the search query):
auth/jwt refresh token rotation
This searches for “refresh token rotation” scoped to the auth/jwt domain/topic — ignoring other areas of the tree. Domain-name prefix — If the first word of your query matches a known domain name, it’s automatically used as scope even without /:
authentication refresh token rotation
Searches for “refresh token rotation” scoped to the authentication domain.