TrustContext that controls which records are visible based on sensitivity level and scope.
Trust-aware retrieval
Membrane enforces graduated access control on every read. A record is returned only when both conditions are met:- The record’s sensitivity level is at or below the trust context’s
max_sensitivity. - If the trust context specifies scopes, the record’s scope must match one of them (unscoped records are visible to all callers).
| Record sensitivity | Caller max | Result |
|---|---|---|
low | medium | Full record |
medium | medium | Full record |
high | medium | Redacted (metadata only) |
hyper | medium | Not returned |
Retrieval layer order
When nomemory_types filter is specified, Retrieve queries all five types in the following canonical order:
Retrieve
Performs layered retrieval across one or more memory types with trust filtering and salience ranking.Request fields
Describes the current task. Used as the query for applicability scoring of competence and plan_graph records. When a Postgres + pgvector backend with embeddings is configured, this field drives semantic similarity search.
Trust context that gates which records are visible.
Restrict retrieval to specific memory types:
episodic, working, semantic, competence, plan_graph. When omitted, all types are queried in layer order.Minimum salience threshold. Records with salience below this value are excluded. Must be non-negative and finite.
Maximum number of records to return.
0 means no limit. Maximum is 10 000.Response fields
Array of JSON-encoded
MemoryRecord objects, sorted by salience descending.JSON-encoded
SelectionResult when competence or plan_graph candidates were scored by the selector. May be null when no competence or plan_graph records exist in the result set.Examples
Trust-filtered retrieval example
This pattern retrieves only records that the caller is authorised to see, with scope restriction to a single project:Go — scoped, authenticated retrieval
For LLM integration, map each returned record to a JSON string and include it in the system or user prompt. Records carry their
type, confidence, salience, and structured payload, giving the model typed context rather than raw text.RetrieveByID
Fetches a single record by its UUID. The same trust rules apply: the record is returned only if its sensitivity is within the caller’s trust context.Request fields
UUID of the record to retrieve.
Trust context that gates access.
Response fields
JSON-encoded
MemoryRecord. Returns NOT_FOUND if the ID does not exist, or PERMISSION_DENIED if the trust context denies access.