Skip to main content
In ByteRover CLI v2.0.0, the daemon-first architecture means every CLI command runs headless by default. The background daemon handles all execution — the TUI is just another optional client. There is no special flag to enable headless mode. Run any brv command from a script, pipeline, or SSH session and it works out of the box.
Daemon-first headless execution requires ByteRover CLI v2.0.0 or later.

Quick Start

1

Connect a provider

The free built-in provider works out of the box — no API key needed. To bring your own:
brv providers connect openrouter --api-key $OPENROUTER_API_KEY --model anthropic/claude-sonnet-4-20250514
2

(Optional) Install a connector for your coding agent

brv connectors install "Claude Code"
3

Run commands with structured output

brv query "How is auth implemented?" --format json
The daemon auto-starts on the first command — no manual setup needed. It shuts down automatically after 30 minutes of inactivity.

The --format json Flag

The --format json flag is the key to automation. It produces structured JSON output on every command, making it easy to parse results in scripts and pipelines.
FlagDescriptionDefault
--format <text|json>Output format: text for human-readable, json for structuredtext
All commands listed below support --format json.

Supported Commands

CommandKey FlagsAuth RequiredDescription
brv statusNoShow CLI and project status
brv query "<question>"NoQuery the context tree
brv curate "<context>"--files, --folder, --detachNoCurate context to the tree
brv curate view [id]--status, --since, --before, --limit, --detailNoView curate history and audit trail
brv providers connect <provider>--api-key, --model, --base-urlNoConnect an LLM provider
brv providers listNoList available providers and connection status
brv providers switch <provider>NoSwitch the active provider
brv providers disconnect <provider>NoDisconnect an LLM provider
brv modelNoShow active model and provider
brv model list--providerNoList available models
brv model switch <model>--providerNoSwitch the active model
brv connectorsNoList installed agent connectors
brv connectors install <agent>--typeNoInstall a coding agent connector
brv hub listNoList available skills and bundles
brv hub install <id>--agent, --scope, --registryNoInstall a skill or bundle from the hub
brv login --api-key <key>Authenticate for cloud sync
brv push--branchYesPush context tree to cloud
brv pull--branchYesPull context tree from cloud
brv space switch--team, --nameYesSwitch to a team and space
brv space listYesList available teams and spaces
Commands marked “No” under Auth Required work entirely locally — no account, no internet (when using a local LLM provider). See Local vs Cloud for a full breakdown.
For full command syntax, flags, and examples, see the CLI Reference. For detailed provider and model management, see External LLM Providers. For the skills and bundles registry, see BRV Hub.

JSON Output Format

When using --format json, every command outputs one or more JSON lines to stdout. Each line follows the same envelope structure.

Response Envelope

interface JsonResponse {
  command: string      // Command name (e.g., "status", "query", "push")
  data: object         // Command-specific payload
  success: boolean     // true for success, false for errors
  timestamp: string    // ISO 8601 timestamp
}

Single-Response Commands

Commands like status, push, pull, and space switch emit a single JSON line:
{"command":"status","data":{"authStatus":"logged_in","userEmail":"dev@example.com","currentDirectory":"/project","teamName":"my-team","spaceName":"my-space","contextTreeStatus":"no_changes","cliVersion":"2.0.0"},"success":true,"timestamp":"2026-01-15T10:30:00.000Z"}

Streaming Commands

Commands like query and curate emit multiple JSON lines as the task progresses. Each line includes a data.event field:
EventDescription
thinkingLLM reasoning started
toolCallTool invoked (includes toolName, args)
toolResultTool completed (includes success)
responseLLM final answer content
completedTask finished (includes result, status)
errorTask failed (includes message, status)
Example stream for a query:
{"command":"query","data":{"event":"thinking","taskId":"a1b2c3"},"success":true,"timestamp":"2026-01-15T10:30:00.000Z"}
{"command":"query","data":{"event":"response","taskId":"a1b2c3","content":"Authentication uses JWT tokens with 24-hour expiry..."},"success":true,"timestamp":"2026-01-15T10:30:03.000Z"}
{"command":"query","data":{"event":"completed","taskId":"a1b2c3","result":"Authentication uses JWT tokens with 24-hour expiry...","status":"completed"},"success":true,"timestamp":"2026-01-15T10:30:03.000Z"}

Error Responses

Errors set success: false and include error details in data:
{"command":"query","data":{"error":"No provider connected","status":"error"},"success":false,"timestamp":"2026-01-15T10:30:00.000Z"}
Use jq to extract specific fields from JSON output:
brv status --format json | jq '.data.spaceName'
brv push --format json | jq '.data | {status, added, edited, deleted}'

Coding Agent Integration (brv mcp)

The brv mcp command starts an MCP (Model Context Protocol) server that coding agents use to access your project’s context tree. It is a hidden command — coding agents spawn it automatically; you don’t run it directly.

How It Works

Coding Agent (Claude Code / Cursor / Windsurf)

    │ stdio (MCP protocol)

brv mcp (MCP Server)

    │ Socket.IO

Daemon (brv-server)


Agent Pool (LLM workers)
The MCP server connects to the running daemon (auto-starting it if needed) and exposes ByteRover’s context management as tools that the coding agent can call.

Available MCP Tools

ToolParametersDescription
brv-queryquery (required)Query the context tree for project knowledge
brv-curatecontext, files, folderStore context to the context tree

Setup

The easiest way to configure MCP integration is through the TUI’s /connectors command, which sets up the MCP configuration for your coding agent automatically. For manual setup and supported agents, see Coding Agent Connectors. For details on how the MCP server connects to the daemon and reuses the agent pool, see Daemon-First Architecture.

Curate History (brv curate view)

The brv curate view command lets you inspect curate operation history — useful for CI/CD audit trails, debugging failed curations, and verifying what was curated.
brv curate view [id] [--status <status>...] [--since <time>] [--before <time>] [--limit <n>] [--detail] [--format json]
FlagDescriptionDefault
--status <status>Filter by status: cancelled, completed, error, processing (repeatable)All
--since <time>Show entries after this time (ISO date or relative: 1h, 24h, 7d)
--before <time>Show entries before this time (ISO date or relative)
--limit <n>Maximum number of entries to return10
--detailInclude operations for each entryfalse
Pass an entry ID as the first argument to view a single entry in detail. Examples:
# View recent curate history
brv curate view --format json

# Check only completed curations from the last hour
brv curate view --status completed --since 1h --format json

# View a specific curate entry
brv curate view cur-1739700001000 --format json

# CI audit: verify last 5 curations succeeded
brv curate view --limit 5 --status completed --status error --format json

CI/CD Integration

All CLI commands work in CI/CD environments out of the box. The daemon auto-starts, handles execution, and shuts down after 30 minutes of inactivity — no cleanup step needed.

Common Patterns

Local-only (no auth needed):
  1. Install ByteRover CLI
  2. Connect a provider (or use the free built-in)
  3. Run commands (query, curate, status)
Cloud sync (auth required):
  1. Install ByteRover CLI
  2. Authenticate with an API key
  3. Set up space for the project
  4. Run commands (query, curate, push, pull)

Workflow Examples

No authentication needed — uses the built-in provider or your own API key for local operations only.
name: Curate Build Context

on:
  push:
    branches: [main]

jobs:
  curate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: "20"

      - name: Install ByteRover CLI
        run: curl -fsSL https://byterover.dev/install.sh | sh

      - name: Connect provider
        run: brv providers connect openrouter --api-key ${{ secrets.OPENROUTER_API_KEY }} --model anthropic/claude-sonnet-4-20250514

      - name: Curate build context
        run: brv curate "CI build passed on main — commit ${{ github.sha }}" --format json
The cloud sync examples above use brv login, brv push, and brv pull — these require authentication. If you only need local operations (curate, query, status), skip the authentication and space setup steps.
Store your API key in your CI/CD platform’s secret manager. Never commit keys to version control.

Authentication for Cloud Sync

Authentication is only required for cloud features: push, pull, space switch, and space list. Local operations — status, query, curate, providers, connectors, model — work without any authentication. CI/CD and automation environments use API key authentication instead of browser-based OAuth.

Generate an API Key

  1. Go to ByteRover Dashboard
  2. Click Create API Key
  3. Copy the key (starts with brv_)
  4. Store securely in your CI/CD secrets

Secure Storage

Never commit API keys to version control. Use environment variables or secret managers.
# Set as environment variable
export BYTEROVER_API_KEY=brv_your_api_key_here

# Use in commands
brv login --api-key "$BYTEROVER_API_KEY"
CI/CD Secret Storage:
  • GitHub Actions: Repository secrets (Settings > Secrets > Actions)
  • GitLab CI: CI/CD variables (Settings > CI/CD > Variables, masked)
  • Jenkins: Credentials plugin with secret text

Environment & Token Storage

ByteRover stores authentication tokens as AES-256-GCM encrypted files in a platform-specific data directory:
PlatformStorage Location
macOS~/Library/Application Support/brv/
Linux / CI runners~/.local/share/brv/
Windows%LOCALAPPDATA%/brv/
If storage fails due to permissions, ensure the directory exists and is writable:
# Linux / CI runners
mkdir -p ~/.local/share/brv && chmod 700 ~/.local/share/brv

# macOS
mkdir -p ~/Library/Application\ Support/brv && chmod 700 ~/Library/Application\ Support/brv

Troubleshooting

Short answer: Only for cloud sync features.Local operations (status, query, curate, providers, connectors, model) work without authentication.Cloud operations (push, pull, space switch, space list) require brv login --api-key.See Local vs Cloud for a full breakdown.
Cause: Container restrictions, port access issues, or stale lock files.Solution: Force a clean restart:
brv restart
Check daemon logs for details:
ls ~/.local/share/brv/logs/
cat ~/.local/share/brv/logs/server-*.log | tail -50
Cause: Running cloud commands without setting up a space first.Solution: Switch to a space before running cloud commands:
brv space switch --team my-team --name my-space
Use brv space list --format json to see available teams and spaces.
Cause: brv query or brv curate fails with “No provider connected”.Solution: Connect a provider:
# Use the free built-in provider
brv providers connect byterover

# Or bring your own API key
brv providers connect openrouter --api-key $OPENROUTER_API_KEY --model anthropic/claude-sonnet-4-20250514
Cause: Errors are written to stderr, not stdout.Solution: Redirect both streams when capturing output:
brv status --format json 2>&1
Or capture them separately:
brv query "question" --format json 2>/dev/null
Cause: Keychain unavailable, token expired, or incorrect API key.Solution:
  1. Verify the API key is correct and not expired
  2. Ensure the BYTEROVER_API_KEY secret is properly configured in your CI/CD platform
  3. Re-run brv login --api-key $BYTEROVER_API_KEY
  4. Check that the secret is not masked in a way that corrupts special characters
Cause: Cannot write to ~/.local/share/brv/ directory.Solution: Ensure the directory exists and is writable:
mkdir -p ~/.local/share/brv
chmod 700 ~/.local/share/brv

Next Steps

Daemon-First Architecture

How the background daemon powers instant startup, agent pool reuse, and shared state

Coding Agent Connectors

Connect coding agents like Cursor, Claude Code, and Windsurf via MCP

CLI Reference

Complete command reference for all ByteRover CLI commands

Troubleshooting

Common issues and solutions for ByteRover CLI