Skip to main content

grafomem serve

grafomem serve -e bge --auth token --db ./grafomem.db # SQLite, port 8642
FlagMeaning
--host, --port / -pbind address and port (default 0.0.0.0:8642)
-b {sqlite,postgres}backend shortcut, or a MODULE:CLASS path (default: SQLite)
--db PATH | URLSQLite path, or a PostgreSQL URL with -b postgres
-e {stub,bge}embedder: deterministic stub or BGE embeddings (grafomem[backends]; default bge)
--auth {none,token}Bearer-token auth for SQLite servers (auth); PostgreSQL servers use API keys from the tenants table
--mcp {stdio,sse}expose the MCP tool surface (MCP); --mcp-port for SSE (default 8643)
--tenant IDMCP mode: the one tenant this process acts for (env GRAFOMEM_MCP_TENANT); required
--batch, --batch-sizebatched ingestion (ingestion)

Run grafomem serve --help for the full list for your version.

Cloud mode​

The Cloud layer mounts whenever the server runs on the PostgreSQL backend — there is no separate flag:

grafomem serve -b postgres --db postgresql://user:pass@host/grafomem

This enables:

  • Decision Trail — inference audit log (/v1/decisions/)
  • Erasure Proof — signed certificates + hash-chained ledger (/v1/erasure/)
  • Governance Gateway — policy engine (/v1/governance/)
  • Regulatory Reports — evidence packages (/v1/reports/)
  • Cloud management (/v1/cloud/), Portal auth (/v1/portal/), billing, metering

All Cloud services require PostgreSQL (grafomem[cloud], psycopg v3). Schema migrations run as a pre-deploy step (python -m aml.cloud.migrations_runner --ensure-schema); the runtime role does not run DDL.

Environment variables that matter in Cloud mode:

VariablePurpose
GRAFOMEM_MASTER_KEYtenant key management (required)
ERASURE_SIGNING_KEY / GRAFOMEM_SIGNING_KEYEd25519 seed for signing decisions and erasure certificates; without it, records are unsigned
GRAFOMEM_LEDGER_URLPostgreSQL URL for the erasure ledger role (defaults to the main database)
GRAFOMEM_API_KEY_PEPPERAPI-key hashing