Memory Runtime Integration
This page documents the Layer 4 ↔ Layer 7 binding: how agents read and write memory at runtime, and where the control plane enforces governance. It is the runtime counterpart of the Memory Fabric specification.
The binding is non-compliant unless it preserves the control plane: scope resolution before retrieval, recall as an authorized tool call, commit authority restricted to os-agt-010, lineage on every record, tombstone-preserving erasure, and Langfuse tracing of every recall. A binding that lets an agent read or write memory outside these paths is a shadow memory fabric.
Runtime roles
| OS concept | Runtime construct |
|---|---|
| Memory tier | A namespace segment in SynedrixMemoryStore, plus a Qdrant collection and/or a Postgres partition |
| Memory record | A row in memory_records (write-authoritative), projected to a Qdrant point and/or Neo4j node |
memory_profile.recall_scope | The scope intersection applied by os-agt-012 before the store query is built |
tool:memory-recall | A LangChain tool bound only if present in the resolved active_tool_set |
tool:memory-propose | A LangChain tool that emits a proposal; it never writes |
| Working tier | LangGraph graph state + a Postgres checkpointer |
| Formation / consolidation / reflection | Nodes in the background consolidation graph, not in the agent graph |
| Promotion | A tool call to os-agt-010, gated by os-agt-012 |
| Graph tier | NAMS MemoryClient in bolt mode against the OS Neo4j |
| Recall span | A Langfuse observation nested under the agent’s trace |
memory.* events | Emitted by os-agt-010 / os-agt-012, carrying the inherited correlation_id |
Context assembly
The working tier is hot state for an in-flight run: task graph position, iteration counters, dedup windows, idempotency keys, and the in-session conversation buffer. It is stored in Redis and backed by the LangGraph checkpointer.
The working tier is never a source of truth. A run that cannot be reconstructed from the durable tiers (episodic, semantic, procedural, profile) after working memory is lost is non-compliant. Two operational rules follow:
- Checkpoint retention must exceed the longest approval timeout. A graph that interrupts for approval and loses its checkpoint before the human answers leaves an approved action with no run to resume.
- Do not share checkpointer state across unrelated agents. Each Layer 4 service gets its own checkpointer namespace.
Graph state, the checkpointer, SynedrixMemoryStore, and memory_records (Supabase) are four distinct layers:
| Scope | Lifetime | Source of truth? | |
|---|---|---|---|
| Graph state | One super-step | In-process | No |
| Checkpointer | One thread / run | Until retention closes | No — run state only |
SynedrixMemoryStore | Cross-thread, tenant-scoped | Per retention class | No — a governed view of records |
memory_records (Supabase) | Tenant | Per retention class | Yes |
Recall as a tool call
Ambient memory injection is non-compliant. A memory read is a tool call bound in the agent’s active_tool_set, resolved through the three-layer tool authorization model, traced to Langfuse, and rejectable with agent.tool.unauthorized like any other tool.
The canonical tool identifiers are tool:memory-recall (read) and tool:memory-propose (write proposal). An agent with neither in its resolved active set has no memory access.
Hot path
Recall runs in the hot path — as a tool node in the agent graph. The agent needs the answer now:
{
"correlation_id": "corr-9d4a83f1-...",
"causation_id": "evt-7b1f0a92-...",
"requesting_agent": "com-agt-003",
"tiers": ["semantic", "profile"],
"scope": { "tenant_id": "acme", "subject_id": "user-8842" },
"query": "billing entity and invoicing preferences",
"filters": {
"min_confidence": 0.7,
"valid_at": "2026-08-16T10:00:00Z",
"compliance_labels_excluded": ["pci"]
},
"limit": 8
}Response
{
"correlation_id": "corr-9d4a83f1-...",
"status": "served",
"records": [ { "memory_id": "mem-4c8e...", "tier": "semantic", "content": { }, "confidence": 0.94,
"validity_interval": { }, "provenance": { } } ],
"truncated": false,
"scope_applied": { "tenant_id": "acme", "subject_id": "user-8842", "visibility": "tenant" },
"tiers_denied": []
}Records are always returned with their provenance and validity interval attached — an agent that receives memory without knowing where it came from or when it was true cannot ground its output, and groundedness is measured. A recall that returns records without these fields cannot be scored for groundedness.
Write patterns
Write authority for all durable tiers is restricted to os-agt-010 (Memory Curator Agent). Every other agent proposes; only os-agt-010 commits.
Formation proposal (hot path)
Any agent may fire a formation proposal through tool:memory-propose. This is a fire-and-forget call that returns a proposal id — the agent must not wait for extraction. The proposal is persisted as a raw record pending commit.
Commit (background)
Commit runs in the background as part of the scheduled WF-OS-MEMORY-CONSOLIDATE workflow:
sequenceDiagram
participant W as n8n workflow<br/>WF-OS-MEMORY-CONSOLIDATE
participant P as os-agt-012<br/>(scope validator)
participant Policy as os-agt-002<br/>(policy gate)
participant C as os-agt-010<br/>(Memory Curator)
participant R as os-agt-011<br/>(Consolidation & Reflection)
W->>W: fetch uncommitted proposals<br/>+ consolidation candidates
W->>R: invoke os-agt-011<br/>LangGraph reflect-and-revise
R-->>W: proposes merges,<br/>promotions, distilled skills
W->>P: scope validation per proposal
P-->>W: scope resolved
alt promotion requiring approval
W->>Policy: policy gate for promotion
Policy-->>W: approved / denied
end
W->>C: commit approved proposals
C-->>W: records committed
W->>W: emit memory.record.consolidated/<br/>.promoted/.completed/.distilled
W->>W: persist Outcome Envelope
The separation of authority is load-bearing: os-agt-011 recommends, os-agt-010 executes, os-agt-012 approves access. No agent both proposes and commits durable memory.
Graph-tier writes
Every graph-tier write is a NAMS MemoryClient call, never hand-written Cypher issued from an agent node. A NAMS call made from an arbitrary agent node is a governance bypass even though the data lands in the right store. The write goes through os-agt-010 after os-agt-012 has validated scope, carrying the record’s correlation_id.
# os-agt-010 (Memory Curator) — commit a consolidated entity assertion.
# Runs only inside WF-OS-MEMORY-CONSOLIDATE's commit step, after os-agt-012
# has validated scope. Never called from an arbitrary agent node.
result = await memory_client.upsert_entity(
user_identifier=f"{tenant_id}:{subject_id}", # tenant_id first, always
entity_type="Organization", # a POLE+O label
properties={"name": "Acme Logistics BV", "entity_ref": "org-2231"},
source_step_id=agent_step_id, # creates the :TOUCHED edge
)The :TOUCHED edge this call creates — from the AgentStep node to the entity node — is the reasoning-to-entity lineage. A later question (“which reasoning step asserted this fact about this entity, and what did it touch besides”) is a one-hop traversal from the entity node.
SynedrixMemoryStore — the compliance seam
LangGraph’s BaseStore is the only memory surface the Layer 4 runtime natively understands, so everything the OS builds must present through it. Stock implementations (InMemoryStore, PostgresStore) are not canonical: used directly they become a second source of truth with no authorization, no lineage, and no retention.
The OS implements BaseStore itself. That implementation is where the control plane is enforced — specifically through its five methods:
| Method | Enforcement |
|---|---|
aput(namespace, key, value, index=None) | Rejects direct writes. Routes to tool:memory-propose; only os-agt-010 may commit. Raises rather than silently downgrading to a proposal. |
adelete(namespace, key) | Rejects. Deletion is erasure and requires approval; it is never a store operation. |
asearch(namespace_prefix, *, query, filter, limit, offset) | Scope intersection and filters pushed into the Qdrant/Postgres query, never applied after retrieval. Returns records with provenance and validity_interval attached. |
alist_namespaces(...) | Returns only namespaces within the caller’s resolved tenant. |
The two rejecting methods (aput and adelete) are the load-bearing ones. They prevent a well-meaning agent from writing durable memory directly, bypassing commit authority and erasure approval.
Namespace convention
(tenant_id, tier, scope_id)tenant_id is always first. This is fail-safe ordering: a namespace assembled in the wrong order under-matches and returns nothing, rather than over-matching and returning another tenant’s memory.
("acme", "semantic", "user-8842") # subject-scoped semantic memory
("acme", "procedural", "com-agt-003") # an agent's distilled skills
("acme", "episodic", "sess-1f9c") # session-scoped episodesPrefix search — asearch(("acme", "semantic")) — returns everything below that prefix, which is why a tenant can never be reached by a partially-specified namespace.
Backing stores
| Concern | Store |
|---|---|
| Record of truth | Supabase PG17 — memory_records and the lineage tables |
| Semantic index | Qdrant — one collection per fabric tier; KB consumer collections are a separate class |
| Entity / relationship / reasoning graph | Neo4j via NAMS |
| Working tier | Redis + the LangGraph checkpointer |
Wiping the Qdrant mem_* collections or the Neo4j fabric graph and rebuilding from Supabase must produce identical behaviour. A domain pack’s operational stores are rebuilt from the sources the pack declares, and a full-store drill must run both. That is the operational test for “projection, not source of truth.”
Qdrant collection contract
Fabric tier collections (one collection per tier; scope lives in the payload, not the collection name):
| Collection | Tier |
|---|---|
mem_episodic | episodic |
mem_semantic | semantic |
mem_procedural | procedural |
mem_profile | profile |
KB / consumer collections are a separate class (example: synedrix_os_kb). Each consumer owns a dedicated collection and MUST NOT share a fabric tier collection.
Point identity: for fabric projections, the Qdrant point id MUST be the memory_id UUID string from memory_records.
Required payload fields (indexed for filterable search): memory_id, tenant_id, tier, visibility, scope_type, scope_id, subject_id, agent_id, session_id, content_hash, confidence, valid_from, valid_until, consolidation_state, retention_class, compliance_labels, version.
Recall queries MUST push tenant_id and the applicable scope filter into Qdrant. Post-filtering a full tenant result set for scope is forbidden.
Operational collections
A domain pack may maintain a Qdrant collection that is not memory — a domain-owned operational store, an index derived from data the pack already holds. These sit outside the eight tiers and the mem_* and KB rules above do not apply to them; these rules do:
- Name:
ops_<domain-pack-id>_<store>(e.g.ops_trd_regime_fingerprints). Nevermem_*, and never a fabric tier or KB collection. Each belongs to one domain pack. - Point identity: a deterministic UUIDv5 keyed on
tenant_id,business_instance_id, and domain-key components. Never amemory_id. The composite key is(tenant_id, business_instance_id, <domain key>), where the pack declares the domain key per collection (for exampleregime_version). It is never amemory_id, andtenant_idis part of the ID so two tenants, or two business instances of one tenant, with the same domain key cannot address each other’s point. Writes are idempotent upserts on that ID, and the scope payload filter below is still mandatory. - Tenant isolation:
tenant_idis a required indexed payload field and a mandatory filter on every query and write. Where the source data is business-instance-owned,business_instance_idis also a required indexed payload field and a mandatory filter, because a tenant can own several business instances with their own configuration and history. A request without it fails closed (invariant 12). Where the tenant has its own Qdrant (data-plane per tenant), the filter is still required. - Neo4j operational graphs: Neo4j Community has no database RBAC, so credentials cannot scope a graph. Agents reach an operational graph only through an allowlisted, parameterised query wrapper that injects the authenticated
tenant_id(andbusiness_instance_idfor business-instance-owned graphs) and the graph’s label predicates. The generic read-only Cypher tool is not granted for them. - Authorization (Qdrant): a collection-scoped credential (JWT
r/rwper collection) is issued to the declared writer workflow, and a read-only credential to readers. No agent holds a credential that spans an operational and amem_*collection. - Rebuild: from the source the domain pack declares for that collection, never from
memory_records. The embedding model, model version and dimension are part of the collection contract, as above. The pack declares them per collection alongside the source. - Readiness flags: where a pack gates reads on a readiness flag (for example Trading’s
scenario_vectors_ready:{version}), a rebuild clears the affected flags before wiping the collection and restores each only after all of that version’s points are committed. - Not recalled as memory: read by a bound domain tool, never through the recall contract.
The memory record envelope and Postgres-first write
Every governed memory record carries a structured envelope that mirrors the common event envelope so memory lineage and event lineage compose without translation.
| Field | Type | Required | Description |
|---|---|---|---|
memory_id | string (UUID) | Yes | Globally unique record identifier. Stable across supersession. |
tier | string | Yes | One of the eight tiers. |
scope | object | Yes | Ownership and visibility. tenant_id is mandatory and always first. |
content | object | Yes | The memory payload. Shape is tier-specific and, for domain tiers, pack-defined. |
content_hash | string | Yes | Hash of content, used for dedup and tombstone verification after erasure. |
provenance | object | Yes | What produced this record. source_event_id is mandatory. |
derived_from | array[string] | Yes | memory_ids this record was consolidated or reflected from. |
confidence | number (0–1) | Yes | Extraction or inference confidence. |
validity_interval | object | Yes | { valid_from, valid_until } (ISO 8601 UTC). |
supersedes | string | null | Yes | The memory_id this record replaces, or null. |
retention_class | string | Yes | One of: ephemeral, session, operational, durable, audit, regulated. |
compliance_labels | array[string] | No | Regulatory tags (e.g. pii, pci, gdpr-subject). |
version | string (SemVer) | Yes | Record schema version. |
Provenance
formation_method is one of extraction, declaration, consolidation, reflection, or import. A memory record with no provenance.source_event_id is non-compliant — there is no path by which memory enters the fabric without an event having caused it.
Postgres-first write rule
The graph tier adds a concrete write path for lineage. Lineage links are written to Postgres (agent_lineage_links) first, then synced to Neo4j as a fire-and-forget projection. Postgres is write-authoritative; the graph is never written directly from an agent node.
// Project one agent_lineage_links row from Postgres into Neo4j.
// Parameters: source_id, target_id, relation, tenant_id,
// correlation_id — NOT from causation_id alone.
MERGE (src:Outcome {outcome_id: $source_id})
ON CREATE SET src.tenant_id = $tenant_id
MERGE (tgt:Outcome {outcome_id: $target_id})
ON CREATE SET tgt.tenant_id = $tenant_id
SET tgt.correlation_id = coalesce($correlation_id, tgt.correlation_id)
// relation_type selection between four fixed patterns:
MERGE (src)-[r:`contributed-to`]->(tgt)
ON CREATE SET r.tenant_id = $tenant_idBecause both use MERGE, running the same projection twice (normal for a fire-and-forget async step) leaves the graph unchanged rather than duplicating nodes.
Lifecycle and state machine
Authority separation
| Stage | What happens | Who may trigger | Who commits | Event emitted |
|---|---|---|---|---|
| capture | Source event carries eligible content | Any workflow or agent | — | (the source event) |
| formation | Content becomes a raw record with full envelope | Any agent (proposal) | os-agt-010 | memory.record.formed |
| consolidation | Several records merge into one derived record | os-agt-011 (recommends) | os-agt-010 | memory.record.consolidated |
| reflection | Higher-order inference derived | os-agt-011 (recommends) | os-agt-010 | memory.reflection.completed |
| promotion | Record moves to a longer-lived tier | os-agt-011 or workflow | os-agt-010, gated by os-agt-012 | memory.record.promoted |
| recall | Record is read into agent context | Any agent, as a tool call | — (read) | memory.recall.* |
| decay | validity_interval expires | Scheduler | os-agt-010 | memory.record.expired |
| demotion | Tier or visibility is reduced | os-agt-011 | os-agt-010 | memory.record.demoted |
| erasure | Content destroyed; tombstone remains | Human or compliance | os-agt-010, approved by os-agt-002 | memory.record.forgotten |
Hot path stages: capture, formation proposal, recall. Background stages: formation commit, consolidation, reflection, decay, demotion. Erasure: out of band, approval-gated.
Promotion contract
No memory record crosses a tier boundary without a memory.record.promoted event carrying correlation_id and causation_id unchanged. Legal promotions include:
| From | To | Typical trigger | Gate |
|---|---|---|---|
working | episodic | Session handoff, run completion | os-agt-012 scope check |
episodic | semantic | Consolidation over ≥ N episodes | Confidence threshold + os-agt-012 |
episodic | procedural | Skill distillation | Confidence threshold + os-agt-012 |
episodic | profile | Reflection over subject episodes | os-agt-012 + consent labels |
semantic | relational | Assertion becomes canonical business state | os-agt-002 policy approval |
| any | any, with widened visibility | Session → agent → subject → tenant | os-agt-012 per step |
Promotions requiring policy approval: any promotion into relational, any widening beyond tenant visibility, any promotion of a record carrying regulated compliance labels, and any erasure. Threshold values (minimum episodes, minimum confidence) are business-instance configuration; the mechanism is OS-owned.
Erasure and the tombstone rule
Forgetting is an approved action that leaves a tombstone. When erasure is approved:
- Content is destroyed in the write-authoritative store and every projection.
- A tombstone is written retaining:
memory_id,tier,scope.tenant_id,content_hash,provenance,derived_from,validity_interval, the erasure approval reference, and the timestamp.consolidation_statebecomestombstoned. - Lineage edges in graph memory survive — the shape of what happened remains.
memory.record.forgottenis emitted.
A deletion must never silently punch a hole in the audit trail. Records with derived_from pointing at a tombstoned record are flagged for review by os-agt-011.
Retention classes
| Class | Decay behaviour | Erasable | Typical tiers |
|---|---|---|---|
ephemeral | TTL, hard expiry | n/a — expires | working |
session | Expires at session close unless promoted | Yes | working |
operational | Windowed retention, then aggregation | Yes | temporal, episodic |
durable | No automatic expiry; decays by supersession | Yes | semantic, procedural, profile |
audit | Never decays. Append-only. | Only via tombstone | episodic, graph |
regulated | Retention floor and ceiling by compliance | Mandatory at ceiling | any |
Layer 7 owns the retention mechanism; Layer 12 (business instance) owns the retention values.
NAMS binding for the graph tier
NAMS is adopted as a library over the existing self-hosted Neo4j, not as a platform. The hosted service is not permitted in any deployment mode.
Configuration
# Self-hosted bolt mode ONLY. Never set MEMORY_API_KEY — its presence
# switches the client to the hosted service.
settings = MemorySettings(
uri="bolt://neo4j:7687",
database="neo4j",
llm="openai/local-model",
embedding="openai/local-embed",
)| Setting | Rule |
|---|---|
| Transport | Bolt against the OS Neo4j. MEMORY_API_KEY must be unset. |
MEMORY_LLM / MEMORY_EMBEDDING | Via LiteLLM. In Mode 3 these must resolve to local URIs (Ollama / vLLM). |
| Multi-tenancy | user_identifier carries tenant_id. Never omit it. |
| Concurrency | Async-only; all calls are coroutines. |
| Version | Pin explicitly. NAMS is experimental with no SLA. |
What NAMS owns and does not
| NAMS capability | Position |
|---|---|
| Long-term knowledge graph (POLE+O entities) | Adopted |
Reasoning memory (AgentStep, ToolCall, :TOUCHED) | Adopted |
| Entity deduplication / consolidation | Adopted — invoked from os-agt-011, committed by os-agt-010 |
| Its own vector index | Scoped to entity resolution only. Qdrant is the single semantic substrate. |
| Short-term memory (conversations) | Not used. |
| MCP server | Governed by mcp_tool_policy. Not exposed by default. |
Neo4j Community Edition constraints
Three Community limits shape the binding:
| Limit | Consequence | How it is handled |
|---|---|---|
| Exactly one standard database | No per-tenant database isolation | Tenant separation by scope tuple + os-agt-012 |
| Only uniqueness constraints | POLE+O schema cannot enforce types at DB level | Envelope validation in os-agt-010 before commit |
| No online backup | Graph cannot be hot-backed-up | Neo4j projection is rebuilt, not restored |
Governance bridge
| Concern | Implementation |
|---|---|
| Scope | os-agt-012 intersects request scope with memory_profile.recall_scope, pushes into store query. Post-filtering is non-compliant. |
| Tool authorization | tool:memory-recall / tool:memory-propose bound only from resolved active_tool_set; otherwise agent.tool.unauthorized. |
| Commit authority | SynedrixMemoryStore.aput rejects direct writes. Only os-agt-010 commits durable memory. |
| Promotion | Every tier transition emits memory.record.promoted; policy-gated transitions additionally pass os-agt-002. |
| Erasure | adelete rejects. Erasure runs its own approval-gated workflow and leaves a tombstone; graph lineage survives. |
| Observability | Every recall opens a Langfuse span nested under the agent trace, recording tiers requested, tiers denied, record count, and scope applied. |
| Audit read-only | os-agt-008 is never bound as a memory tool. It queries the fabric; it is not invoked by it. |
Observability
| Signal | Source |
|---|---|
| Retrieval quality, groundedness | Existing metric families applied to tool:memory-recall results |
| Recall latency, records returned, tiers denied | Langfuse span attributes on the recall observation |
| Consolidation lag (capture → committed) | memory.record.formed → memory.record.consolidated timestamps |
| Memory growth rate, staleness | Aggregated in QuestDB from memory.* events |
| Promotion rejection rate | os-agt-012 denials over promotion attempts |
Deployment modes
Every tier must be satisfiable in Mode 3 (air-gapped). Nothing requires an external service.
| Concern | Mode 1 | Mode 2 | Mode 3 |
|---|---|---|---|
| Stores | All self-hosted | All self-hosted | All self-hosted |
| Extraction / inference | Cloud permitted | Per-agent split | Local only (Ollama / vLLM) |
| Embeddings for Qdrant | Cloud permitted | Per-agent split | Local only |
| NAMS | Self-hosted bolt | Same | Same. MEMORY_API_KEY unset. |
| NAMS hosted service | Not permitted in any mode | — | — |
Air-gapped invariant. An instance declared deployment_mode: air-gapped must not contain any memory control-plane configuration with a cloud model or embedding URI. This is a configuration validation error, not a warning.
Consolidation compute budget. In Mode 3, background consolidation and reflection compete with agent inference for local GPUs. The control plane must degrade by deferring background stages, never by skipping the governance path.
Compliance checklist
Before declaring a memory binding compliant:
-
SynedrixMemoryStoreimplements all fiveBaseStoremethods;aputandadeletereject. - Namespaces are
(tenant_id, tier, scope_id)withtenant_idfirst. - Scope is resolved by
os-agt-012and pushed into the store query before retrieval. -
tool:memory-recall/tool:memory-proposeare bound only from the resolvedactive_tool_set. - No agent other than
os-agt-010commits toepisodic,semantic,proceduralorprofile. - Every committed record has
provenance.source_event_id,derived_fromandvalidity_interval. - Every tier transition emits
memory.record.promotedwith the inheritedcorrelation_id. - Erasure leaves a tombstone; graph lineage survives;
content_hashis retained. - Recall results carry
provenanceandvalidity_interval. - Recall spans export to Langfuse; no LangSmith dependency.
- Checkpointer retention exceeds the longest approval timeout, and checkpoint stores are backed up.
- Qdrant
mem_*collections and the Neo4j fabric graph can be wiped and rebuilt from Supabase without behaviour change, and each operational store (ops_*collections and domain graphs) can be rebuilt from its declared source in the same drill. - NAMS runs in bolt mode;
MEMORY_API_KEYis unset; in Mode 3MEMORY_LLM/MEMORY_EMBEDDINGare local URIs. - The NAMS MCP server is governed by
mcp_tool_policy; the read-only Cypher tool is not exposed by default. -
os-agt-008is not bound as a memory tool.
Related pages
- Memory Fabric — Tier taxonomy, envelope, lifecycle, governance invariants (specification layer).
- Agent Runtime & Orchestration — The LangGraph and n8n runtime that invokes memory tools.
- Observability — Langfuse and PostHog integration for memory recall tracing.