Memory#
Memory is OpenRath’s durable knowledge plane. It mirrors the sandbox/backend architecture, but stays independent from it: sandbox backends run side effects, memory backends store and retrieve knowledge.
flowchart LR
A["flow.Agent"] --> B["Session"]
A --> C["MemoryStore"]
B --> D["BackendSandbox"]
C --> E["MemoryBackend"]
D --> F["Backend"]
Symmetry With Sandbox Backends#
Sandbox plane |
Memory plane |
Role |
|---|---|---|
|
|
Registry-selected implementation. |
|
|
Refcounted live handle. |
|
|
User-facing open spec. |
|
|
Typed dispatch payload. |
|
|
Typed result or structured failure. |
The planes do not cross-import. flow.Agent is the composition point because an agent may need both: a sandbox for tool execution and a memory store for durable recall.
Local Backend#
The local backend ships with base openrath and is the default registered memory backend. It stores entries under .openrath/memory/local/ or under an explicit configured path.
Capability |
Local behavior |
|---|---|
write/read/list/tree |
Filesystem-backed Markdown entries. |
find/search |
BM25 by default; optional embeddings when an embedding provider is configured. |
resource ingest |
Copies or fetches local/URL resources into the memory tree. |
commit |
Archives session messages and optionally extracts memories with a chat provider. |
OpenViking Adapter#
The OpenViking backend is optional and belongs behind openrath[openviking]. The public boundary remains memory://...; internal OpenViking identifiers such as viking://... stay inside the adapter.
This keeps workflows portable:
from rath import flow
agent = flow.Agent("Use project memory.", model="gpt-5.5", memory="local")
hits = agent.recall_memory("deployment notes")
Switching a store from local to OpenViking should change configuration, not workflow code.
Agent Memory Lifecycle#
Step |
API |
Notes |
|---|---|---|
Attach |
|
Accepts a store, store spec, backend/preset name, or |
Explicit write |
|
Best for facts the app already knows are durable. |
Recall |
|
Usually called before a model turn or by application code. |
Commit |
|
Extracts durable knowledge from a transcript. |
Automatic commit |
|
Best-effort; failures should not break the main model response path. |
Design Boundaries#
Boundary |
Rule |
|---|---|
Public URI |
Use |
Adapter URI |
Keep backend-specific schemes private. |
Config |
|
Stability |
|
Test Coverage#
Behavior |
Tests |
|---|---|
op/result dataclasses |
|
registry/default backend |
|
local backend operations |
|
agent memory helpers |
|
OpenViking adapter |
|