Skip to main content

Add Context to Local Space

This guide walks you through adding context to the local space within your current codebase. The typical flow for adding context in ByteRover starts with the brv add command, like this:
> add the following context with brv add:
> Task: Add a health check endpoint to the Express server

Steps:

1. Create basic Express server setup
   - File: src/server.ts
   - Set up Express app with TypeScript
   - Configure basic middleware

2. Create health check route
   - File: src/routes/health.ts
   - Implement GET /health endpoint
   - Return status, timestamp, uptime

3. Add types for response
   - File: src/types/health.ts
   - Define TypeScript interface

4. Create tests
   - File: tests/health.test.ts
   - Test endpoint returns 200
   - Validate response structure

5. Update package.json scripts
   - Add dev script
   - Add test script

Success Criteria:

- GET /health returns 200 status
- Response includes: status, timestamp, uptime
- TypeScript compiles without errors
- Tests pass
and the agent will execute the command
brv add --section "Best Practices" --content "Task: Add a health check endpoint to the Express server

Steps:

1. Create basic Express server setup
   - File: src/server.ts
   - Set up Express app with TypeScript
   - Configure basic middleware

2. Create health check route
   - File: src/routes/health.ts
   - Implement GET /health endpoint
   - Return status, timestamp, uptime

3. Add types for response
   - File: src/types/health.ts
   - Define TypeScript interface

4. Create tests
   - File: tests/health.test.ts
   - Test endpoint returns 200
   - Validate response structure

5. Update package.json scripts
   - Add dev script
   - Add test script

Success Criteria:
- GET /health returns 200 status
- Response includes: status, timestamp, uptime
- TypeScript compiles without errors
- Tests pass"
When the command runs, it creates a section called “Best Practices” and stores the content in the local space. You can specify which section should store the content.
add the following context with brv add, create the new section: express best practices
Task: Add a health check endpoint to the Express server

.....
Check the playbook.json file—you’ll see the “section”: “express best practices”. You can view the memory with the command brv show.

Update Context to Local Space

The local space (playbook.json) is built to evolve with the agent while doing the task. The agent (user) can update old knowledge with new knowledge stored in the local playbook.
> update the @playbook.json so that now when create test the test endpoint retrurn 200 and json health is ok
and the agent will execute the command:
cd /Users/nguyenduyanh/Desktop/issue-tracking && brv add --section "express best practices" --bullet-id "express-00001" --content "Task: Add a health check endpoint to the Express server

Steps:

  1. Create basic Express server setup

     - File: src/server.ts

     - Set up Express app with TypeScript

     - Configure basic middleware

  2. Create health check route

     - File: src/routes/health.ts

     - Implement GET /health endpoint

     - Return status, timestamp, uptime

  3. Add types for response

     - File: src/types/health.ts

     - Define TypeScript interface

  4. Create tests

     - File: tests/health.test.ts

     - Test endpoint returns 200

     - Test endpoint returns JSON with health: ok

  5. Update package.json scripts

     - Add dev script

     - Add test script

Success Criteria:

  - GET /health returns 200 status

  - Response includes: status, timestamp, uptime

  - TypeScript compiles without errors

  - Tests pass"
The local space has now been updated with the new context.

Customize Your Intention

The power of the Command Line Interface is its simplicity—even low-tier LLMs can run it effectively. It’s also highly customizable, letting you curate context exactly how you want. For example, you can prompt
> add the following context with brv add:
> Task: Add a health check endpoint to the Express server

Steps:

1. Create basic Express server setup
   - File: src/server.ts
   - Set up Express app with TypeScript
   - Configure basic middleware

2. Create health check route
   - File: src/routes/health.ts
   - Implement GET /health endpoint
   - Return status, timestamp, uptime

3. Add types for response
   - File: src/types/health.ts
   - Define TypeScript interface

4. Create tests
   - File: tests/health.test.ts
   - Test endpoint returns 200
   - Validate response structure

5. Update package.json scripts
   - Add dev script
   - Add test script

Success Criteria:

- GET /health returns 200 status
- Response includes: status, timestamp, uptime
- TypeScript compiles without errors
- Tests pass
  break it to small conext
You’ll see the agent run multiple times, storing multiple contexts in the local space (playbook.json).

You’re in Control of Your Context

Here’s the fun part: you get to decide exactly how your context is stored! The agent is flexible and will follow your lead. Want to keep things organized differently? Just tell it what you need.

Breaking Context Into Smaller Pieces

If you have a large block of information and want it split into manageable chunks, simply add instructions like:
> add the following context with brv add, break it into small context
> [Your content here]
The agent will intelligently divide your content into separate, focused pieces—making it easier to reference specific parts later.

Keeping Context Together

Prefer to keep everything in one place? No problem! Just ask:
> add the following context with brv add, try not to break it into small context
> [Your content here]
The agent will respect your preference and store the content as a single, cohesive entry.

Summarizing Before Storing

Have a lot of detail but want a condensed version in your playbook? You can ask the agent to summarize first:
> add the following context with brv add, summarize it before adding
> [Your content here]
This gives you the essential information without the extra noise, keeping your local space clean and focused.

Mix and Match

Feel free to combine these approaches! You might want some contexts broken down, others kept whole, and some summarized. The agent adapts to your workflow—you’re always in the driver’s seat.