Skip to main content

Retrieve context from remote space

This guide walks you through retrieving context from the remote space within your current codebase. The typical flow for retrieving context in ByteRover starts with the brv retrieve command, like this:
> retrieve context about Express health check implementation using brv retrieve
and the agent will execute the command
brv retrieve --query "Express health check endpoint implementation"
When the command runs, it searches the remote space for relevant context matching your query.

Retrieve with specific file context

You can narrow down your retrieval by specifying which files are relevant to your query using the --node-keys option:
> retrieve context about health check but only related to src/routes/health.ts and tests/health.test.ts
and the agent will execute the command:
brv retrieve --query "health check endpoint" --node-keys "src/routes/health.ts,tests/health.test.ts"
This focuses the retrieval on memories that are specifically related to those files, giving you more targeted results.

Multiple retrievals for complex tasks

For complex tasks requiring different types of context, you can run multiple retrieval queries:
> first retrieve context about Express setup, then retrieve context about TypeScript testing patterns
and the agent will execute:
brv retrieve --query "Express server setup with TypeScript"
brv retrieve --query "TypeScript testing patterns and best practices"

Crafting effective queries

The quality of your retrieval depends on your query. Here are some tips: Specific queries work better:
brv retrieve --query "Express health check endpoint with TypeScript and tests"
vs. vague queries:
brv retrieve --query "server stuff"
Include technical details:
brv retrieve --query "JWT authentication middleware implementation with refresh tokens"
Reference specific patterns or technologies:
brv retrieve --query "React hooks for form validation with Zod schema"

You’re in Control of Your Retrieval

The brv retrieve command is flexible and adapts to how you want to work:

Broad Exploration

Want to see everything related to a topic? Use a general query:
> retrieve all context about authentication using brv retrieve
brv retrieve --query "authentication"
This gives you a wide view of all authentication-related memories.

Focused Retrieval

Need specific implementation details? Be more precise:
> retrieve context about OAuth PKCE flow implementation
brv retrieve --query "OAuth PKCE authorization code flow implementation"

File-Scoped Retrieval

Working on specific files and want only relevant context:
> retrieve authentication context but only for the auth service and token store files
brv retrieve --query "authentication" --node-keys "src/infra/auth/oauth-service.ts,src/infra/auth/token-store.ts"

Combining with Add

Retrieved something useful but want to add your own notes? Retrieve first, then add:
> retrieve context about health checks, then add my implementation notes
The agent will:
  1. Run brv retrieve to get existing context
  2. Then run brv add to append your new insights
This lets you build on top of team knowledge with your own discoveries.