> ## Documentation Index
> Fetch the complete documentation index at: https://docs.byterover.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Curate Context with Intelligence

## Curate context to your context tree

This guide walks you through curating context to your context tree.
`curate` can both be executed by you via `/curate` in the REPL or
by your coding agent
(in your prompt to your coding agent, simply mention ByteRover and it will then run `brv curate` accordingly).
When you provide context, ByteRover autonomously detects domains, searches for duplicates, organizes hierarchically, and prevents duplication using intelligent processing.

Let's use this example context:

```
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
```

## The Easier Way - Let Your Coding Agent Work with Us

The context tree evolves with your project. Your coding agent can intelligently update existing knowledge.

**To update context, copy this prompt and paste it into your coding agent's chat (e.g., Cursor, Claude Code, etc.):**

```markdown theme={null}
> Work on the task below and update the context tree accordingly.

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
```

Your coding agent will then start working on the task and run curation with ByteRover accordingly.

## Curate via the REPL or CLI

ByteRover automatically categorizes and organizes your context. It detects domains, searches for duplicates, and places content intelligently using semantic understanding.

**Run the command with your context:**

```bash theme={null}
# In the REPL:
/curate "curate needed (or missing) context about health check endpoint"
```

**Example output:**

```
⠋ Curating...
  add .brv/context-tree/structure/health_check_endpoint/health_check_endpoint.md
✓ Context curated successfully.
```

**How Autonomous Mode Works:**

1. **Domain Detection**: Analyzes your input and detects relevant domains (code\_style, testing, structure, etc.) using semantic understanding—not keyword matching.
2. **Search Existing Knowledge**: Searches your context tree for related existing knowledge to prevent duplication.
3. **Decide Create or Update**: Determines whether to create a new topic or update an existing one.
4. **Hierarchical Organization**: Structures content into the appropriate hierarchy: domain → topic → (optional) subtopic.
5. **Add Relations**: Identifies and creates explicit `@domain/topic` relations to connect related knowledge, building a navigable knowledge graph.

For a deeper look at curation operations, folder packing, and facts extraction, see [How Curation Works](/context-tree/curation-engine).

### File Reference

You can include files from your codebase when curating. In the REPL, use the `@` syntax to reference files. On the CLI, use the `-f`/`--files` flag.

<Tabs>
  <Tab title="Via Coding Agent">
    Your coding agent will execute:

    ```bash theme={null}
    brv curate "Authentication flow" -f src/auth/login.ts -f src/auth/oauth.ts
    ```
  </Tab>

  <Tab title="CLI">
    ```bash theme={null}
    brv curate "API documentation" -f src/api.ts -f README.md
    brv curate "Database schema" --files prisma/schema.prisma
    ```
  </Tab>

  <Tab title="REPL">
    ```bash theme={null}
    /curate "API documentation" @src/api.ts @README.md
    /curate "Authentication flow" @src/auth/login.ts @src/auth/oauth.ts
    /curate "Database schema" @prisma/schema.prisma
    ```
  </Tab>
</Tabs>

**Constraints**:

* Maximum 5 file references per curation
* Supported types: text/code files, images, PDFs, and Office documents (.docx, .xlsx, .pptx)
* Paths are relative to project root

### Folder Curation

Curate an entire directory at once. ByteRover packs the folder into a structured representation and analyzes its contents. On the CLI, use the `-d`/`--folder` flag. In the REPL, use `@` with a folder path.

<Tabs>
  <Tab title="Via Coding Agent">
    **Copy this prompt and paste it into your coding agent's chat:**

    ```markdown theme={null}
    > use brv curate to analyze the src/auth directory and add its context to the context tree
    ```

    Your coding agent will execute:

    ```bash theme={null}
    brv curate -d src/auth
    ```
  </Tab>

  <Tab title="CLI">
    ```bash theme={null}
    brv curate -d src/auth
    ```

    Or with the long flag:

    ```bash theme={null}
    brv curate --folder src/auth
    ```
  </Tab>

  <Tab title="REPL">
    ```bash theme={null}
    /curate @src/auth/
    ```
  </Tab>
</Tabs>

<Note>
  Curating multiple folders in a single `brv curate` call (e.g. `brv curate -d src/auth -d src/api`) counts as one operation against your usage, not one per folder.
</Note>

**Supported file types:**

* **Code** -- TypeScript, JavaScript, Python, Go, Rust, Ruby, Java, C/C++, and 30+ other languages
* **Config & data** -- JSON, YAML, TOML, XML, `.env` files
* **Documentation** -- Markdown, MDX, RST, plain text
* **PDFs** -- Automatic text extraction (up to 50 pages)
* **Office files** -- Word (.docx), Excel (.xlsx), PowerPoint (.pptx)

The folder pack respects `.gitignore` patterns and skips binary files automatically.

For technical details on folder packing, see [How Curation Works](/context-tree/curation-engine).

### Facts Extraction

During curation, ByteRover automatically extracts structured facts from your content. Each fact captures a specific, verifiable statement and is categorized by type:

| Category      | Example                                                          |
| ------------- | ---------------------------------------------------------------- |
| `convention`  | "Access tokens are signed with RS256 algorithm"                  |
| `project`     | "Token pairs are stored in the database for revocation tracking" |
| `environment` | "Team uses PostgreSQL 15 for all persistence"                    |
| `personal`    | "Prefers functional components over class components"            |
| `preference`  | "Use 2-space indentation for all TypeScript files"               |
| `team`        | "Code reviews require 2 approvals before merge"                  |
| `other`       | "The project was started in January 2024"                        |

Facts are stored in the `## Facts` section of each knowledge file in the context tree:

```markdown theme={null}
## Facts
- **jwt_secret**: Access tokens are signed with RS256 algorithm [convention]
- **refresh_token**: Refresh tokens are single-use and rotated on renewal [convention]
- Token pairs are stored in the database for revocation tracking [project]
```

When files are merged during curation, facts are deduplicated by statement text to avoid repetition.

For more details, see [How Curation Works](/context-tree/curation-engine).

## Customize Your Intention

The power of the CLI is its flexibility—autonomous mode adapts to how you want to organize your knowledge. For example:

**Copy this prompt and paste it into your coding agent's chat:**

```markdown theme={null}
> curate the following context about health check implementation
> [Your content here]
> break it into small context pieces
```

Your coding agent will execute the command, and ByteRover will intelligently divide your content into separate, focused topics—making it easier to reference specific parts later.

## You're in Control of Your Context

You decide exactly how your context is organized. Autonomous mode is flexible and follows your lead.

### Breaking Context Into Smaller Pieces

Want granular organization? **Copy this prompt and paste it into your coding agent's chat:**

```markdown theme={null}
> curate the following context, break it into small focused pieces
> [Your content here]
```

ByteRover will divide content into separate topics, each with clear scope.

### Keeping Context Together

Prefer cohesive organization? **Copy this prompt and paste it into your coding agent's chat:**

```markdown theme={null}
> curate the following context, keep it together as one topic
> [Your content here]
```

ByteRover will create a single, comprehensive topic instead of multiple smaller ones.

### Summarizing Before Storing

Have lots of detail but want condensed knowledge? **Copy this prompt and paste it into your coding agent's chat:**

```markdown theme={null}
> curate the following context, summarize it before adding
> [Your content here]
```

ByteRover extracts essential information, keeping your context tree focused and concise.

### Mix and Match

Combine approaches! Some contexts broken down, others kept whole, some summarized. ByteRover adapts to your workflow—you're always in the driver's seat.

ByteRover follows your instructions for granularity and organization style, ensuring your context tree matches your team's preferences.
