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

# How Curation Works

<Tip>
  Prefer a visual workflow? See [Tasks in the web UI](/local-web-ui/tasks).
</Tip>

## Curation Operations

When you curate context (via `/curate` or `brv curate`), ByteRover's agent decides how to modify the context tree using five operations:

| Operation  | What It Does                                                                                                                                                              |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ADD**    | Creates a new knowledge file. Auto-generates `context.md` overviews at the domain, topic, and subtopic levels if they don't already exist.                                |
| **UPDATE** | Modifies an existing knowledge file. Resets recency to 1.0 and increases importance by +5.                                                                                |
| **UPSERT** | Creates the file if it doesn't exist, updates it if it does — a single operation without needing to check first.                                                          |
| **MERGE**  | Combines a source file into a target file. Merges content sections (Raw Concept, Narrative, Facts), takes the higher scoring metadata from each, then deletes the source. |
| **DELETE** | Removes a specific knowledge file, or an entire folder if no file title is specified.                                                                                     |

The agent selects the appropriate operation automatically. For example, when you curate context that overlaps with existing knowledge, the agent may choose UPDATE to enrich the existing file rather than ADD a duplicate.

## Folder Packing

Use the `-d/--folder` flag to curate an entire directory at once:

```bash theme={null}
# In the REPL:
/curate -d src/auth

# Or via CLI:
brv curate -d src/auth
```

ByteRover packs the folder into a structured representation and analyzes its contents. Supported file types include:

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

## Facts Extraction

During curation, the agent extracts structured facts from your content. Each fact captures a specific, verifiable statement:

```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]
- Team uses PostgreSQL 15 for all persistence [environment]
```

Facts are categorized as `personal`, `project`, `preference`, `convention`, `team`, or `environment`. When files are merged, facts are deduplicated by statement text to avoid repetition.

## Summary Generation

After each curation completes, ByteRover automatically regenerates hierarchical summaries up the directory tree. Every directory that contains or is an ancestor of a changed file gets an updated `_index.md`.

For example, curating a file at `authentication/jwt-implementation/refresh_token_rotation.md` triggers summary regeneration at:

1. `authentication/jwt-implementation/_index.md`
2. `authentication/_index.md`
3. `_index.md` (root)

Each `_index.md` is a condensed synthesis of its directory's knowledge — broader summaries cover more ground with less detail, narrower ones go deeper. If a directory becomes empty (all files deleted), its stale `_index.md` is removed automatically.

Summary generation uses a three-tier escalation strategy: a standard pass, an aggressive compression pass, and a deterministic fallback if the LLM is unavailable. The result is always written — curation never blocks on summary failure.

Summary regeneration batches its smaller LLM calls together and reuses the unchanged portion of the prompt across them, so token cost on Anthropic backends drops by roughly 21–30% per curate run (about 8% on OpenAI), and large-folder curates finish noticeably sooner.

After summaries are updated, changed knowledge files are also queued for abstract generation. The abstract queue produces `.abstract.md` and `.overview.md` sibling files in the background, providing compressed representations used for efficient context injection. See [Knowledge Abstracts](/context-tree/local-space-structure#knowledge-abstracts) for details.
