Expand description
Brain (oxibrain) memory backend.
BrainMemoryBackend is the only durable-memory authority under the
Oxi Foundation v1 host. The legacy local memory backends
(memory_sqlite, memory_summary, memory_mnemopi, memory_workers,
mnemopi) stay compilable during the migration window but are no
longer durable: they are read-only mirrors, never write targets.
§Wire protocol
oxibrain exposes its memory.* tool surface over a Unix-domain socket
via the JSON-RPC client in oxibrain-client. The backend translates
every MemoryBackend method into one oxibrain tool call:
MemoryBackend method | oxibrain tool | args shape |
|---|---|---|
put | memory.put | {"content": ..., "kind": ..., "subject": ...} |
search | memory.search | {"query": ..., "k": N} |
list | memory.list | {"subject": ...} |
delete | memory.delete | {"id": ...} |
§Degraded mode
When the daemon is unreachable, every mutation returns
ToolError(String) carrying "backend unavailable: oxibrain daemon unreachable".
The local file store is never consulted as a fallback, because doing
so would silently duplicate memory across two authorities and break
the Foundation contract. Tools surface degraded to the user instead
of pretending the store succeeded.
§Unix-only
oxibrain-client uses Unix-domain sockets. On non-Unix targets this
module compiles to a stub that returns BackendUnavailable for every
call. The same memory_info constant is used in both targets so the
TUI’s health banner reads “degraded” identically.
Structs§
- Brain
Memory Backend - Brain memory backend. The
Arc<Mutex<Option<…>>>wrapper yields interior mutability on the optional client while keeping theMemoryBackendtrait object signature (Arc<…>, no&mut).
Enums§
- Brain
Health - Health of the Brain connection. Surfaced via
memory_infoso the TUI health banner reports the state without leaking the underlying transport. - Migration
Error - Migration-specific error type. Distinguishes the cases the migration core cares about: backend offline, write failure, runtime failure.
Constants§
- DEFAULT_
BRAIN_ SCOPE - Default scope identifier passed to oxibrain when one is not provided.
oxicode uses the project working directory when known; the fallback
is the literal
"default"so the daemon can route to a project bucket.
Functions§
- default_
socket_ path - Resolves the default socket path for the oxibrain daemon. Honors
OXIBRAIN_SOCKETif set; otherwise$XDG_RUNTIME_DIR/oxibrain.sock(Linux) or~/.oxi/run/oxibrain.sock(macOS).