{"skill":{"slug":"byterover","displayName":"ByteRover","summary":"You MUST use this for gathering contexts before any work. This is a Knowledge management for AI agents. Use `brv` to store and retrieve project patterns, dec...","description":"---\nname: byterover\ndescription: \"You MUST use this for gathering contexts before any work. This is a Knowledge management for AI agents. Use `brv` to store and retrieve project patterns, decisions, and architectural rules in .brv/context-tree. Uses a configured LLM provider (default: ByteRover, no API key needed) for query and curate operations.\"\n---\n\n# ByteRover Knowledge Management\n\nUse the `brv` CLI to manage your project's long-term memory.\nInstall: `npm install -g byterover-cli`\nKnowledge is stored in `.brv/context-tree/` as human-readable Markdown files.\n\n**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`).\n\n## Workflow\n1.  **Before Thinking:** Run `brv query` to understand existing patterns.\n2.  **After Implementing:** Run `brv curate` to save new patterns/decisions.\n\n## Commands\n\n### 1. Query Knowledge\n**Overview:** Retrieve relevant context from your project's knowledge base. Uses a configured LLM provider to synthesize answers from `.brv/context-tree/` content.\n\n**Use this skill when:**\n- The user wants you to recall something\n- Your context does not contain information you need\n- You need to recall your capabilities or past actions\n- Before performing any action, to check for relevant rules, criteria, or preferences\n\n**Do NOT use this skill when:**\n- The information is already present in your current context\n- The query is about general knowledge, not stored memory\n\n```bash\nbrv query \"How is authentication implemented?\"\n```\n\n### 2. Search Context Tree\n**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.\n\n**Use this skill when:**\n- You need file paths to read rather than a synthesized answer\n- You want fast, cheap retrieval with no LLM overhead\n- You're in an automated pipeline that consumes structured results\n\n**Do NOT use this skill when:**\n- You need a natural-language answer synthesized from multiple files — use `brv query` instead\n- The information is already present in your current context\n\n```bash\nbrv search \"authentication patterns\"\nbrv search \"JWT tokens\" --limit 5 --scope \"auth/\"\nbrv search \"auth\" --format json\n```\n\n**Flags:** `--limit N` (1-50, default 10), `--scope \"domain/\"` (path prefix filter), `--format json` (structured output for automation).\n\n### 3. Curate Context\n**Overview:** Analyze and save knowledge to the local knowledge base. Uses a configured LLM provider to categorize and structure the context you provide.\n\n**Use this skill when:**\n- The user wants you to remember something\n- The user intentionally curates memory or knowledge\n- There are meaningful memories from user interactions that should be persisted\n- There are important facts about what you do, what you know, or what decisions and actions you have taken\n\n**Do NOT use this skill when:**\n- The information is already stored and unchanged\n- The information is transient or only relevant to the current task, or just general knowledge\n\n```bash\nbrv curate \"Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts\"\n```\n\n**Include source files** (max 5, project-scoped only):\n\n```bash\nbrv curate \"Authentication middleware details\" -f src/middleware/auth.ts\n```\n\n### 4. Review Pending Changes\n**Overview:** After a curate operation, some changes may require human review before being applied. Use `brv review` to list, approve, or reject pending operations.\n\n**Use this when:**\n- A curate operation reports pending reviews (shown in curate output)\n- The user wants to check, approve, or reject pending changes\n\n**Do NOT use this skill when:**\n- There are no pending reviews (check with `brv review pending` first)\n\n**Commands:**\n\nList all pending reviews for the current project:\n```bash\nbrv review pending\n```\n\nSample output:\n```\n2 operations pending review\n\n  Task: ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3\n  [UPSERT · HIGH IMPACT] - path: architecture/context/context_compression_pipeline.md\n  Why:    Documenting switch to token-budget sliding window\n  After:  Context compression pipeline switching from reactive-overflow to token-budget sliding window in src/agent/infra/llm/context/compression/\n\n  [UPSERT · HIGH IMPACT] - path: architecture/tools/agent_tool_registry.md\n  Why:    Documenting tool registry rewrite with capability-based permissions\n  After:  Agent tool registry rewrite in src/agent/infra/tools/tool-registry.ts using capability-based permissions\n\n  To approve all:  brv review approve ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3\n  To reject all:   brv review reject ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3\n  Per file:        brv review <approve|reject> ddcb3dc6-d957-4a56-b9c3-d0bdc04317f3 --file <path> [--file <path>]\n```\n\nEach pending task shows: operation type (ADD/UPDATE/DELETE/MERGE/UPSERT), file path, reason, and before/after summaries. High-impact operations are flagged.\n\nApprove all operations for a task (applies the changes):\n```bash\nbrv review approve <taskId>\n```\n\nReject all operations for a task (discards pending changes; restores backup for UPDATE/DELETE operations):\n```bash\nbrv review reject <taskId>\n```\n\nApprove or reject specific files within a task:\n```bash\nbrv review approve <taskId> --file <path> --file <path>\nbrv review reject <taskId> --file <path>\n```\nFile paths are relative to context tree (as shown in `brv review pending` output).\n\n**Note**: Always ask the user before approving or rejecting critical changes.\n\n**JSON output** (useful for agent-driven workflows):\n```bash\nbrv review pending --format json\nbrv review approve <taskId> --format json\nbrv review reject <taskId> --format json\n```\n\n### 5. LLM Provider Setup\n`brv query` and `brv curate` require a configured LLM provider. Connect the default ByteRover provider (no API key needed):\n\n```bash\nbrv providers connect byterover\n```\n\nTo use a different provider (e.g., OpenAI, Anthropic, Google), list available options and connect with your own API key:\n\n```bash\nbrv providers list\nbrv providers connect openai --api-key sk-xxx --model gpt-4.1\n```\n\n### 6. Project Locations\n**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.\n\n**Use this when:**\n- You need to find a project's context tree path\n- You need to check which projects are registered\n- You need to verify if a project is initialized\n\n**Do NOT use this when:**\n- You already know the project path from your current context\n- You need project content rather than metadata — use `brv query` instead\n\n```bash\nbrv locations -f json\n```\n\nJSON fields: `projectPath`, `contextTreePath`, `isCurrent`, `isActive`, `isInitialized`.\n\n### 7. Version Control\n**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.\n\n**Use this when:**\n- The user wants to track, commit, or inspect changes to the knowledge base\n- The user wants to branch, merge, or undo knowledge changes\n- The user wants to sync knowledge with a team (push/pull)\n- The user wants to connect to or clone a team space\n- The user asks about knowledge history or diffs\n\n**Do NOT use this when:**\n- The user wants to query or curate knowledge — use `brv query`/`brv curate` instead\n- The user wants to review pending curate operations — use `brv review` instead\n- Version control is not initialized and the user didn't ask to set it up\n\n**Commands:**\n\nAvailable commands: `init`, `status`, `add`, `commit`, `reset`, `log`, `branch`, `checkout`, `merge`, `config`, `clone`, `remote`, `fetch`, `push`, `pull`.\n\n#### First-Time Setup\n\n**Setup — local (no auth needed):**\n```bash\nbrv vc init\nbrv vc config user.name \"Your Name\"\nbrv vc config user.email \"you@example.com\"\n```\n\n**Setup — clone a team space (requires `brv login`):**\n```bash\nbrv login --api-key sample-key-string\nbrv vc clone https://byterover.dev/<team>/<space>.git\n```\n\n**Setup — connect existing project to a remote (requires `brv login`):**\n```bash\nbrv login --api-key sample-key-string\nbrv vc remote add origin https://byterover.dev/<team>/<space>.git\n```\n\n#### Local Workflow\n\n**Check status:**\n```bash\nbrv vc status\n```\n\n**Stage and commit:**\n```bash\nbrv vc add .                     # stage all\nbrv vc add notes.md docs/        # stage specific files\nbrv vc commit -m \"add authentication patterns\"\n```\n\n**View history:**\n```bash\nbrv vc log\nbrv vc log --limit 20\nbrv vc log --all\n```\n\n**Unstage or undo:**\n```bash\nbrv vc reset                     # unstage all files\nbrv vc reset <file>              # unstage a specific file\nbrv vc reset --soft HEAD~1       # undo last commit, keep changes staged\nbrv vc reset --hard HEAD~1       # discard last commit and changes\n```\n\n#### Branch Management\n\n```bash\nbrv vc branch                    # list branches\nbrv vc branch feature/auth       # create a branch\nbrv vc branch -a                 # list all (including remote-tracking)\nbrv vc branch -d feature/auth    # delete a branch\nbrv vc checkout feature/auth     # switch branch\nbrv vc checkout -b feature/new   # create and switch\n```\n\n**Merge:**\n```bash\nbrv vc merge feature/auth        # merge into current branch\nbrv vc merge --continue          # continue after resolving conflicts\nbrv vc merge --abort             # abort a conflicted merge\n```\n\n**Set upstream tracking:**\n```bash\nbrv vc branch --set-upstream-to origin/main\n```\n\n#### Cloud Sync (Remote Operations)\n\nRequires ByteRover authentication (`brv login`) and a configured remote.\n\n**Manage remotes:**\n```bash\nbrv vc remote                    # show current remote\nbrv vc remote add origin <url>   # add a remote\nbrv vc remote set-url origin <url>  # update remote URL\n```\n\n**Fetch, pull, and push:**\n```bash\nbrv vc fetch                     # fetch remote refs\nbrv vc pull                      # fetch + merge remote commits\nbrv vc push                      # push commits to cloud\nbrv vc push -u origin main       # push and set upstream tracking\n```\n\n**Clone a space:**\n```bash\nbrv vc clone https://byterover.dev/<team>/<space>.git\n```\n\n### 8. Swarm Query\n**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.\n\n**Use this skill when:**\n- You need to search across multiple knowledge sources at once\n- The user has configured multiple memory providers (check with `brv swarm status`)\n- You want results from Obsidian notes, GBrain entities, or wiki pages alongside ByteRover context\n\n**Do NOT use this skill when:**\n- The user only has ByteRover configured — use `brv query` instead (it synthesizes via LLM)\n- You need an LLM-synthesized answer — `brv swarm query` returns raw search results, not synthesized text\n\n```bash\nbrv swarm query \"How does JWT refresh work?\"\n```\n\nOutput:\n```\nSwarm Query: \"How does JWT refresh work?\"\nType: factual | Providers: 4 queried | Latency: 398ms\n──────────────────────────────────────────────────\n1. [memory-wiki] sources/jwt-token-lifecycle.md    score: 0.0150  [keyword]\n   # JWT Token Lifecycle ...\n2. [obsidian] SwarmTestData/Authentication System.md    score: 0.0142  [keyword]\n   # Authentication System ...\n3. [gbrain] alex-chen    score: 0.0117  [semantic]\n   # Alex Chen — Senior Backend Engineer ...\n```\n\n**With explain mode** (shows classification, provider selection, enrichment):\n```bash\nbrv swarm query \"authentication patterns\" --explain\n```\n\nOutput:\n```\nClassification: factual\nProvider selection: 4 of 4 available\n  ✓ byterover    (healthy, selected, 0 results, 14ms)\n  ✓ obsidian    (healthy, selected, 5 results, 91ms)\n  ✓ memory-wiki    (healthy, selected, 2 results, 15ms)\n  ✓ gbrain    (healthy, selected, 1 results, 260ms)\nEnrichment:\n  byterover → obsidian\n  byterover → memory-wiki\nResults: 8 raw → 7 after RRF fusion + precision filtering\n```\n\n**JSON output:**\n```bash\nbrv swarm query \"rate limiting\" --format json\n```\n\nOutput:\n```json\n{\n  \"meta\": {\n    \"queryType\": \"factual\",\n    \"totalLatencyMs\": 340,\n    \"providers\": {\n      \"byterover\": { \"selected\": true, \"resultCount\": 0 },\n      \"obsidian\": { \"selected\": true, \"resultCount\": 5 },\n      \"gbrain\": { \"selected\": true, \"resultCount\": 1 },\n      \"memory-wiki\": { \"selected\": true, \"resultCount\": 1 }\n    }\n  },\n  \"results\": [\n    { \"provider\": \"memory-wiki\", \"providerType\": \"memory-wiki\", \"score\": 0.015, \"content\": \"# Rate Limiting ...\" }\n  ]\n}\n```\n\n**Limit results:**\n```bash\nbrv swarm query \"testing strategy\" -n 5\n```\n\n**Flags:** `--explain` (show routing details), `--format json` (structured output), `-n <value>` (max results).\n\n### 9. Swarm Curate\n**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.\n\n**Use this skill when:**\n- You want to store knowledge in an external provider (GBrain, Local Markdown, Memory Wiki)\n- The user has configured writable swarm providers\n\n**Do NOT use this skill when:**\n- You want to store in ByteRover's context tree specifically — use `brv curate` instead\n- No swarm providers are configured — use `brv curate` instead\n\n```bash\nbrv swarm curate \"Jane Smith is the CTO of TechCorp\"\n```\n\nOutput:\n```\nStored to gbrain as concept/jane-smith-cto\n```\n\n**Target a specific provider:**\n```bash\nbrv swarm curate \"meeting notes: decided on JWT\" --provider local-markdown:notes\n```\n\nOutput:\n```\nStored to local-markdown:notes as note-1776052527043.md\n```\n\n```bash\nbrv swarm curate \"Architecture uses event sourcing\" --provider gbrain\n```\n\nOutput:\n```\nStored to gbrain as concept/event-sourcing-architecture\n```\n\n**JSON output:**\n```bash\nbrv swarm curate \"Test content\" --format json\n```\n\nOutput:\n```json\n{\n  \"id\": \"note-1776052594462.md\",\n  \"provider\": \"local-markdown:project-docs\",\n  \"success\": true,\n  \"latencyMs\": 1\n}\n```\n\n**Flags:** `--provider <id>` (target specific provider), `--format json` (structured output).\n\n### 10. Swarm Status\n**Overview:** Check provider health and write targets before running swarm query or curate. Use this to verify which providers are available and operational.\n\n**Use this skill when:**\n- Before running `brv swarm query` or `brv swarm curate` to check available providers\n- Diagnosing why swarm results are missing from a specific provider\n\n```bash\nbrv swarm status\n```\n\nOutput:\n```\nMemory Swarm Health Check\n════════════════════════════════════════\n  ✓ ByteRover       context-tree (always on)\n  ✓ Obsidian        /Users/you/Documents/MyObsidian\n  ✓ Local .md       1 folder(s)\n  ✓ GBrain          /Users/you/workspaces/gbrain\n  ✓ Memory Wiki     /Users/you/.openclaw/wiki/main\n\nWrite Targets:\n  gbrain (entity, general)\n  local-markdown:project-docs (note, general)\n\nSwarm is operational (5/5 providers configured).\n```\n\n### 11. Query and Curate History\n**Overview:** Inspect past query and curate operations. Use `brv query-log view` to review query history, `brv curate view` to review curate history, and `brv query-log summary` to see aggregated recall metrics. Supports filtering by time, status, tier, and detailed per-operation output.\n\n**Use this skill when:**\n- You want to review what was queried or curated previously\n- You need to inspect a specific operation by logId\n- You want to filter history by time window or completion status\n- You want to collect data for analysis or debugging\n- You want to know what knowledge was added, updated, or deleted over time\n- You want aggregated metrics on query recall, cache hit rate, or knowledge gaps\n\n**Do NOT use this skill when:**\n- You want to run a new query — use `brv query` instead\n- You want to curate new knowledge — use `brv curate` instead\n\n**View curate history:** to check past curations\n- Show recent entries (last 10)\n```bash\nbrv curate view\n```\n- Full detail for a specific entry: all files and operations performed (logId is printed by `brv curate` on completion, e.g. `cur-1739700001000`)\n```bash\nbrv curate view cur-1739700001000\n```\n- List entries with file operations visible (no logId needed)\n```bash\nbrv curate view --detail\n```\n- Filter by time and status\n```bash\nbrv curate view --since 1h --status completed --limit 1000\n```\n- For all filter options\n```bash\nbrv curate view --help\n```\n\n**View query history:** to check past queries\n- Show recent entries (last 10)\n```bash\nbrv query-log view\n```\n- Full detail for a specific entry: matched docs and search metadata (logId is printed by `brv query` on completion, e.g. `qry-1739700001000`)\n```bash\nbrv query-log view qry-1739700001000\n```\n- List entries with matched docs visible (no logId needed)\n```bash\nbrv query-log view --detail\n```\n- Filter by time, status, or resolution tier (0=exact cache, 1=fuzzy cache, 2=direct search, 3=optimized LLM, 4=full agentic)\n```bash\nbrv query-log view --since 1h --status completed --limit 1000\nbrv query-log view --tier 0 --tier 1\n```\n- For all filter options\n```bash\nbrv query-log view --help\n```\n\n**View query recall metrics:** to see aggregated stats across recent queries\n- Summary for the last 24 hours (default)\n```bash\nbrv query-log summary\n```\n- Summary for a specific time window\n```bash\nbrv query-log summary --last 7d\nbrv query-log summary --since 2026-04-01 --before 2026-04-03\n```\n- Narrative format (human-readable prose report)\n```bash\nbrv query-log summary --format narrative\n```\n- For all options\n```bash\nbrv query-log summary --help\n```\n\n## Data Handling\n\n**Storage**: All knowledge is stored as Markdown files in `.brv/context-tree/` within the project directory. Files are human-readable and version-controllable.\n\n**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.\n\n**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`.\n\n**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.\n\n## Error Handling\n**User Action Required:**\nYou MUST show this troubleshooting guide to users when errors occur.\n\n\"Not authenticated\" | Run `brv login --help` for more details.\n\"No provider connected\" | Run `brv providers connect byterover` (free, no key needed).\n\"Connection failed\" / \"Instance crashed\" | User should kill brv process.\n\"Token has expired\" / \"Token is invalid\" | Run `brv login` again to re-authenticate.\n\"Billing error\" / \"Rate limit exceeded\" | User should check account credits or wait before retrying.\n\n**Agent-Fixable Errors:**\nYou MUST handle these errors gracefully and retry the command after fixing.\n\n\"Missing required argument(s).\" | Run `brv <command> --help` to see usage instructions.\n\"Maximum 5 files allowed\" | Reduce to 5 or fewer `-f` flags per curate.\n\"File does not exist\" | Verify path with `ls`, use relative paths from project root.\n\"File type not supported\" | Only text, image, PDF, and office files are supported.\n\n### Quick Diagnosis\nRun `brv status` to check authentication, project, and provider state.\n","tags":{"latest":"3.3.0"},"stats":{"comments":4,"downloads":39203,"installsAllTime":282,"installsCurrent":279,"stars":116,"versions":8},"createdAt":1769508805216,"updatedAt":1778485857338},"latestVersion":{"version":"3.3.0","createdAt":1776512227733,"changelog":"# v3.3.0\n\n## Added\n\n- Added section 11 \"Query and Curate History\" with Overview, Use/Do-NOT-use blocks, and both brv curate view and brv query-log view command references\n- Removed the curate history block from section 3.\n\n## Unchanged\n\n- All existing commands (query, search, curate, review, providers, locations, vc, swarm) remain unchanged from v3.2.0.","license":"MIT-0"},"metadata":null,"owner":{"handle":"byteroverinc","userId":"s17ah4kx6arxz6q7gebwr8k6jx83h7cg","displayName":"byterover","image":"https://avatars.githubusercontent.com/u/257500950?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779916973133}}