ByteRover Knowledge Management
Use the brv CLI to manage your own knowledgebase. ByteRover maintains a context tree that stores patterns, decisions, and implementation details about a project.
IMPORTANT: For headless/automated use, always add --headless --format json flags to get machine-parseable JSON output.
Setup (Headless)
- - ByteRover can be fully set up in headless mode. If user has not logged in or initialized
.brv/ in the current working directory (check via projectInitialized and and authStatus in brv status --headless --format json
response), ask them to provide:
- 1. API key - for authentication (obtain from https://app.byterover.dev/settings/keys)
- Team and space - names or IDs for project initialization
Login with API Key
Authenticate using an API key:
CODEBLOCK0
Outputs text: Logged in as <email> on success.
Initialize Project
Initialize ByteRover for a project (requires team and space for headless mode - can use either ID or name):
CODEBLOCK1
Force re-initialization:
CODEBLOCK2
Example response:
CODEBLOCK3
Note: You can use either team/space names or IDs. Names are matched case-insensitively.
Check Status
Check the current status of ByteRover and the project:
CODEBLOCK4
Example response:
CODEBLOCK5
Query Knowledge
Ask questions to retrieve relevant knowledge:
CODEBLOCK6
Example response:
CODEBLOCK7
Curate Context
Add new knowledge or context to the project's context tree:
CODEBLOCK8
Include specific files for comprehensive context (max 5 files):
CODEBLOCK9
Example response:
CODEBLOCK10
Push Context Tree
Push local context tree changes to ByteRover cloud storage:
CODEBLOCK11
The -y flag skips confirmation prompt (required for headless mode).
Push to a specific branch:
CODEBLOCK12
Example response:
CODEBLOCK13
Possible statuses:
- -
success - Push completed - INLINECODE9 - No context changes to push
- INLINECODE10 - Push was cancelled
- INLINECODE11 - Push failed
Pull Context Tree
Pull context tree from ByteRover cloud storage:
CODEBLOCK14
Pull from a specific branch:
CODEBLOCK15
Example response:
CODEBLOCK16
Possible statuses:
- -
success - Pull completed - INLINECODE13 - Local changes exist, push first
- INLINECODE14 - Pull failed
Error Handling
Always check the success field in JSON responses:
- -
success: true - Operation completed successfully - INLINECODE17 - Operation failed, check
data.error or data.message for details
Common error scenarios:
- - Not authenticated: Run INLINECODE20
- Project not initialized: Run INLINECODE21
- Local changes exist: Push local changes before pulling
Tips
- 1. For pull and push operations, you should ask for user permission first.
- Always use
--headless --format json for automation (except brv login which outputs text). - Check
brv status --headless --format json first to verify auth and project state. - For curate operations, include relevant files with
--files for better context. - Query responses may include tool call details showing what knowledge was searched.
- For push operations, always use
-y to skip confirmation in headless mode. For re-initialization, use -f to force re-initialization. - Pull will fail if there are unpushed local changes - push first.
技能名称: byterover-headless
详细描述:
ByteRover 知识管理
使用 brv CLI 管理您自己的知识库。ByteRover 维护一个上下文树,用于存储项目的模式、决策和实现细节。
重要提示:对于无头/自动化使用,请始终添加 --headless --format json 标志以获取机器可解析的 JSON 输出。
设置(无头模式)
- - ByteRover 可以在无头模式下完全设置。如果用户尚未登录或当前工作目录中未初始化 .brv/(通过 brv status --headless --format json 响应中的 projectInitialized 和 authStatus 检查),请要求他们提供:
- 1. API 密钥 - 用于身份验证(从 https://app.byterover.dev/settings/keys 获取)
- 团队和空间 - 用于项目初始化的名称或 ID
使用 API 密钥登录
使用 API 密钥进行身份验证:
bash
brv login --api-key <密钥>
成功时输出文本:Logged in as <邮箱>
初始化项目
为项目初始化 ByteRover(无头模式需要团队和空间 - 可以使用 ID 或名称):
bash
使用名称
brv init --headless --team my-team --space my-space --format json
使用 ID
brv init --headless --team team-abc123 --space space-xyz789 --format json
强制重新初始化:
bash
brv init --headless --team my-team --space my-space --force --format json
示例响应:
json
{
success: true,
command: init,
data: {
status: success,
teamName: MyTeam,
spaceName: MySpace,
configPath: /path/to/project/.brv/config.json
}
}
注意:您可以使用团队/空间名称或 ID。名称匹配不区分大小写。
检查状态
检查 ByteRover 和项目的当前状态:
bash
brv status --headless --format json
示例响应:
json
{
success: true,
command: status,
data: {
cliVersion: 1.0.0,
authStatus: logged_in,
userEmail: user@example.com,
projectInitialized: true,
teamName: MyTeam,
spaceName: MySpace,
mcpStatus: connected,
contextTreeStatus: has_changes
}
}
查询知识
提问以检索相关知识:
bash
brv query 身份验证是如何实现的? --headless --format json
示例响应:
json
{
success: true,
command: query,
data: {
status: completed,
result: 身份验证使用 JWT 令牌...,
toolCalls: [{tool: search_knowledge, status: success, summary: 5 个匹配项}]
}
}
整理上下文
向项目的上下文树添加新知识或上下文:
bash
brv curate 身份验证使用 JWT,有效期 24 小时。令牌通过 authMiddleware.ts 存储在 httpOnly cookie 中 --headless --format json
包含特定文件以提供全面上下文(最多 5 个文件):
bash
brv curate 身份验证中间件验证 JWT 令牌 --files src/middleware/auth.ts --headless --format json
示例响应:
json
{
success: true,
command: curate,
data: {
status: queued,
taskId: abc123,
message: 上下文已排队等待处理
}
}
推送上下文树
将本地上下文树更改推送到 ByteRover 云存储:
bash
brv push --headless --format json -y
-y 标志跳过确认提示(无头模式必需)。
推送到特定分支:
bash
brv push --branch feature-branch --headless --format json -y
示例响应:
json
{
success: true,
command: push,
data: {
status: success,
added: 3,
edited: 1,
deleted: 0,
branch: main,
url: https://app.byterover.com/team/space
}
}
可能的状态:
- - success - 推送完成
- no_changes - 没有上下文更改需要推送
- cancelled - 推送已取消
- error - 推送失败
拉取上下文树
从 ByteRover 云存储拉取上下文树:
bash
brv pull --headless --format json
从特定分支拉取:
bash
brv pull --branch feature-branch --headless --format json
示例响应:
json
{
success: true,
command: pull,
data: {
status: success,
added: 5,
edited: 2,
deleted: 1,
branch: main,
commitSha: abc123def
}
}
可能的状态:
- - success - 拉取完成
- local_changes - 存在本地更改,请先推送
- error - 拉取失败
错误处理
始终检查 JSON 响应中的 success 字段:
- - success: true - 操作成功完成
- success: false - 操作失败,检查 data.error 或 data.message 以获取详细信息
常见错误场景:
- - 未认证:运行 brv login --api-key <密钥>
- 项目未初始化:运行 brv init --headless --team <团队> --space <空间> --format json
- 存在本地更改:在拉取前先推送本地更改
提示
- 1. 对于拉取和推送操作,您应首先请求用户许可。
- 自动化操作始终使用 --headless --format json(brv login 除外,它输出文本)。
- 首先检查 brv status --headless --format json 以验证认证和项目状态。
- 对于整理操作,使用 --files 包含相关文件以获得更好的上下文。
- 查询响应可能包含工具调用详细信息,显示搜索了哪些知识。
- 对于推送操作,在无头模式下始终使用 -y 跳过确认。对于重新初始化,使用 -f 强制重新初始化。
- 如果存在未推送的本地更改,拉取将失败 - 请先推送。