Skip to main content

Memory record

The MemoryRecord is memledger's atomic unit of memory. Every governance field is first-class — first-class fields are contract; ad-hoc metadata is convention.

Fields

Identity & content

FieldTypePurpose
idstrStable identifier (UUID-string); what derived_from and supersedes reference.
contentstrThe memory itself.
record_typestrsemantic / episodic / procedural.
namespacestrHierarchical scope, e.g. /ops/incidents/payment-svc. RBAC and conflict detection both gate on this.

Attribution

FieldTypePurpose
created_bystrAuthor agent. Auditable.
created_atdatetimeAuto-set on add().
session_idstrGroups records from one agent run; aliased to OTel session.id.
workflow_idstrGroups records across multi-agent flows.
triggered_bystrWhat caused this write — alert id, ticket, parent task.

Confidence & lineage

FieldTypePurpose
confidencefloat [0,1]The author's declared confidence.
hedgedboolAuthor flagged this as a guess. Surfaces to consumers and deducts 5 points from the Memory Quality Score.
derived_fromlist[str]Provenance — the chain. Forms a DAG.
supersedesOptional[str]This record replaces an older record.

Governance (populated by memledger)

FieldTypePurpose
confidence_flagOptional[str]PASS / FLAG / FILTER, set per search by the confidence gate.
quality_scoreOptional[int]Composite Memory Quality Score, 0–100.
conflictslist[ConflictRef]Near-duplicates detected at write time. See Conflicts.

Open metadata

FieldTypePurpose
metadatadictArbitrary domain-specific keys. Never used for governance.

Why first-class?

Sidecar metadata is convention-driven; first-class fields are contract. memledger's confidence gate, conflict detector, RTBF cascades, and MAI rubric all read these fields directly — they cannot be schema-drifted away by a careless add() call. The metadata dict exists for app-level extension and is intentionally outside that contract.

Where it goes