ποΈ Memory Orders
Last Updated: February 14, 2026
Dual-memory coherence: drift detection, health aggregation, and sync planning between Archivarium (PostgreSQL) and Mnemosyne (Qdrant).
π― What it does
-
π Drift calculation: detects divergence between Postgres and Qdrant (counts/coverage drift)
-
π©Ί Health aggregation: produces an overall health snapshot from component signals
-
π§ Sync planning: outputs a plan of operations (insert/delete/clear) without executing it
-
βοΈ Epistemic layer: Truth (Memory & Coherence)
-
π‘οΈ Mandate: protect epistemic integrity of stored knowledge across two memory systems
-
π¦ Outputs:
CoherenceReport,SystemHealth,SyncPlan(planning-only)
π Charter (mandate + non-goals)
β Mandate
- monitor coherence (drift) between Postgres and Qdrant
- aggregate health across memory dependencies (datastores + bus + embedding service)
- produce sync plans (what to insert/delete/clear) without executing them
π« Non-goals
- no writes in LIVELLO 1 (no DB, no Qdrant, no StreamBus)
- no βRAG answer synthesisβ: Memory Orders does not generate final user answers
- no autonomous mutation by default: sync execution is delegated to a worker/service
π Interfaces
- HTTP (LIVELLO 2):
services/api_memory_orders/exposes/coherence,/sync,/health/* - Cognitive Bus (LIVELLO 2): adapters publish/consume
memory.*events (optional) - Governance thresholds: drift thresholds are configurable (env + frozen tuples)
π‘ Event contract (Cognitive Bus)
Defined in vitruvyan_core/core/governance/memory_orders/events/memory_events.py:
memory.coherence.requested/memory.coherence.checkedmemory.health.requested/memory.health.checkedmemory.sync.requested/memory.sync.completed/memory.sync.failedmemory.audit.recorded
π§© Code map
- LIVELLO 1 (pure, no I/O):
vitruvyan_core/core/governance/memory_orders/- Consumers:
consumers/coherence_analyzer.py,consumers/health_aggregator.py,consumers/sync_planner.py - Domain objects:
domain/memory_objects.py - Governance rules/thresholds:
governance/thresholds.py,governance/health_rules.py - Events:
events/memory_events.py
- Consumers:
- LIVELLO 2 (service + adapters + I/O):
services/api_memory_orders/- HTTP routes:
api/routes.py - Bus orchestration:
adapters/bus_adapter.py - Persistence:
adapters/persistence.py
- HTTP routes:
π Pipeline (happy path)
π Coherence check
POST /coherence(service) requests a coherence check- Adapter reads counts:
- Postgres records with
embedded=true - Qdrant points in target collection
- Postgres records with
- LIVELLO 1
CoherenceAnalyzer.process(CoherenceInput)returns aCoherenceReport - Service returns the report and may emit
memory.coherence.checked
π§ Sync planning
POST /syncrequests a sync plan (mode:incrementalorfull)- Adapter pulls source/target samples (bounded by
limit) - LIVELLO 1
SyncPlanner.process(SyncInput)returns aSyncPlan - Service returns the plan (execution is out-of-scope)
π€ Agents / Consumers (LIVELLO 1)
π CoherenceAnalyzer β drift calculation (counts β report)
- File:
vitruvyan_core/core/governance/memory_orders/consumers/coherence_analyzer.py - Input:
CoherenceInput(pg_count, qdrant_count, thresholds, table, collection) - Output:
CoherenceReport(status, drift_percentage, drift_absolute, recommendation, β¦)
How it works (important details):
drift_absolute = abs(pg_count - qdrant_count)drift_percentage = drift_absolute / max(pg_count, qdrant_count) * 100(edge case: both 0 β 0%)- threshold mapping:
< healthyβhealthy>= healthyand< warningβwarning>= warningβcritical
π©Ί HealthAggregator β component health (components β system health)
- File:
vitruvyan_core/core/governance/memory_orders/consumers/health_aggregator.py - Input: dict with
components: tuple[ComponentHealth, ...]and optionalsummary - Output:
SystemHealth(overall_status, components, summary, timestamp)
How it works (important details):
- overall status:
- any
unhealthyβcritical - else any
degradedβdegraded - else β
healthy
- any
π§ SyncPlanner β sync planning (data snapshots β operations)
- File:
vitruvyan_core/core/governance/memory_orders/consumers/sync_planner.py - Input:
SyncInput(pg_data, qdrant_data, mode, source_table, target_collection) - Output:
SyncPlan(operations, estimated_duration_s, mode)
How it works (important details):
mode="full":deleteplan to clear target collectioninsertplan for every Postgres record
mode="incremental":- inserts for ids missing in Qdrant
- deletes for orphaned ids in Qdrant
- duration estimate:
len(operations) * OPERATION_TIME_S(currently0.1sper op)
π Service (LIVELLO 2) β API surface
See the admin page: docs/internal/services/MEMORY_ORDERS_API.md.