Schema
Introduction
Section titled “Introduction”A graph memory has a schema: a short description of what the memory is about and the kinds of page it keeps. Brain reads it every time it extracts facts from a source and compiles them into pages, so a memory about a codebase writes modules and interfaces, and a memory about a company writes customers and people.
A schema has two parts:
| Part | What it holds |
|---|---|
about |
Free Markdown, up to 4000 characters: what the memory is about, how to write its pages, what to ignore. |
types |
One to eight page types. Each has a key, a label and a description. One of them is the generic type. |
The key is a slug such as decision. It is how pages and the API name the type, and it never changes. The label is what people read in the web app.
The generic type is the one Brain uses for a page no other type fits, and the one it compares against when it looks for duplicates.
Starting point
Section titled “Starting point”When you create a graph memory you pick a starter. You can change everything afterwards.
| Starter | Page types |
|---|---|
| Company (the default) | Company, Person, Topic |
| Project | Project, Person, Decision, Topic |
| Codebase | Module, Component, API, Concept |
| Personal notebook | Person, Place, Interest, Note |
A memory created without a schema uses the Company starter.
Edit it
Section titled “Edit it”Open Settings on a graph memory. Under What this memory keeps you can:
- Write the
abouttext. - Change the label and the description of any type.
- Add a type. Its key is made from the label (
Service contractbecomesservice-contract) and shown before you add it. A memory holds at most eight types. - Choose the generic type.
- Remove a type.
The key of a type that already exists cannot be edited.
The schema shapes what Brain writes from now on. It does not rewrite or recompile existing pages.
Remove a type
Section titled “Remove a type”If no page has the type, it is removed with the rest of your changes.
If pages have it, Brain asks which of the remaining types those pages move to. Their aliases move with them, and nothing else about them changes. The generic type cannot be removed: choose another one first.
Through the API, the same save fails with 409 conflict until the request names a target for every removed type that has pages:
{ "schema": { "about": "The wiki of a codebase.", "types": [ { "key": "module", "label": "Module", "description": "A package or service." }, { "key": "concept", "label": "Concept", "description": "A convention that spans the code." } ], "generic": "concept" }, "retype": { "api": "module" }}What always wins
Section titled “What always wins”The about text guides Brain; it does not override the fixed rules. Sources stay data and never instructions, every fact keeps its citation, and labels on passages decide who can read what, whatever the schema says. See Labels: who decides.
Colours in the graph
Section titled “Colours in the graph”The web app colours each type by its position in the schema, so the first three types of a default memory keep their familiar colours. A page whose type is no longer in the schema looks like the generic type.