Tune confidence decay
Speed up the confidence-decay worker for a fast-moving deployment through Brain's TOML config and BRAIN__WORKERS__* overrides.
Memories in Brain carry a confidence score. A per-shard background worker decays that score over time so old, unreinforced memories drift down the ranking without being deleted. Decay is a deploy-time worker, not a per-request or per-namespace runtime setting — you tune it in Brain's config and restart.
The knob
Decay cadence lives in the [workers] section of config.toml (baked into the
image at /etc/brain/config.toml). The default runs hourly:
[workers]
decay_interval_sec = 3600 # run the decay pass every hourLower it to decay more aggressively for a fast-moving deployment:
[workers]
decay_interval_sec = 300 # every 5 minutesAny field can be overridden at runtime with the generic BRAIN__SECTION__FIELD
env form — no bespoke variables:
BRAIN__WORKERS__DECAY_INTERVAL_SEC=300The worker runs on every shard. The new cadence takes effect on the next server start.
Verify
Decay lowers the confidence of unreinforced memories over successive passes.
Recall a known cue and watch the field move between runs:
const answer = await brain.recall({ query: 'last quarter revenue', max_results: 10 });
for (const m of answer.memories) {
console.log(m.memory_id, m.confidence, m.salience);
}answer = brain.recall('last quarter revenue', max_results=10)
for m in answer.memories:
print(m.memory_id, m.confidence, m.salience)Re-encoding the same fact reinforces it and resets its decay — a memory that keeps coming up stays confident; one nothing refers to fades.
To drop faded memories out of results entirely rather than just ranking them
lower, pass a confidence or salience floor on the wire client
(RecallBuilder(...).confidence(0.5) / .salience(0.3)). The HTTP client
returns them ranked but unfiltered.
Decay is server-wide, not per-tenant. A deployment that needs sub-minute staleness for one tenant and month-long retention for another is really two workloads — run separate Brain deployments rather than fighting one decay cadence.
Was this page helpful?
Identity from a session JWT
SSR pattern — verify your app's session JWT, derive the caller's (namespace, agent), and run each request under that scope with act_as.
Walk the entity graph
Encode a transcript, list the entities the pipeline extracted, and walk the relation graph with /v1/entities and /v1/graph.