ZenBrain Memory

v0.3.3
ai.zensation/zenbrain Checked 11 hours ago Published 8 days ago

Agent memory: working, episodic, semantic, procedural and core layers.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

zenbrain_store Store a memory

Write something into long-term memory so it survives this conversation. Routing is automatic by default, first match wins: `steps`, or wording such as "How to", "Steps:" or "workflow:", make a procedure; an emotional weight above 0.5 an episode (set it via `emotionalWeight`: the detection from the content rates most clearly emotional texts below 0.5); a `confidence` above 0.9 a pinned core memory; anything else a semantic fact. Set `type` only when you want to override that. Every call adds a new memory, except that storing the same core memory again only renews its timestamp. The content is a…

ParameterTypeDescription
content *stringThe memory to store, in plain language.
confidencenumberHow certain this is (0–1), kept with facts. Above 0.9 routes to core memory unless an earlier routing rule matched.
contextstringContext domain, e.g. 'work', 'personal', 'learning'. Kept with episodes only.
emotionalWeightnumberEmotional significance (0–1). Detected from the content when omitted, but the detection rates most clearly emotional texts below 0.5, so set it when a memory should be an episode. Above 0.5 routes t…
outcomestringWhat the procedure achieves.
sourcestringWhere this came from, e.g. 'user', 'ai', 'import'. Kept with facts and episodes.
stepsarrayOrdered steps of a procedure. Optional: without them the steps are taken from the content (numbered or bulleted lines, otherwise every line).
toolsarrayTools a procedure uses.
typestringRouting hint. 'auto' (default) decides from the content.

zenbrain_recall Recall memories

Search long-term memory for anything relevant to a query. By default it searches the episodic, semantic, procedural and core layers; working memory (the most recent stores, held only while the server runs, up to five results) is searched only when named in `layers`. Returns results sorted by score, each with its id and the layer it came from; zenbrain_forget takes both. The score runs from 0 to 1 and says how well a result matches the query; a layer in which nothing matches returns recent memories (or its most successful procedures) at 0, behind every hit, and minScore above 0 leaves them out.…

ParameterTypeDescription
query *stringWhat to look for, in plain language.
layersarrayRestrict the search to these layers. Defaults to episodic, semantic, procedural and core; add 'working' to include the most recent stores held in memory (up to five, ranked by the query).
limitintegerHow many results to return at most, after ranking (default 10).
minConfidencenumberLeave out results whose confidence is below this value. Applied before the final ranking, so fewer than `limit` results may come back. Facts use their stored confidence, procedures their success rate;…
minScorenumberLeave out results scoring below this value (default 0 keeps all). Any value above 0 drops the score-0 fallbacks that a layer returns when nothing in it matches.

zenbrain_forget Forget a memory

Permanently delete a memory, addressed by the id and layer that zenbrain_recall returned for it, together with what consolidation linked to it; this cannot be undone. Forgetting an episode also deletes the fact zenbrain_consolidate made from it; forgetting such a fact also deletes every episode consolidated into it; both also delete the working-memory copies of that content. Forgetting a working-memory result deletes only that copy. alsoForgotten lists everything deleted besides the memory itself. A memory stored on its own and never consolidated keeps its long-term entry. Use it when the user…

ParameterTypeDescription
id *stringThe id of one result from zenbrain_recall.
layer *stringThe layer of that same result, exactly as zenbrain_recall reported it.

zenbrain_consolidate Consolidate memory

Run one consolidation pass: among the 100 most recent episodes, each one with an emotional weight above 0.5 becomes a semantic fact — once, however often the pass runs. Working-memory slots lose relevance with age, and slots whose relevance has dropped to 0.01 or below are removed; that is the only deletion, and nothing in long-term memory is deleted. Run it between sessions or after a batch of zenbrain_store calls, not on every turn; compare zenbrain_health before and after to see the effect.

zenbrain_health Inspect memory state

Report how full the memory layers are: working-memory slots in use, interactions held, episodes, facts and how many are due for review, procedures, core blocks. Read-only and cheap, safe to call at any time. It returns counts only; to read the memories themselves, use zenbrain_recall.