Brain Docs

Reference

ConceptsArchitectureWrite pipelineEntitiesIdentity by keyNamespaces, spaces and sessionsPolicies
Brain/Docs
✦ ASKBrain on GitHubDashboard
ConceptsPolicies

Policies

The knobs Brain exposes — the four enable/disable categories, per-request recall filters, and worker tuning — and where each one applies.

PURPOSE
Brain's behaviour is governed by a small, uniform set of policies. Deploy-time toggles all follow one model with four categories; read-time behaviour is shaped by per-request filters on recall; ageing is worker-driven. This page enumerates the surface and points at where each policy lives.

There is one configuration philosophy: all tuning lives in structured TOML, and the only environment override is the generic BRAIN__SECTION__FIELD parser — there are no bespoke BRAIN_X variables and never more than one knob gating the same logical feature.

That rule has a practical consequence worth stating up front: if you cannot find a setting for something, the answer is usually that it isn't configurable — not that the name is unusual. The surface is small on purpose, and most of what people go looking for (which retriever runs, whether extraction happens, how fusion weighs lanes) is deliberately not exposed, because those are correctness-coupled rather than preference-shaped. Two things aren't knobs at all: the credential broker ([llm.broker], not a provider key) and the bundled models are hard boot requirements (see Architecture).

The enable/disable model

Every toggleable thing falls into exactly one of four categories, each with one consume-semantic.

CategoryFieldSemantics
C0 — always-on (architectural)no flagLoad-bearing. Disabling isn't a mode.
C1 — load-gated capability[<cap>].enabledEnabled ⇒ load at spawn or hard-fail; disabled ⇒ silently skipped.
C2 — background worker[workers.<w>].enabled + tuningEnabled ⇒ provisioned; disabled ⇒ not provisioned.
C3 — runtime per-item toggleadmin *_ENABLE / *_DISABLEToggles a provisioned item live. No capability uses it today.

C0 — what you cannot turn off

The one write path, the three retrievers, RRF fusion, schema, tantivy, write-time HyPE, and the extractor pipeline and all its tiers (pattern / classifier / llm) are always-on. So are the correctness workers (forget cascade, schema migration, statement embedding, and the standing maintenance set). Extraction is C0 precisely because write and read must agree: a graph-populating write step can't be a per-tier toggle without silently breaking graph-backed reads. This is why the credential broker's configuration and the classifier's GLiNER model are hard boot requirements, and why there is no extractor-worker switch and no per-tier gate.

C1 — rerank, the one load-gated capability

The cross-encoder reranker is the only capability safe to disable, because it merely reorders already-retrieved candidates — turning it off changes ordering, not write/read coherence.

It ships disabled, and the published image carries no cross-encoder model. The default is false, so the shipped read path is RRF-only and every hit's rerank_score is None. The reason is correctness rather than cost: rerank only reorders candidates retrieval already surfaced, so it cannot recover a memory retrieval missed. Fixing recall upstream is the work that matters.

[rerank]
enabled = false  # the default, and what the published image supports
                 # true  ⇒ load bge-reranker-base at spawn, or fail to boot

Enabling it without a model on disk is ShardError::CrossEncoderInitFailed at spawn — a boot failure, deliberately, because a silently-degraded reranker would make two shards with identical config return different orderings. An opt-in rerank request against a shard with it off fails CapabilityNotEnabled rather than quietly falling back.

Its live state is surfaced through GET_CAPABILITIES, which reports rerank: false on a stock deployment. There is no per-request flag — rerank is on for every read or none, decided at spawn, because two shards behind the same load balancer returning differently-ordered results for the same query would be worse than not having it. See Read pipeline.

C2 — background workers

Each worker is provisioned or not by [workers.<w>].enabled, with its own tuning fields. Maintenance workers (decay, consolidation, HNSW maintenance, supersession sweep, reclamation) default on; destructive GC workers default off. The split is the principle: anything that only changes ranking or reclaims space runs by default; anything that destroys data waits to be asked. A disabled worker is simply not provisioned — it never silently dead-letters a dependent feature. The extractor worker is the exception: it's always provisioned, because extraction is C0.

Why four categories rather than one flag per thing

The categories exist because "can I turn this off?" has four genuinely different answers, and collapsing them produces the failure every configurable system eventually has: a toggle that appears to work and silently breaks something three layers away.

  • C0 can't be a flag because write and read must agree. Extraction is the clearest case — a graph-populating write step gated per tier would leave graph-backed reads querying a graph that was never populated, with no error anywhere.
  • C1 fails at boot, loudly, rather than degrading. Enabled-but-unloadable is a spawn failure precisely so two shards with identical config cannot return different results.
  • C2 is provisioned or not. A disabled worker is absent, not queued — it never silently accumulates work it will not do.
  • C3 toggles something already provisioned, live. Nothing uses it today; it exists so that adding a live toggle later doesn't require inventing a fifth semantic.

The invariant across all four: a disabled thing is observable as disabled. GET_CAPABILITIES reports the live state, an opt-in request against a disabled capability fails with CapabilityNotEnabled rather than falling back, and a missing worker is a missing worker rather than a growing backlog.

Read-time filters

The per-request surface on recall is a set of flat fields, not a nested filter struct — so the server never has to tell an absent filter from an empty one:

FieldDefaultMeaning
kind_filterNoneRestrict to specific memory kinds
session_filterNoneRestrict to sessions; None spans the space
salience_floor0.0Minimum salience
age_bound_unix_nanosNoneEvent-time lower bound
as_of_record_time_unix_nanosNoneBi-temporal anchor — what did we believe in August?
confidence_threshold0.0Drop below this calibrated confidence

Each list is capped at 1024 entries. They AND-combine; for OR semantics, issue several recalls and merge.

There are no tags and no custom metadata filters, and no fingerprint_match toggle. All three have appeared in older drafts of this page and none exist.

Memories carry no client-defined tag set and no queryable metadata map — the metadata you can attach to an encode is an opaque blob that nothing indexes. Structured attributes you want to filter by belong on entities and statements, which the typed graph queries directly. If you are reaching for a tag, you want a predicate.

Fingerprint matching isn't a toggle because it isn't a preference: a shard serves one embedding model, and a memory stamped with a different one is not comparable against the current query vector at all. Excluding it is not something a caller opts into.

Two of the fields deserve a note. salience_floor is the only way salience reaches a read at all: salience is a filter, not a ranking term, so above the floor a more-salient memory does not outrank a less-salient one. Setting it removes memories that have faded rather than memories that are irrelevant — a different question from relevance, and the reason it is a separate knob. And as_of_record_time_unix_nanos is the one that makes time travel a filter rather than a separate verb.

Filters shape the candidate pool; they don't turn a Many answer into a Single. Membership is decided by the relevance band over whatever survives them — see Read pipeline.

Worker-time policies

These apply on the workers' schedule, not per request — so a change takes effect on the next cycle rather than the next call.

Decay

[memory.decay]
episodic_half_life     = "30d"
semantic_half_life     = "365d"
consolidated_half_life = "90d"
boost_factor           = 0.10    # per access

[workers.decay]
enabled = true

The half-lives are per memory kind and the relative ordering is the point: events fade fast, durable knowledge barely fades, learned patterns sit between. A chat assistant may want faster decay than the defaults; a knowledge base may want effectively none — set a hundred-year half-life, or disable the worker and salience simply stops changing. Nothing else breaks, because decay is pressure on ranking rather than a lifecycle stage anything depends on.

There is also an auto-forget floor, off by default: configure it and the decay worker soft-forgets anything that falls below it. Deliberately opt-in, because automatic deletion is a strong default to impose on someone else's data. A typical threshold if you want it is around 0.05.

Retention windows

Three cleanup workers each hold a window, and each window is a promise something else may be relying on:

WindowDefaultWhat depends on it
forget_grace_period7dHow long a soft forget stays recoverable before the slot is reclaimed and the id retired
Idempotency TTLconfigurableThe horizon within which a retried request_id is deduplicated rather than treated as new
WAL retentionsegment-basedHow far back a dropped subscription can resume from

Shortening these is cheap until it isn't. A tighter WAL retention bounds disk and silently shortens how long a subscriber may be offline before it can no longer resume. A tighter idempotency TTL means a slow retry becomes a second write rather than a deduplicated one. Neither fails loudly at the moment you change it — both fail later, under the conditions you reduced the margin for.

Consolidation

Clusters of related episodic memories in one session are summarised into a Consolidated memory, with the sources retained and linked. The worker needs an external model to generate the summary, so a namespace with no registered credential gets clustering and no summaries. That is a silent absence rather than an error — the symptom is a long-running space that never develops higher-level memories.

Recall scope is a policy too

One per-request setting isn't a filter but a boundary selector:

enum RecallScope { Space, Namespace }   // wire default: Space

Space serves the request from the single shard the caller's (namespace, space) hashes to. Namespace widens it to every space in the caller's own namespace — never beyond — by fanning out to all shards in parallel, merging the per-shard pools with a second rank-fusion pass, and shaping membership once over the merged pool so Single / Many / None is decided globally rather than per shard.

It reuses the ordinary recall permission: a key that may recall may request it. What it cannot do is cross a namespace, which no flag anywhere can.

Reach for it for analytics and admin reads across your own users, not for ordinary serving. A namespace-wide recall costs a fan-out proportional to shard count, where a space-scoped one touches one shard and — because spaces are indexed separately — only that space's vectors.

Where each policy fires

PolicyDeploy (config)Read (per request)Worker
Rerank load gate (C1)✓
Worker enable / tuning (C2)✓
Decay half-lives, boost factor✓✓ applies
forget_grace_period, WAL + idempotency retention✓✓ applies
confidence_threshold, salience_floor✓
kind_filter, session_filter, age_bound✓
as_of_record_time (time travel)✓
Recall scope — space or namespace-wide✓
Salience decay, consolidation, reclamation✓

The middle rows are the ones worth internalising: deploy-time config sets the policy, the worker applies it. Changing a half-life does not retroactively re-age anything — it changes what the next cycle computes.

Changing policy on a running deployment

Three different latencies, and mixing them up is the usual source of "I changed it and nothing happened":

ChangeTakes effect
A read-time filterThe next request — it's a request field, not config
Worker tuning (half-lives, intervals, thresholds)The worker's next cycle — up to an hour for decay
A C1 load gateRestart. The model loads at spawn or the shard refuses to start
A C2 enable/disableRestart. A worker is provisioned at spawn or not at all

So enabling the reranker is a deploy, not a config push — and that is deliberate, because the alternative is a shard that half-loads a model while serving traffic. The same goes for turning a worker on: provisioning happens once, at spawn, so the set of running workers is a property of the process rather than something that drifts.

Verify from outside, not from the config file

The config you believe is live and the config the shard loaded are different things, especially across a rolling restart. GET_CAPABILITIES reports what the shard actually has, and it is the only answer that survives a half-completed deploy. Check it after a change rather than reading the TOML back.

What Brain does not do

No automatic PII detection. It is domain-specific, false-positive-prone, and would add a model call to a path that is deliberately model-free. Redact or tokenise in your application before calling encode.

Older guidance here suggested marking sensitive memories with a tags filter so readers could exclude them. There is no tag field and no metadata filter, so that pattern does not exist — and it was never the right shape anyway: a read-time exclusion that every consumer has to remember to apply is one forgotten call away from being no control at all.

The mechanisms that do exist are structural: put sensitive content in its own space, which is a hard wall rather than a convention, or don't write it and keep the secret in the system that owns it. For content already written, a hard forget zeroes it, and a space delete is always hard for exactly this reason.

No query language, and no runtime-provided expression evaluated server-side. That is a security position as much as an ergonomic one — an eval-shaped operator is a class of injection bug Brain declines to have.

No tuning of the retrieval internals. Which retrievers run, how their ranks fuse, the adaptive top-K — none of it is exposed per request. The router decides from the query's shape, and the parts an operator can influence (per-retriever weights) are deploy-time and want evaluation data behind them rather than a guess.

No cross-namespace anything. There is no admin flag, no scope widening and no support case that spans namespaces — it is the one boundary with no override.

One knob per feature. There is never more than one setting gating the same logical behaviour, and there are no bespoke environment variables — the only override is the generic BRAIN__SECTION__FIELD parser over the same TOML structure. If you find two ways to turn something off, one of them is a bug.

See also
Retention and decay

The workers that apply decay and reclamation.

Read pipeline

Where the filter chain and rerank sit in the read flow.

Architecture

Boot requirements and the always-on subsystems.

recall

The recall verb and its filter surface.

Was this page helpful?

Namespaces, spaces and sessions

Two isolation axes and one grouping — a namespace is the tenant wall, a space is the isolation unit that scales to a million per org, and a session is explicitly not a boundary.

REST API overview

Base URLs, authentication, the response and error shapes, and a reference page for every one of Brain's 60 data-plane and broker routes — plus the two health probes.

On this page

The enable/disable modelC0 — what you cannot turn offC1 — rerank, the one load-gated capabilityC2 — background workersWhy four categories rather than one flag per thingRead-time filtersWorker-time policiesDecayRetention windowsConsolidationRecall scope is a policy tooWhere each policy firesChanging policy on a running deploymentWhat Brain does not do
Suggest an editOpen in Playground