# Knowledge Base & Collections

The **Knowledge Base** is the central repository for articles, uploaded documents, and synced web pages that your AI bots use to answer customer questions. Content is organized into independent **Collections** so you can separate knowledge by product line, brand, or team.

:::note[Required permission & plan]
You need **`ai:manage`** or **`workspace:manage`** to access the **Knowledge** page (`/{slug}/ai-kb`) and the **Knowledge** tab inside a bot (`/{slug}/ai-bots/{botId}/kb`). Knowledge-backed AI replies (`aiReply`) are available on all plans.
:::

## Create a Collection

1. From the left navigation, go to **Build → Knowledge** (`/{slug}/ai-kb`).
2. Click **Create Collection** (or the add button).
3. Configure the collection details:
   - **Icon / Avatar**: Pick a preset emoji or upload a custom image (up to **8 MB**, automatically compressed to a 256px max edge).
   - **Collection Name** *(required)*: Enter a clear identifier (for example, *Sales Policies* or *2026 Catalog*).
   - **Description**: Add a short note describing what this collection covers.
4. Click **Create**. Each new collection is initialized with a default internal data source (**Articles**) ready for your content.

:::tip[Duplicate names]
If you create a collection with the exact same name as an existing collection in the same workspace, the system returns the existing collection instead of creating a duplicate.
:::

## View & Manage Collections

On the **Knowledge** list, each collection displays:
- Its icon/avatar and display name.
- The total number of workspace-scoped **articles / knowledge sources**.
- The number of **AI Bots** currently linked to it.

Click any collection to open its detail view (`/{slug}/ai-kb/{collectionId}`), where you can switch directly to [Articles & File Uploads](/knowledge-base/articles-and-files/) or [Website Sync](/knowledge-base/website-sync/).

### Edit & Delete a Collection

1. Click the **`⋯`** menu at the end of a collection row.
2. Select **Edit** to update the name, description, or avatar.
3. Select **Delete** if the collection is no longer needed.

:::caution[Deleting a collection is permanent]
Deleting a collection permanently removes all knowledge sources and vector chunks inside it, and automatically detaches the collection from any linked AI bots and channels.
:::

## Attach a Collection to an AI Bot

Each AI bot can draw answers from a linked knowledge collection:

1. Go to **Build → My Bots**, open the target bot, and select the **Knowledge** tab (`/{slug}/ai-bots/{botId}/kb`).
2. If no collection is attached yet, choose **Attach existing collection** from your workspace library or **Create new collection** inline.
3. Once attached, all enabled (`isActive`) sources with status **Ready (`READY`)** in that collection become searchable by the bot during customer conversations.

## Test Knowledge Retrieval (Retrieval Tester)

Use the **Retrieval Tester** to preview what your AI bot will retrieve before going live:

1. Open **Retrieval Tester** from the Knowledge Base view.
2. Select the search scope: **All collections** or a **specific collection**.
3. Enter a sample customer question (for example, *"Bank transfer details"* or *"Shipping fee"*) and click **Test retrieval**.
4. Inspect the result mode:
   - **Exact Match (`EXACT_MATCH`)**: When a fixed rule matches, the tester shows **100% confidence** and the verbatim reply that bypasses LLM generation.
   - **Hybrid Search**: Combines semantic similarity (**BGE-M3 vector search**) with keyword matching (**Trigram**), returning the top matching chunks.