symfonic.capabilities.memory.records¶
records ¶
What a memory is, and what the write and lifecycle ports say back.
A record carries its own scope path rather than inheriting one from the call
that stored it. That looks redundant next to :class:WriteRequest.scope — the
request validates that they agree — but it is what lets a retrieval answer
"where did this come from?" without a side table, and what lets the bridge check
a returned memory against the query's scope at the port boundary.
Receipts report per item. A write of five memories where one exceeded capacity is not a failure and not a success; it is three-plus-one-plus-one, and a boolean would force the caller to guess which.
LifecycleReceipt
dataclass
¶
LifecycleReceipt(scope_path: str, committed: tuple[str, ...] = (), discarded: tuple[str, ...] = (), degraded: bool = False)
What a flush or a forget did, and to which scope.
MemoryRecord
dataclass
¶
MemoryRecord(record_id: str, layer: MemoryLayer, text: str, scope_path: str, salience: float = 0.5, origin: str = '', revision: str = '', metadata: Mapping[str, Any] = dict(), edited_by: str = '')
One memory, as every port in this capability moves it.
validate ¶
Refuse a record no store should be asked to hold.
Source code in src/symfonic/capabilities/memory/records.py
WriteReceipt
dataclass
¶
WriteReceipt(accepted: tuple[str, ...] = (), rejected: tuple[tuple[str, str], ...] = (), degraded: bool = False)
What the write port did, per memory.
WriteRequest
dataclass
¶
One post-response write: a scope, the memories it produced, the turn.
validate ¶
Refuse a request no adapter should have to interpret.
Both checks are about identity, which is why they raise rather than
landing in the receipt's rejected list: a record filed under another
scope and two records sharing an id are ambiguities, and an adapter that
resolved either one silently would resolve it differently from the next
adapter.
Source code in src/symfonic/capabilities/memory/records.py
retrievable_text ¶
Keep producer facts in the text the prompt can actually retrieve.
Extractors commonly return a compact symbolic label plus structured facts,
for example person:Amiel and occupation=software engineer. Memory
metadata survives for administration, but prompt recall renders only
:attr:MemoryRecord.text. Append values not already represented by the
label so old and new rows do not silently lose half the fact.