---
title: "Brains: group knowledge packs into one collection"
description: "A brain bundles knowledge packs under one ID, so a chat request can attach the whole set with brain_id."
date: 2026-07-15
tags: ["TIE AI Gateway"]
---

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

# Brains: group knowledge packs into one collection

A **brain** is a named collection of [knowledge packs](/ai-gateway/knowledge-packs/). Group packs once under a brain, then ground a chat request in the whole set with a single `brain_id`. This replaces listing every pack ID on each request.

Manage brains through a new REST surface. Create a brain, then add or remove packs.

```bash
# Create a brain
POST /brains
{ "name": "Company Handbook", "description": "HR policies and SOPs" }

# Add a pack to it (idempotent)
POST /brains/{brain_id}/knowledge-packs
{ "pack_id": "7f3c..." }
```

Attach the brain at chat time with `brain_id`. TIE resolves it to the packs it holds, then runs the same retrieval as `knowledge_pack_ids`.

```bash
POST /v1/chat/completions
{
  "model": "anthropic/claude-sonnet-4-5",
  "messages": [{ "role": "user", "content": "What is our refund window?" }],
  "brain_id": "b1a2c3..."
}
```

A brain points at its packs rather than holding copies. Deleting a brain removes only the collection, never the packs. A pack deleted after you add it simply drops out of retrieval. An explicit `knowledge_pack_ids` on the request wins, and the brain is ignored.

Administrators manage brains across users through `/admin/brains`. Admin create accepts a `user_id`; leave it null to create an app-owned or global brain with no owner. Brains require the PostgreSQL memory backend.

See the [Brains guide](/ai-gateway/brains/) for the full contract.

Source: https://truememory-docs.mvstg.com/changelog/tie-ai-gateway/2026-07-15-brains//index.md
