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.
| Tier | Name | Speed | How It Works |
|---|---|---|---|
| 0 | Exact cache | ~0ms | Matches a previously seen query by MD5 fingerprint. Cached results expire after 60 seconds. |
| 1 | Fuzzy cache | ~50ms | Finds a cached query with ≥60% token similarity (Jaccard). Returns the cached result if the context tree hasn’t changed. |
| 2 | BM25 direct | ~100–200ms | Runs 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. |
| 3 | LLM pre-fetch | <5s | Pre-fetches the top BM25 results and injects them as context for the LLM, which synthesizes a focused answer. |
| 4 | Agentic loop | 8–15s | Full multi-step reasoning: the agent reads files, follows relations, and iteratively gathers context before answering. |
Structural Context Injection
For Tier 3 and 4 queries, ByteRover also injects structural context from the manifest (_manifest.json) alongside the BM25 search results. The manifest organizes all context tree entries into three lanes with token budgets:
| Lane | Contents | Ordered By |
|---|---|---|
| Summaries | _index.md files | Condensation order (broadest first) |
| Contexts | Knowledge files | Importance score (highest first) |
| Stubs | _archived/*.stub.md ghost cues | — |
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:| Component | Weight | Range | Description |
|---|---|---|---|
| BM25 relevance | 60% | 0–1 | Full-text relevance, normalized via score / (1 + score) |
| Importance | 25% | 0–100 | Accumulated value from search hits (+3) and curation updates (+5) |
| Recency | 15% | 0–1 | Exponential decay since last update (e^(-days/30)) |
| Maturity | Boost |
|---|---|
| core | ×1.15 |
| validated | ×1.08 |
| draft | ×1.0 |
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 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 domain.
Archived Knowledge in Search Results
Archive stubs (_archived/*.stub.md) are included in the BM25 index alongside regular knowledge files. When a stub appears in search results, it indicates that the full content exists but has been archived due to low importance.
Each stub carries enough context (a ~220-token ghost cue) for the query agent to evaluate relevance. Stubs are excluded from push/pull sync — they are local-only derived artifacts.