What is a Context Tree?
A context tree is your project’s hierarchically organized knowledge base stored in.brv/context-tree/. It captures patterns, best practices, and learnings in a structured format that’s both human-readable and intelligently searchable.
Structure
The context tree organizes knowledge into a three-level hierarchy. ByteRover also automatically maintains several system-generated files alongside your curated content — described in detail in the sections below.1. Domains
Top-level folders that group related knowledge areas. ByteRover automatically detects and creates domains on-demand as you curate, letting your context tree structure emerge naturally from your project.2. Topics
Specific subjects within each domain:3. Subtopics (Optional)
Deeper organization within topics (maximum one level):Auto-Generated Overview Files
ByteRover creates acontext.md file at each hierarchy level when you first curate into a domain, topic, or subtopic. These overviews document the scope and purpose of each node, making the tree self-describing and easier to navigate.
Domain-level context.md — describes what the domain covers and its boundaries:
context.md — summarizes the topic’s focus and connections:
context.md — narrows focus within a parent topic:
Hierarchical Summaries (_index.md)
After each curation, ByteRover automatically generates an _index.md file inside every directory that received new or updated content. The summary propagates upward through the hierarchy — a change to a subtopic file triggers regeneration at the subtopic, topic, domain, and root levels.
Each _index.md contains a system-generated condensed summary of the directory’s knowledge with YAML frontmatter:
condensation_order indicates depth relative to the context tree root:
| Level | condensation_order | Description |
|---|---|---|
| Root | 3 (d3) | Broadest — covers all domains |
| Domain | 2 (d2) | Covers all topics in a domain |
| Topic | 1 (d1) | Covers all knowledge in a topic |
| Subtopic | 0 (d0) | Narrowest — covers a single subtopic |
_index.md files are not synced with push/pull — they are regenerated locally after each curate. They are also excluded from BM25 search indexing, but injected as structural context when ByteRover uses an LLM to answer a query (Tier 3/4).
Manifest (_manifest.json)
ByteRover maintains a _manifest.json at the root of the context tree. It provides a token-budgeted registry of all context entries, organized into three lanes:
| Lane | Contents | Ordered By |
|---|---|---|
summaries | All _index.md files | Condensation order (broadest first) |
contexts | All regular .md knowledge files | Importance score (highest first) |
stubs | All _archived/*.stub.md ghost cues | Insertion order |
Archive System
Knowledge files that fall below an importance threshold are eligible for archiving. A file qualifies when it meets both criteria:- Maturity:
draft(has not yet been promoted tovalidatedorcore) - Decayed importance: below 35 after applying the recency decay function
_archived/, mirroring the original path:
Archive Stub (.stub.md)
A compact ghost cue (~220 tokens) that remains BM25 searchable. It contains a system-generated summary of the original content and frontmatter with lineage metadata:
Full Archive (.full.md)
A lossless copy of the original file. It is not searchable and not synced. Its sole purpose is to be readable on demand when you need the complete original content.
Full Structure Example
With all components in place, a mature context tree looks like this:Knowledge Files
Each topic (and subtopic) contains markdown knowledge files with descriptive names. These files use YAML frontmatter to store scoring metadata alongside the knowledge content. File format:Frontmatter Fields
| Field | Type | Description |
|---|---|---|
title | string | Knowledge file title |
tags | string[] | Tags for categorization |
keywords | string[] | Search keywords |
related | string[] | Paths to related topics (e.g., domain/topic/title.md) |
importance | number | 0–100 score reflecting how valuable this knowledge is |
recency | number | 0–1 score reflecting how recently this was updated |
maturity | string | Lifecycle tier: draft, validated, or core |
accessCount | number | Number of times this file was returned in search results |
updateCount | number | Number of curation updates |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 8601 last-update timestamp |
Content Sections
Knowledge files can contain up to three optional sections:- Raw Concept — Technical metadata: task description, relevant files, execution flow, patterns
- Narrative — Descriptive context: structure, dependencies, rules, examples, diagrams (Mermaid, PlantUML)
- Facts — Structured factual statements extracted during curation, each with an optional subject, value, and category (
personal,project,preference,convention,team,environment,other)
Scoring Metadata
Every knowledge file carries three scoring signals in its frontmatter. These signals determine how the file ranks in search results and where it sits in the maturity lifecycle. Importance (0–100) — Reflects how valuable this knowledge is. Starts at 50 for new files:- +3 each time the file appears in search results
- +5 each time the file is updated via curation
- Resets to 1.0 whenever the file is updated
- Halves roughly every 21 days (
e^(-days/30))
Maturity Lifecycle
Knowledge files progress through three maturity tiers based on their importance score. Promotion and demotion thresholds are offset (hysteresis) to prevent rapid oscillation when a score hovers near a boundary.| Tier | Search Boost | Description |
|---|---|---|
| draft | — | New or infrequently accessed knowledge |
| validated | +8% | Actively used and regularly updated |
| core | +15% | High-value, frequently accessed knowledge |
core file promoted at importance 85 won’t demote until it falls below 60.
draft files whose decayed importance falls below 35 become eligible for archiving — replaced by a searchable stub and a lossless full archive (see Archive System above).
Relations
Relations create explicit connections between topics using path notation in the frontmatterrelated field:
- Enable graph-like navigation between related knowledge
- Not based on similarity scores — these are explicit, intentional links
- Help find comprehensive context by following connections
- Prevent knowledge silos
Why This Matters
Human-readable and git-friendly:- Browse the context tree in your file explorer
- Edit markdown files with any text editor
- Track changes with git
- Review in pull requests
- Knowledge is categorized by domain and topic
- Self-documenting via auto-generated
context.mdat every level _index.mdsummaries give instant high-level overviews without reading individual files- Clear structure vs flat document storage
- Frequently used knowledge ranks higher in search
- Stale knowledge naturally fades without manual cleanup
- Core knowledge gets priority when results are tight
- Low-importance drafts are archived automatically, keeping the active tree lean
- ByteRover follows connections between topics
- More reliable than similarity-based search
- Intentional knowledge graph vs automatic clustering