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.
ForgetInProgress
dataclass
¶
A forget whose erasure has not finished.
Not a receipt and not a refusal: a durable job committed, and from that
commit the subtree reads as erased to every reader and every write under
it refuses. What remains is erased in later transactions: claim
identities, and, when the content exceeded one transaction, the content
itself, which no read returns meanwhile. Forget the same scope again to
advance it; only a :class:LifecycleReceipt reports the forget complete.
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 = '', updated_at: datetime | None = None)
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, selected_manifest: SelectedRecordManifest | None = None)
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.
Source code in src/symfonic/capabilities/memory/records.py
store_time ¶
A store row time as aware UTC, or None.
Mongo stores isoformat() strings and a historical row written from a
naive utcnow() reads back naive; PostgreSQL TIMESTAMPTZ is always
aware. Every shipped writer stamps UTC, so a naive value is read as UTC
rather than blanking status, and every reader orders one set of aware
stamps without raising comparing naive with aware.