> ## 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.

# Onboard Existing Context

This workflow helps you onboard existing documentation files (1-3 files) into your context tree. Perfect for READMEs, specs, or any markdown files already in your codebase.

For bulk extraction from your entire codebase, see [Bootstrap from Codebase](/common-workflows/bootstrap).

## Prerequisites

* ByteRover CLI installed
* Project initialized (run `brv` to start the REPL and initialize your project)
* Existing file(s) with documentation or context (markdown, code, config, PDFs, Office documents, etc.)

## Step 1: Identify Your Context Source

You likely have existing documentation in your codebase: `README.md`, `ARCHITECTURE.md`, `SECURITY.md`, or similar files containing valuable context.

For this example, we'll use a `security.md` file:

```markdown theme={null}
Security Best Practices:
Never commit .env files - Add to .gitignore
Use strong secrets - Minimum 32 characters for JWT secrets
Rotate secrets regularly - Especially in production
Use secret management - AWS Secrets Manager, HashiCorp Vault
Validate on startup - Fail fast if configuration is wrong
```

## Step 2: Curate to Context Tree

You can curate context using either your coding agent or manually in the REPL.

<Tabs>
  <Tab title="Via Coding Agent">
    **Copy this prompt and paste it into your coding agent's chat (e.g., Cursor, Claude Code, etc.):**

    ```markdown theme={null}
    > use brv curate to intelligently organize content from security.md
    ```

    Your coding agent will read the file and execute:

    ```bash theme={null}
    brv curate "Security Best Practices:
    Never commit .env files - Add to .gitignore
    Use strong secrets - Minimum 32 characters for JWT secrets
    Rotate secrets regularly - Especially in production
    Use secret management - AWS Secrets Manager, HashiCorp Vault
    Validate on startup - Fail fast if configuration is wrong"
    ```
  </Tab>

  <Tab title="Commands">
    Curate from a file using the `-f` flag:

    ```bash theme={null}
    brv curate "Security best practices" -f security.md
    ```
  </Tab>

  <Tab title="Manual REPL">
    Run the `/curate` command directly in the ByteRover REPL with the file reference:

    ```bash theme={null}
    # In the REPL:
    /curate "Security best practices from our documentation" @security.md
    ```

    The `@` syntax references files in your codebase (max 5 files per curation).
  </Tab>
</Tabs>

ByteRover automatically analyzes the content and organizes it into the context tree, detecting relevant domains (likely `compliance` or `code_style`) and creating an appropriate topic structure.

## Step 3: Review Changes

Verify what was added:

<Tabs>
  <Tab title="Commands">
    ```bash theme={null}
    brv vc status
    ```
  </Tab>

  <Tab title="Manual REPL">
    ```bash theme={null}
    # In the REPL:
    /vc status
    ```
  </Tab>
</Tabs>

This shows your context tree changes (added, modified, and deleted files). Your context is already stored locally and ready to query.

## Step 4: Query to Verify

Test that your context is retrievable using either your coding agent or manually in the REPL.

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

    ```markdown theme={null}
    > query the context tree for security best practices using brv query
    ```

    Your coding agent will execute:

    ```bash theme={null}
    brv query "security best practices"
    ```
  </Tab>

  <Tab title="Commands">
    ```bash theme={null}
    brv query "security best practices"
    ```
  </Tab>

  <Tab title="Manual REPL">
    Run the `/query` command directly in the ByteRover REPL:

    ```bash theme={null}
    # In the REPL:
    /query security best practices
    ```
  </Tab>
</Tabs>

ByteRover will search intelligently, follow relations between topics, and synthesize an answer from your context tree.

## What Happened Behind the Scenes

1. **Curate Command**: Whether via your coding agent (`brv curate`) or manually (`/curate`), ByteRover processed the content from your file.

2. **Intelligent Curation**: ByteRover automatically detected relevant domains, organized content hierarchically, and created markdown files with descriptive names in `.brv/context-tree/`.

3. **Review**: You verified the organization with `/status`. Your context is stored locally and immediately queryable.

4. **Agentic Search**: Whether via your coding agent (`brv query`) or manually (`/query`), ByteRover reasoned about your question and retrieved relevant context with citations.

## Curating Multiple Files

For 2-3 related files, reference them together using either method.

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

    ```markdown theme={null}
    > read README.md, AUTH.md then use brv curate to add context about the authentication implementation
    ```

    Your coding agent will read both files and execute `brv curate` with their combined context.
  </Tab>

  <Tab title="Commands">
    Reference multiple files using the `-f` flag:

    ```bash theme={null}
    brv curate "Authentication implementation patterns" -f README.md -f AUTH.md
    ```

    You can reference up to 5 files per curation.
  </Tab>

  <Tab title="Manual REPL">
    Use the `@` syntax to reference multiple files:

    ```bash theme={null}
    # In the REPL:
    /curate "Authentication implementation patterns" @README.md @AUTH.md
    ```

    You can reference up to 5 files per curation.
  </Tab>
</Tabs>

ByteRover will organize everything into the appropriate domains and topics.

## Cloud Sync (Optional)

<Note>
  Push/pull requires a cloud account. See [Local vs Cloud](/local-vs-cloud) for setup.
</Note>

To share your context with teammates or back it up to the cloud, stage, commit, and push:

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    brv vc add .
    brv vc commit -m "onboard project context"
    brv vc push
    ```
  </Tab>

  <Tab title="TUI">
    ```
    /vc add .
    /vc commit -m "onboard project context"
    /vc push
    ```
  </Tab>
</Tabs>

## Next Steps

* [Bootstrap from Codebase](/common-workflows/bootstrap) - Bulk context extraction from entire codebase
* [Query the Context Tree](/common-workflows/query-context) - Effective query patterns and tips
* [Curate Context with Intelligence](/common-workflows/curate-context) - Advanced curation options, interactive vs autonomous modes
