Brainby arc-labs/docs
Concept

Concepts

Mental models for Brain — typed memory, the write/read pipelines, identity-by-key, the entity graph, and the single-binary architecture.

The four pillars

01

Typed memory + entity graph

You write plain text. Brain embeds it, stores it as a memory, and asynchronously extracts a typed graph — entities, and Fact / Preference / Event statements and relations between them. Retrieval can walk that graph instead of reducing everything to cosine distance.

02

Identity by key

An API key is bound to a (namespace, agent, permissions) scope when it's minted. Clients never send a scope — the server derives it from the key, and every memory, entity, and index is isolated per (namespace, agent).

03

One write path, one read verb

Every write is an encode; every read is a recall. encode acks the moment the WAL is fsynced, then derives edges and the typed graph in the background. recall fuses three retrievers into a membership answer — Single, Many, or None.

04

Single binary, no external database

One process embeds everything: an mmap arena for vectors, a WAL, a redb metadata store, in-RAM HNSW, tantivy, and bundled BGE-small + cross-encoder models. Parallelism is sharding. The only outbound dependency is an LLM provider.

Reading order

Was this page helpful?

On this page