Skip to main content

System Diagram

Multi-Repo Structure

Dependency Flow

Database Layer

Z3rno uses PostgreSQL 17 as its single data store, extended with:
  • pgvector — 1536-dimensional embeddings with HNSW indexing for fast ANN search
  • Apache AGE — Cypher-based graph queries for relationship traversal between memories
  • pg_cron — Background jobs for TTL expiration, importance decay, and maintenance

Schema Highlights

Key Design Decisions

Row-Level Security for Multi-Tenancy

Every query is scoped to a tenant_id via PostgreSQL RLS policies. Tenants cannot access each other’s data even with raw SQL access:
Chosen over IVFFlat for its superior recall at low latency. No training step required — indexes update incrementally as memories are stored.

SCD Type 2 for Temporal Versioning

Memories are never overwritten. Updates create new versions with valid_from/valid_to timestamps, enabling point-in-time recall:

Soft Delete + GDPR Hard Delete

Default deletion sets deleted_at (recoverable). GDPR erasure permanently removes data including embeddings and audit references.

Authentication Flow

API keys are hashed (SHA-256) before storage. Each key maps to exactly one tenant.