Skip to main content

Architecture Overview

The GRAFOMEM platform is five layers; the GMP protocol itself is layer-agnostic (it specifies semantics, not transport).

Core server layers

LayerResponsibility
1 · Network / MCP GatewayFastAPI app: routing, Bearer-token auth, tenant extraction, MCP (stdio + SSE) tool surface.
2 · Ingestion QueueAsync batch worker with backpressure; writes are enqueued and flushed in batches.
3 · StorageSQLiteGMPBackend — sentinel-encoded schema, composite B-tree indexes, WAL mode for concurrent reads.

Each layer maps to a module: src/aml/server/app.py, src/aml/server/ingestion.py, and the backends under src/aml/backends/.

Cloud governance layers

When Cloud mode is enabled (--cloud flag or CLOUD_MODE=1), four additional governance modules are mounted:

LayerModuleAPI PrefixPurpose
4 · Decision Trailsrc/aml/cloud/decision_trail.py/v1/decisions/Immutable inference audit log with Ed25519 provenance
5 · Erasure Proofsrc/aml/cloud/erasure_proof.py/v1/erasure/GDPR Article 17 signed erasure certificates
6 · Governance Gatewaysrc/aml/cloud/governance.py/v1/governance/Pre-execution policy engine (7 policy types, 4 actions)
7 · Regulatory Reportssrc/aml/cloud/regulatory.py/v1/reports/EU AI Act / GDPR / DORA compliance packages

Supporting services:

ServiceModulePurpose
Tenant Managersrc/aml/cloud/tenant.pyMulti-tenant isolation
Compliance Trackersrc/aml/cloud/compliance.pyGMP conformance tracking
Meteringsrc/aml/cloud/metering.pyUsage metering for billing
Portal Authsrc/aml/cloud/portal_auth.pyEmail/password signup + JWT sessions

Cryptographic primitives

All layers share a common provenance module (src/aml/provenance.py):

PrimitiveAlgorithmUsage
Content addressingBLAKE2b-128Fact IDs, decision IDs, certificate IDs
Corpus integrityBLAKE2b-256Report hashes, corpus manifests
SignaturesEd25519Decisions, erasure certificates, conformance reports

Module dependency graph

app.py (FastAPI)
/ | \
ingestion cloud/* backends/*
| | |
backends/* provenance.py |
| | |
wire.py wire.py wire.py

A backend does not need the server: any object implementing the MemoryBackend protocol is directly conformance-testable in-process.

For full Cloud Platform documentation, see Cloud Platform Overview.