Skip to main content

What Are Worktrees?

Worktrees let multiple directories share a single ByteRover context tree. Instead of each directory maintaining its own .brv/ knowledge base, child directories point back to a parent project. Curate once, query everywhere. This is especially useful for:
  • Monorepos — All packages share the root project’s context tree
  • Git worktrees — Parallel checkouts share knowledge without re-curating
  • Sibling directories — Related projects under a common parent

How It Works

ByteRover uses a git-style .brv file/directory duality — the same pattern Git uses for .git in worktrees: When you add a worktree, ByteRover:
  1. Creates a .brv file (not directory) in the target, pointing to the parent
  2. Registers the worktree in the parent’s .brv/worktrees/ directory

Resolution

When you run any brv command from a worktree directory, ByteRover walks up from the current directory and stops at the first .brv it finds:
  • If it’s a directory — you’re in the real project
  • If it’s a file — follow the pointer to the parent project
This means queries, curations, and status checks from packages/api/ automatically use the monorepo’s context tree.

Commands

All worktree commands are available as both CLI commands and TUI slash commands.

worktree add

Register a directory as a worktree of the current project.
Arguments: Flags: Examples:
Without --force, the command will fail if the target already has a .brv/ directory. Use --force to safely migrate — the existing directory is backed up and restored on removal.

worktree list

Show the current worktree status and all registered worktrees.
Example output from a linked worktree:
Example output from the project root:

worktree remove

Remove a worktree registration and delete its .brv pointer file.
Arguments: Examples:
If the worktree was added with --force (and a .brv-backup/ exists), the backup is automatically restored as .brv/ on removal. Your original context tree is preserved.

Backup and Recovery

The --force flag enables safe migration of directories that already have their own .brv/ setup:

Error Handling

Broken pointer errors include recovery instructions. If you see one, follow the suggested command to clean up.

Integration with Other Features

Queries and Curation

From a linked worktree, all queries and curations operate on the parent project’s context tree:

Sources

Sources configured in the parent project are automatically available from all worktrees:

Status

brv status shows worktree information when you’re in a linked directory: