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

# Swarm Curate

> Store knowledge in the best available external memory provider

## Overview

`brv swarm curate` stores knowledge in external memory providers. ByteRover automatically selects the best writable provider based on content type, or you can target a specific provider directly.

```bash theme={null}
brv swarm curate "Jane Smith is the CTO of TechCorp"
```

Output:

```
Stored to gbrain as concept/jane-smith-cto
```

If no external providers are available or writable, the command falls back to ByteRover's context tree (`brv curate`).

## Flags

| Flag         | Short | Default | Description                                                         |
| ------------ | ----- | ------- | ------------------------------------------------------------------- |
| `--provider` | `-p`  | auto    | Target a specific provider (e.g., `gbrain`, `local-markdown:notes`) |
| `--format`   | —     | `text`  | Output format: `text` or `json`                                     |

## Automatic Provider Selection

When no `--provider` flag is given, the write router selects the best target based on the configured providers and their write capabilities:

| Provider           | Writable                    | Typical Content                                        |
| ------------------ | --------------------------- | ------------------------------------------------------ |
| **GBrain**         | Yes                         | Entities, concepts, general knowledge                  |
| **Local Markdown** | Yes (if `read_only: false`) | Notes, meeting logs, TODOs                             |
| **Memory Wiki**    | Yes                         | Concepts, entities (OpenClaw wiki format)              |
| **ByteRover**      | Fallback                    | Falls back here if no external providers accept writes |

<Note>
  Obsidian and ByteRover context tree are read-only in swarm mode. ByteRover is used as a fallback only when no writable external providers are available.
</Note>

## Target a Specific Provider

Use `--provider` to bypass automatic selection:

```bash theme={null}
# Store to a specific local markdown folder
brv swarm curate "meeting notes: decided on JWT" --provider local-markdown:notes
```

Output:

```
Stored to local-markdown:notes as note-1776052527043.md
```

```bash theme={null}
# Store to GBrain explicitly
brv swarm curate "Architecture uses event sourcing" --provider gbrain
```

Output:

```
Stored to gbrain as concept/event-sourcing-architecture
```

```bash theme={null}
# Store to Memory Wiki
brv swarm curate "# OAuth2 Flow\nThe app uses PKCE flow for mobile clients" --provider memory-wiki
```

## JSON Output

```bash theme={null}
brv swarm curate "Test content" --format json
```

```json theme={null}
{
  "id": "note-1776052594462.md",
  "provider": "local-markdown:project-docs",
  "success": true,
  "latencyMs": 1
}
```

## Fallback Behavior

When the target provider fails or no writable providers are configured, swarm curate falls back to the ByteRover context tree:

```
No writable swarm providers available. Falling back to ByteRover context tree.
Stored via brv curate (fallback).
```

The fallback runs `brv curate --detach --format json` as a subprocess. The `--detach` flag ensures the curation runs asynchronously without blocking.

## Swarm Curate vs Context Tree Curate

|              | `brv swarm curate`                          | `brv curate`                                  |
| ------------ | ------------------------------------------- | --------------------------------------------- |
| **Target**   | External providers (GBrain, Local MD, Wiki) | ByteRover context tree                        |
| **LLM**      | No LLM call                                 | LLM-powered domain detection and organization |
| **Output**   | Raw file/page creation                      | Intelligent hierarchical placement            |
| **Fallback** | Falls back to `brv curate`                  | No fallback needed                            |

Use `brv swarm curate` to distribute knowledge across external providers. Use `brv curate` when you want ByteRover's intelligent curation with domain detection, deduplication, and hierarchical organization.

## Examples

**Store a quick note:**

```bash theme={null}
brv swarm curate "Sprint 42 retro: need better error handling in auth flow"
```

**Store with explicit provider:**

```bash theme={null}
brv swarm curate "# Database Migration Guide\nAlways use reversible migrations" -p gbrain
```

**Store and verify with JSON:**

```bash theme={null}
brv swarm curate "API rate limit is 100 req/min" --format json
```
