symfonic.capabilities.memory.operations¶
operations ¶
What one extraction operation asks for, and what it is allowed to become.
The extraction wire format is the shipped one: a JSON object with an ops
list, each op naming an action, a layer, a label, properties,
and an importance on the 1–10 grid. Keeping it identical is what makes the
migration a service swap rather than a behaviour change.
What differs is the refusals. Every op that does not become a memory says why:
- an
actionthat carries no node (create_edge) would have been written by the shippedcommit_pendingas an entry withcontent=""— a blank memory that costs a retrieval slot and renders as nothing; - an unrecognised
layeris skipped by the shipped parser with a barecontinue; - an importance under the write threshold is dropped during the commit, after the memory has already reached a store.
All three are silent today, and all three answer the same operator question: "why is that not remembered?"
ExtractedMemory
dataclass
¶
ExtractedMemory(record: MemoryRecord, importance: float = 5.0, action: str = 'upsert_node', properties: dict[str, Any] = dict(), redactions: tuple[str, ...] = ())
One candidate memory: the record, and what legacy needs to store it.
ExtractionRequest
dataclass
¶
ExtractionRequest(scope: MemoryScope, user_message: str = '', assistant_message: str = '', turn: int = 0, max_records: int = 50, min_importance: float = 3.0)
One turn, and the ceilings the extraction of it must respect.
ExtractionResult
dataclass
¶
ExtractionResult(scope: MemoryScope, turn: int = 0, memories: tuple[ExtractedMemory, ...] = (), dropped: tuple[tuple[str, str], ...] = (), family: ProviderFamily = ProviderFamily.UNKNOWN, redactions: tuple[str, ...] = (), degraded: bool = False, reason: str = '')
What one extraction produced, and a reason for everything it did not.
write_request ¶
classification_identity ¶
classification_identity(properties: Mapping[str, Any], *, layer: Any = None) -> tuple[tuple[str, str] | None, str]
Read the storage-owned atomic classification contract, lazily.
Source code in src/symfonic/capabilities/memory/operations.py
mint_operation ¶
mint_operation(op: Mapping[str, Any], index: int, request: ExtractionRequest, family: ProviderFamily, scrubber: CredentialScrubber) -> ExtractedMemory | tuple[str, str]
Mint one memory from one operation, or report why it produced none.
Returns an :class:ExtractedMemory, or (identifier, reason) where an
empty reason means "this operation was a legitimate no-op" — a noop
action is the model saying there is nothing to remember, which is an answer
rather than a refusal.
Source code in src/symfonic/capabilities/memory/operations.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
record_id ¶
A deterministic, charset-safe id for one extracted memory.
Derived rather than taken from the label, because the label is free-form
model output and the id is an upsert key inside a rendered charset — a
label containing / would forge one. Derived from the turn and the
text, so a retried post-response stage upserts its own memory instead of
writing a second copy of it (the idempotency the write port promises).