ByteRover Knowledge Management
Use the brv CLI to manage your project's long-term memory.
Install: npm install -g byterover-cli
Knowledge is stored in .brv/context-tree/ as human-readable Markdown files.
No authentication needed. brv query, brv curate, and brv vc (local version control) work out of the box. Login is only required for remote sync (brv vc push/brv vc pull).
Workflow
- 1. Before Thinking: Run
brv query to understand existing patterns. - After Implementing: Run
brv curate to save new patterns/decisions.
Commands
1. Query Knowledge
Overview: Retrieve relevant context from your project's knowledge base. Uses a configured LLM provider to synthesize answers from
.brv/context-tree/ content.
Use this skill when:
- - The user wants you to recall something
- Your context does not contain information you need
- You need to recall your capabilities or past actions
- Before performing any action, to check for relevant rules, criteria, or preferences
Do NOT use this skill when:
- - The information is already present in your current context
- The query is about general knowledge, not stored memory
CODEBLOCK0
2. Search Context Tree
Overview: Retrieve a ranked list of matching files from
.brv/context-tree/ via pure BM25 lookup. Unlike
brv query, this does NOT call an LLM — no synthesis, no token cost, no provider setup needed. Returns structured results with paths, scores, and excerpts.
Use this skill when:
- - You need file paths to read rather than a synthesized answer
- You want fast, cheap retrieval with no LLM overhead
- You're in an automated pipeline that consumes structured results
Do NOT use this skill when:
- - You need a natural-language answer synthesized from multiple files — use
brv query instead - The information is already present in your current context
CODEBLOCK1
Flags: --limit N (1-50, default 10), --scope "domain/" (path prefix filter), --format json (structured output for automation).
3. Curate Context
Overview: Analyze and save knowledge to the local knowledge base. Uses a configured LLM provider to categorize and structure the context you provide.
Use this skill when:
- - The user wants you to remember something
- The user intentionally curates memory or knowledge
- There are meaningful memories from user interactions that should be persisted
- There are important facts about what you do, what you know, or what decisions and actions you have taken
Do NOT use this skill when:
- - The information is already stored and unchanged
- The information is transient or only relevant to the current task, or just general knowledge
CODEBLOCK2
Include source files (max 5, project-scoped only):
CODEBLOCK3
View curate history: to check past curations
- - Show recent entries (last 10)
brv curate view
- - Full detail for a specific entry: all files and operations performed (logId is printed by
brv curate on completion, e.g. cur-1739700001000)
brv curate view cur-1739700001000
- - List entries with file operations visible (no logId needed)
brv curate view detail
- - Filter by time and status
brv curate view --since 1h --status completed
CODEBLOCK8
4. Review Pending Changes
Overview: After a curate operation, some changes may require human review before being applied. Use
brv review to list, approve, or reject pending operations.
Use this when:
- - A curate operation reports pending reviews (shown in curate output)
- The user wants to check, approve, or reject pending changes
Do NOT use this skill when:
- - There are no pending reviews (check with
brv review pending first)
Commands:
List all pending reviews for the current project:
CODEBLOCK9
Sample output:
CODEBLOCK10
Each pending task shows: operation type (ADD/UPDATE/DELETE/MERGE/UPSERT), file path, reason, and before/after summaries. High-impact operations are flagged.
Approve all operations for a task (applies the changes):
CODEBLOCK11
Reject all operations for a task (discards pending changes; restores backup for UPDATE/DELETE operations):
CODEBLOCK12
Approve or reject specific files within a task:
brv review approve <taskId> --file <path> --file <path>
brv review reject <taskId> --file <path>
File paths are relative to context tree (as shown in
brv review pending output).
Note: Always ask the user before approving or rejecting critical changes.
JSON output (useful for agent-driven workflows):
CODEBLOCK14
5. LLM Provider Setup
brv query and
brv curate require a configured LLM provider. Connect the default ByteRover provider (no API key needed):
CODEBLOCK15
To use a different provider (e.g., OpenAI, Anthropic, Google), list available options and connect with your own API key:
CODEBLOCK16
6. Project Locations
Overview: List registered projects and their context tree paths. Returns project metadata including initialization status and active state. Use
-f json for machine-readable output.
Use this when:
- - You need to find a project's context tree path
- You need to check which projects are registered
- You need to verify if a project is initialized
Do NOT use this when:
- - You already know the project path from your current context
- You need project content rather than metadata — use
brv query instead
CODEBLOCK17
JSON fields: projectPath, contextTreePath, isCurrent, isActive, isInitialized.
7. Version Control
Overview: brv vc provides git-based version control for your context tree. It uses standard git semantics — branching, committing, merging, history, and conflict resolution — all working locally with no authentication required. Remote sync with a team is optional. The legacy
brv push,
brv pull, and
brv space commands are deprecated — use
brv vc push,
brv vc pull, and
brv vc clone/
brv vc remote add instead.
Use this when:
- - The user wants to track, commit, or inspect changes to the knowledge base
- The user wants to branch, merge, or undo knowledge changes
- The user wants to sync knowledge with a team (push/pull)
- The user wants to connect to or clone a team space
- The user asks about knowledge history or diffs
Do NOT use this when:
- - The user wants to query or curate knowledge — use
brv query/brv curate instead - The user wants to review pending curate operations — use
brv review instead - Version control is not initialized and the user didn't ask to set it up
Commands:
Available commands: init, status, add, commit, reset, log, branch, checkout, merge, config, clone, remote, fetch, push, pull.
First-Time Setup
Setup — local (no auth needed):
CODEBLOCK18
Setup — clone a team space (requires brv login):
CODEBLOCK19
Setup — connect existing project to a remote (requires brv login):
CODEBLOCK20
Local Workflow
Check status:
CODEBLOCK21
Stage and commit:
CODEBLOCK22
View history:
CODEBLOCK23
Unstage or undo:
CODEBLOCK24
Branch Management
CODEBLOCK25
Merge:
CODEBLOCK26
Set upstream tracking:
CODEBLOCK27
Cloud Sync (Remote Operations)
Requires ByteRover authentication (brv login) and a configured remote.
Manage remotes:
CODEBLOCK28
Fetch, pull, and push:
CODEBLOCK29
Clone a space:
CODEBLOCK30
8. Swarm Query
Overview: Search across all active memory providers simultaneously — ByteRover context tree, Obsidian vault, Local Markdown folders, GBrain, and Memory Wiki. Results are fused via Reciprocal Rank Fusion (RRF) and ranked by provider weight and relevance. No LLM call — pure algorithmic search.
Use this skill when:
- - You need to search across multiple knowledge sources at once
- The user has configured multiple memory providers (check with
brv swarm status) - You want results from Obsidian notes, GBrain entities, or wiki pages alongside ByteRover context
Do NOT use this skill when:
- - The user only has ByteRover configured — use
brv query instead (it synthesizes via LLM) - You need an LLM-synthesized answer —
brv swarm query returns raw search results, not synthesized text
CODEBLOCK31
Output:
CODEBLOCK32
With explain mode (shows classification, provider selection, enrichment):
CODEBLOCK33
Output:
CODEBLOCK34
JSON output:
CODEBLOCK35
Output:
CODEBLOCK36
Limit results:
CODEBLOCK37
Flags: --explain (show routing details), --format json (structured output), -n <value> (max results).
9. Swarm Curate
Overview: Store knowledge in the best available external memory provider. ByteRover automatically classifies the content type and routes accordingly: entities (people, orgs) go to GBrain, notes (meeting notes, TODOs) go to Local Markdown, general content goes to the first writable provider. Falls back to ByteRover context tree if no external providers are available.
Use this skill when:
- - You want to store knowledge in an external provider (GBrain, Local Markdown, Memory Wiki)
- The user has configured writable swarm providers
Do NOT use this skill when:
- - You want to store in ByteRover's context tree specifically — use
brv curate instead - No swarm providers are configured — use
brv curate instead
CODEBLOCK38
Output:
CODEBLOCK39
Target a specific provider:
CODEBLOCK40
Output:
CODEBLOCK41
CODEBLOCK42
Output:
CODEBLOCK43
JSON output:
CODEBLOCK44
Output:
CODEBLOCK45
Flags: --provider <id> (target specific provider), --format json (structured output).
10. Swarm Status
Overview: Check provider health and write targets before running swarm query or curate. Use this to verify which providers are available and operational.
Use this skill when:
- - Before running
brv swarm query or brv swarm curate to check available providers - Diagnosing why swarm results are missing from a specific provider
CODEBLOCK46
Output:
CODEBLOCK47
Data Handling
Storage: All knowledge is stored as Markdown files in .brv/context-tree/ within the project directory. Files are human-readable and version-controllable.
File access: The -f flag on brv curate reads files from the current project directory only. Paths outside the project root are rejected. Maximum 5 files per command, text and document formats only.
LLM usage: brv query and brv curate send context to a configured LLM provider for processing. The LLM sees the query or curate text and any included file contents. No data is sent to ByteRover servers unless you explicitly run brv vc push.
Cloud sync: brv vc push and brv vc pull require authentication (brv login) and sync knowledge with ByteRover's cloud service via git. All other commands operate without ByteRover authentication.
Error Handling
User Action Required:
You MUST show this troubleshooting guide to users when errors occur.
"Not authenticated" | Run brv login --help for more details.
"No provider connected" | Run brv providers connect byterover (free, no key needed).
"Connection failed" / "Instance crashed" | User should kill brv process.
"Token has expired" / "Token is invalid" | Run brv login again to re-authenticate.
"Billing error" / "Rate limit exceeded" | User should check account credits or wait before retrying.
Agent-Fixable Errors:
You MUST handle these errors gracefully and retry the command after fixing.
"Missing required argument(s)." | Run brv <command> --help to see usage instructions.
"Maximum 5 files allowed" | Reduce to 5 or fewer -f flags per curate.
"File does not exist" | Verify path with ls, use relative paths from project root.
"File type not supported" | Only text, image, PDF, and office files are supported.
Quick Diagnosis
Run
brv status to check authentication, project, and provider state.
ByteRover 知识管理
使用 brv 命令行工具管理项目的长期记忆。
安装:npm install -g byterover-cli
知识以人类可读的 Markdown 文件形式存储在 .brv/context-tree/ 目录中。
无需身份验证。 brv query、brv curate 和 brv vc(本地版本控制)开箱即用。仅远程同步(brv vc push/brv vc pull)需要登录。
工作流程
- 1. 思考之前: 运行 brv query 了解现有模式。
- 实施之后: 运行 brv curate 保存新的模式/决策。
命令
1. 查询知识
概述: 从项目的知识库中检索相关上下文。使用已配置的 LLM 提供商从 .brv/context-tree/ 内容中综合生成答案。
使用此技能的场景:
- - 用户希望您回忆某些内容
- 您的上下文不包含您需要的信息
- 您需要回忆您的能力或过去的操作
- 在执行任何操作之前,检查相关规则、标准或偏好
不要使用此技能的场景:
- - 信息已存在于您当前的上下文中
- 查询是关于通用知识的,而非存储的记忆
bash
brv query 身份验证是如何实现的?
2. 搜索上下文树
概述: 通过纯 BM25 查找从 .brv/context-tree/ 中检索匹配文件的排名列表。与 brv query 不同,此操作不调用 LLM——无需综合、无令牌成本、无需提供商设置。返回包含路径、分数和摘录的结构化结果。
使用此技能的场景:
- - 您需要文件路径来读取,而非综合生成的答案
- 您希望快速、低成本的检索,无需 LLM 开销
- 您处于使用结构化结果的自动化流程中
不要使用此技能的场景:
- - 您需要从多个文件中综合生成的自然语言答案——请改用 brv query
- 信息已存在于您当前的上下文中
bash
brv search 身份验证模式
brv search JWT 令牌 --limit 5 --scope auth/
brv search auth --format json
标志: --limit N(1-50,默认 10)、--scope domain/(路径前缀过滤器)、--format json(用于自动化的结构化输出)。
3. 整理上下文
概述: 分析知识并将其保存到本地知识库。使用已配置的 LLM 提供商对您提供的上下文进行分类和结构化。
使用此技能的场景:
- - 用户希望您记住某些内容
- 用户有意整理记忆或知识
- 用户交互中有应持久保存的有意义的记忆
- 存在关于您做什么、您知道什么或您已做出哪些决策和采取哪些行动的重要事实
不要使用此技能的场景:
- - 信息已存储且未更改
- 信息是临时的或仅与当前任务相关,或仅为通用知识
bash
brv curate 身份验证使用 JWT,24 小时过期。令牌通过 authMiddleware.ts 存储在 httpOnly cookie 中
包含源文件(最多 5 个,仅限项目范围内):
bash
brv curate 身份验证中间件详情 -f src/middleware/auth.ts
查看整理历史: 检查过去的整理记录
bash
brv curate view
- - 查看特定条目的完整详情:所有文件和执行的操作(logId 由 brv curate 在完成时打印,例如 cur-1739700001000)
bash
brv curate view cur-1739700001000
- - 列出带有可见文件操作的条目(无需 logId)
bash
brv curate view detail
bash
brv curate view --since 1h --status completed
bash
brv curate view --help
4. 审查待处理更改
概述: 整理操作后,某些更改可能需要人工审查才能应用。使用 brv review 列出、批准或拒绝待处理的操作。
使用此技能的场景:
- - 整理操作报告有待处理的审查(显示在整理输出中)
- 用户想要检查、批准或拒绝待处理的更改
不要使用此技能的场景:
- - 没有待处理的审查(先用 brv review pending 检查)
命令:
列出当前项目的所有待处理审查:
bash
brv review pending
示例输出:
2 个操作待审查
任务:ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3
[UPSERT · 高影响] - 路径:architecture/context/contextcompressionpipeline.md
原因: 记录切换到令牌预算滑动窗口
之后: 上下文压缩管道从响应式溢出切换到令牌预算滑动窗口,位于 src/agent/infra/llm/context/compression/
[UPSERT · 高影响] - 路径:architecture/tools/agenttoolregistry.md
原因: 记录使用基于能力的权限重写工具注册表
之后: 代理工具注册表在 src/agent/infra/tools/tool-registry.ts 中使用基于能力的权限重写
批准全部: brv review approve ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3
拒绝全部: brv review reject ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3
按文件: brv review ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3 --file <路径> [--file <路径>]
每个待处理任务显示:操作类型(ADD/UPDATE/DELETE/MERGE/UPSERT)、文件路径、原因以及之前/之后的摘要。高影响操作会被标记。
批准任务的所有操作(应用更改):
bash
brv review approve
拒绝任务的所有操作(丢弃待处理更改;为 UPDATE/DELETE 操作恢复备份):
bash
brv review reject
批准或拒绝任务中的特定文件:
bash
brv review approve --file <路径> --file <路径>
brv review reject --file <路径>
文件路径相对于上下文树(如 brv review pending 输出所示)。
注意:在批准或拒绝关键更改之前,始终询问用户。
JSON 输出(对代理驱动的工作流有用):
bash
brv review pending --format json
brv review approve --format json
brv review reject --format json
5. LLM 提供商设置
brv query 和 brv curate 需要已配置的 LLM 提供商。连接默认的 ByteRover 提供商(无需 API 密钥):
bash
brv providers connect byterover
要使用其他提供商(例如 OpenAI、Anthropic、Google),请列出可用选项并使用您自己的 API 密钥连接:
bash
brv providers list
brv providers connect openai --api-key sk-xxx --model gpt-4.1
6. 项目位置
概述: 列出已注册的项目及其上下文树路径。返回项目元数据,包括初始化状态和活动状态。使用 -f json 获取机器可读的输出。
使用此技能的场景:
- - 您需要查找项目的上下文树路径
- 您需要检查哪些项目已注册
- 您需要验证项目是否已初始化
不要使用此技能的场景:
- - 您已从当前上下文中知道项目路径
- 您需要项目内容而非元数据——请改用 brv query
bash
brv locations -f json
JSON 字段:projectPath、contextTreePath、isCurrent、isActive、isInitialized。
7. 版本控制
概述: brv vc 为您的上下文树提供基于 git 的版本控制。它使用标准的 git 语义——分支、提交、合并、历史和冲突解决——全部在本地运行,无需身份验证。与团队的可选远程同步。旧版 brv push、brv pull 和 brv space 命令已弃用——请改用 brv vc push、brv vc pull 和 brv vc clone/brv vc remote add。
使用此技能的场景:
- - 用户想要跟踪、提交或检查知识库的更改
- 用户想要分支、合并或撤销知识更改
- 用户想要与团队