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

# brain

> Company knowledge base + semantic memory — documents, grounded query, and recall/think/graph/timeline.

`naive.brain` (company-scoped) or `naive.forUser(id).brain` (per-tenant). The brain primitive must be enabled on the AccountKit.

```ts theme={"theme":"css-variables"}
// Ingest source material, then ask a grounded question
await naive.brain.addDocument({ text: "Our refund policy is 30 days.", filename: "refunds.md" });
const answer = await naive.brain.query("What is our refund policy?");
// answer.answer, answer.citations, answer.session_id

// Durable semantic memory
await naive.brain.remember({ content: "Acme Corp prefers quarterly invoicing", source: "crm" });
const memory = await naive.brain.recall({ query: "Acme invoicing" });
const synth = await naive.brain.think({ query: "How should we bill Acme?" });

// Knowledge graph + timeline
const graph = await naive.brain.graph({ entity: "Acme Corp" });
const timeline = await naive.brain.timeline({ entity: "Acme Corp" });
```

## Methods

| Method                                                                                         | Description                                       |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `list()`                                                                                       | List the company's knowledge bases.               |
| `create({ name?, is_default? })`                                                               | Create (and provision) a knowledge base.          |
| `query(question, { knowledge_base_id?, session_id?, filters? })`                               | Grounded answer + citations (10 credits).         |
| `recall({ query, knowledge_base_id?, entity?, since?, limit? })`                               | Structured facts/entities/episodes.               |
| `think({ query, knowledge_base_id?, entity?, session_id?, limit? })`                           | Synthesize memory + docs with gaps (10 credits).  |
| `graph({ knowledge_base_id?, entity?, limit? })`                                               | Entity/relation knowledge graph.                  |
| `timeline({ knowledge_base_id?, entity?, limit? })`                                            | Chronological memory events/facts.                |
| `remember({ content, title?, kind?, source?, confidence?, ... })`                              | Write a durable memory episode.                   |
| `forget({ scope, scope_ref, knowledge_base_id?, reason? })`                                    | Tombstone a memory scope (may be approval-gated). |
| `addDocument({ text? \| url? \| file_base64?, filename?, content_type?, knowledge_base_id? })` | Ingest a document (5 credits).                    |
| `replaceDocument(id, { ... })`                                                                 | Replace/refresh a document in place.              |
| `documents({ knowledge_base_id? })`                                                            | List documents.                                   |
| `getDocument(id)`                                                                              | Get a document (refreshed status).                |
| `deleteDocument(id)`                                                                           | Delete a document (may be approval-gated).        |
| `remove(knowledgeBaseId)`                                                                      | Delete a knowledge base (may be approval-gated).  |

Every method is also exposed as an [agent tool](/docs/sdk/agent-tools) under the `brain` primitive, so an LLM can call it directly via `naive.agentTools()`. See the [Brain guide](/docs/getting-started/brain) for concepts and the [API reference](/docs/api-reference/brain/overview) for wire details.
