Skip to content

Schemas

This page documents all data structures used in Membrane's memory substrate.

MemoryRecord

The atomic unit of storage. Every stored memory item conforms to this shape.

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": "semantic",
  "sensitivity": "low",
  "confidence": 0.95,
  "salience": 0.8,
  "scope": "project-alpha",
  "tags": ["preference", "editor"],
  "created_at": "2025-01-15T10:00:00Z",
  "updated_at": "2025-01-15T10:00:00Z",
  "lifecycle": { /* Lifecycle */ },
  "provenance": { /* Provenance */ },
  "relations": [ /* Relation[] */ ],
  "payload": { /* one of five payload types */ },
  "audit_log": [ /* AuditEntry[] */ ]
}

Fields

FieldTypeRequiredDescription
idstringYesGlobally unique identifier (UUID). Immutable once created.
typestringYesMemory type: episodic, working, semantic, competence, or plan_graph
sensitivitystringYesAccess classification: public, low, medium, high, or hyper
confidencefloatYesEpistemic confidence in range [0, 1]
saliencefloatYesDecay-weighted importance score, range [0, +inf)
scopestringNoVisibility scope (e.g., user, project, global)
tagsstring[]NoFree-form labels for categorization
created_atdatetimeYesCreation timestamp (RFC 3339)
updated_atdatetimeYesLast update timestamp (RFC 3339)
lifecycleLifecycleYesDecay, reinforcement, and deletion metadata
provenanceProvenanceYesLinks to source events or artifacts
relationsRelation[]NoGraph edges to other MemoryRecords
payloadPayloadYesType-specific structured content
audit_logAuditEntry[]YesChronological action log

Lifecycle

Controls decay, reinforcement, and deletion behavior.

json
{
  "decay": {
    "curve": "exponential",
    "half_life_seconds": 86400,
    "min_salience": 0.01,
    "max_age_seconds": 2592000,
    "reinforcement_gain": 0.2
  },
  "last_reinforced_at": "2025-01-15T10:00:00Z",
  "pinned": false,
  "deletion_policy": "auto_prune"
}

Lifecycle Fields

FieldTypeRequiredDescription
decayDecayProfileYesDecay configuration
last_reinforced_atdatetimeYesWhen salience was last reinforced
pinnedboolNoIf true, salience does not decay
deletion_policystringNoauto_prune, manual_only, or never

DecayProfile Fields

FieldTypeRequiredDescription
curvestringYesexponential, linear, or custom
half_life_secondsintYesTime for salience to halve (minimum: 1)
min_saliencefloatNoFloor value; salience will not decay below this
max_age_secondsintNoMaximum age before eligible for deletion
reinforcement_gainfloatNoSalience boost on reinforcement

Provenance

Links a record to its source events or artifacts.

json
{
  "sources": [
    {
      "kind": "event",
      "ref": "session-001/msg-1",
      "hash": "sha256:abc123...",
      "created_by": "agent-1",
      "timestamp": "2025-01-15T10:00:00Z"
    }
  ],
  "created_by": "ingestion-classifier-v1"
}

Provenance Fields

FieldTypeRequiredDescription
sourcesProvenanceSource[]YesAt least one source
created_bystringNoCreator identifier (e.g., classifier version)

ProvenanceSource Fields

FieldTypeRequiredDescription
kindstringYesevent, artifact, tool_call, observation, or outcome
refstringYesOpaque reference into the host system
hashstringNoContent hash for immutability verification
created_bystringNoActor that created this source
timestampdatetimeNoWhen the source was created or observed

ProvenanceRef

Used by semantic payloads to reference evidence:

FieldTypeRequiredDescription
source_typestringYesevent, tool, observation, or human
source_idstringYesUnique source identifier
timestampdatetimeYesWhen the evidence was created

Relation

A graph edge connecting two MemoryRecords.

json
{
  "predicate": "supports",
  "target_id": "660e8400-e29b-41d4-a716-446655440001",
  "weight": 0.9,
  "created_at": "2025-01-15T10:00:00Z"
}
FieldTypeRequiredDescription
predicatestringYesRelationship type: supports, contradicts, derived_from, supersedes, etc.
target_idstringYesUUID of the related record
weightfloatNoRelationship strength in range [0, 1]
created_atdatetimeNoWhen the relation was established

AuditEntry

A single entry in a record's audit log.

json
{
  "action": "revise",
  "actor": "agent-1",
  "timestamp": "2025-01-15T12:00:00Z",
  "rationale": "Updated preferred language based on new evidence"
}
FieldTypeRequiredDescription
actionstringYescreate, revise, fork, merge, delete, reinforce, or decay
actorstringYesWho or what performed the action
timestampdatetimeYesWhen the action occurred
rationalestringYesWhy the action was taken

Payload Types

Each memory type has a dedicated payload schema. See Memory Types for detailed field descriptions and examples.

Payloadkind valueKey Fields
EpisodicPayloadepisodictimeline, tool_graph, environment, outcome
WorkingPayloadworkingthread_id, state, active_constraints, next_actions
SemanticPayloadsemanticsubject, predicate, object, validity, revision
CompetencePayloadcompetenceskill_name, triggers, recipe, performance
PlanGraphPayloadplan_graphplan_id, version, nodes, edges, metrics

Enums Reference

MemoryType

episodic | working | semantic | competence | plan_graph

Sensitivity

public | low | medium | high | hyper

DecayCurve

exponential | linear | custom

DeletionPolicy

auto_prune | manual_only | never

RevisionStatus

active | contested | retracted

ValidityMode

global | conditional | timeboxed

TaskState

planning | executing | blocked | waiting | done

OutcomeStatus

success | failure | partial

AuditAction

create | revise | fork | merge | delete | reinforce | decay

ProvenanceKind

event | artifact | tool_call | observation | outcome

EdgeKind

data | control