// ============================================================================ // ProDG Mainframe — Registry-Driven Methodology :: graph schema // Target: Neo4j 5 Community + APOC // // Run order: // 1. schema.cypher (this file) — constraints, indexes, meta-registry // 2. seed.cypher (generated) — the actual entries, by tools/index-mainframe.py // 3. doctor.cypher (generated) — closed-world conformance queries // // Model in one line: every thing is an (:Entry) in exactly one (:Registry), // and every relationship between things is a (:Relation) fact with provenance. // // Apply: cypher-shell -f schema.cypher // ============================================================================ // ── 1. Identity ───────────────────────────────────────────────────────────── // Every entry is keyed by (registry, key). Two registries may both have // "postgres"; one registry may not have it twice. This is what makes the // registry authoritative rather than merely a list. CREATE CONSTRAINT entry_identity IF NOT EXISTS FOR (e:Entry) REQUIRE (e.registry, e.key) IS UNIQUE; CREATE CONSTRAINT registry_key IF NOT EXISTS FOR (r:Registry) REQUIRE r.key IS UNIQUE; CREATE CONSTRAINT relation_fact_id IF NOT EXISTS FOR (f:Relation) REQUIRE f.id IS UNIQUE; // ── 2. Lookup ─────────────────────────────────────────────────────────────── CREATE INDEX entry_name IF NOT EXISTS FOR (e:Entry) ON (e.name); CREATE INDEX entry_kind IF NOT EXISTS FOR (e:Entry) ON (e.kind); CREATE INDEX entry_status IF NOT EXISTS FOR (e:Entry) ON (e.status); CREATE INDEX entry_source IF NOT EXISTS FOR (e:Entry) ON (e.source); CREATE FULLTEXT INDEX entry_search IF NOT EXISTS FOR (e:Entry) ON EACH [e.name, e.summary, e.key]; // ── 3. The meta-registry ──────────────────────────────────────────────────── // A registry of registries. Each registry declares its own authority, its // required properties and its consumers — so the methodology is data, not // convention. Adding a registry is a data change, not a code change. UNWIND [ {key:'inference', name:'Inference Registry', authority:'platform', kind:'capability', summary:'Models, providers and routing reachable through the AI gateway.', required:['name','provider','modality','status'], consumers:['agent','docs','litellm']}, {key:'datasource', name:'Data Source Registry', authority:'platform', kind:'data', summary:'Every store the platform reads or writes, with its engine and residency.', required:['name','engine','class','residency'], consumers:['backup','doctor','isms']}, {key:'technology', name:'Technology Registry', authority:'platform', kind:'component', summary:'Software the platform runs, with version, license and pin.', required:['name','version','license'], consumers:['doctor','supplychain','isms']}, {key:'partner', name:'Partner Registry', authority:'commercial',kind:'party', summary:'External parties: vendors, customers, pilot companies, authorities.', required:['name','relationship','status'], consumers:['crm','legal']}, {key:'project', name:'Project Registry', authority:'delivery', kind:'work', summary:'Tracked workstreams and their owning component.', required:['name','stage'], consumers:['docs','roadmap']}, {key:'entity', name:'Entity Registry', authority:'identity', kind:'party', summary:'Resolved real-world entities — people, orgs, places — after entity resolution.', required:['name','entity_type'], consumers:['graph','crm']}, {key:'reference', name:'Reference Registry', authority:'knowledge', kind:'citation', summary:'External sources the platform cites: standards, papers, advisories, licences.', required:['name','ref_type'], consumers:['docs','isms']}, {key:'methodology', name:'Methodology Registry', authority:'knowledge', kind:'process', summary:'How the platform does things — the procedures that are meant to be followed.', required:['name','stage'], consumers:['docs','agent']}, {key:'strategy', name:'Strategy Registry', authority:'governance',kind:'intent', summary:'Declared intent: objectives, positions, the governing objective itself.', required:['name','horizon'], consumers:['pack','roadmap','governance']}, {key:'node', name:'Node Registry', authority:'platform', kind:'infrastructure', summary:'Machines and cluster members: VPS, tailnet peers, k8s nodes.', required:['name','role','reachable'], consumers:['doctor','mesh','k8s']}, {key:'service', name:'Service Registry', authority:'platform', kind:'component', summary:'Operational services: container, port, subdomain, owning project, healthcheck.', required:['name','state','exposure'], consumers:['doctor','caddy','monitoring']}, {key:'decision', name:'Decision Registry', authority:'governance',kind:'intent', summary:'Binding decisions with their consequence, so intent is queryable, not just written.', required:['name','decided_by','status'], consumers:['pack','governance']}, {key:'interface', name:'Interface Registry', authority:'platform', kind:'surface', summary:'Every surface a human or agent reaches the platform through: web apps, APIs, chat, mobile, MCP. Each carries a track - adopt_and_run, or study_and_rewrite with the spec to reimplement from.', required:['name','url'], consumers:['docs','caddy','onboarding','rewrite-track']}, {key:'agent', name:'Agent Registry', authority:'platform', kind:'actor', summary:'Every agent that can act on the platform, its role, runtime and skills.', required:['name','role'], consumers:['governance','control-room','blastradius']}, {key:'loadout', name:'Loadout Registry', authority:'platform', kind:'composition', summary:'Named, versioned bundles of services provisioned onto a node as one unit.', required:['name','version'], consumers:['fleet','provisioning','roadmap']}, {key:'device', name:'Device Registry', authority:'platform', kind:'infrastructure', summary:'Devices exposing capability-scoped JSON endpoints, identified by tailnet identity.', required:['name','device_type'], consumers:['mesh','device-api']}, {key:'primitive', name:'Primitive Registry', authority:'governance',kind:'verb', summary:'Atomic parameterised actions with declared approval, reversibility and evidence. The vocabulary playbooks are written in.', required:['name','intent'], consumers:['playbook','governance','control-room']}, {key:'playbook', name:'Playbook Registry', authority:'governance',kind:'procedure', summary:'Scenarios composed from primitives as data, so a new scenario is a composition rather than a document.', required:['name','class'], consumers:['incident','drills','onboarding','governance']}, {key:'adoption', name:'Adoption Registry', authority:'governance',kind:'decision', summary:'Build-vs-borrow decisions: every third-party component run or declined, with licence, language, sovereignty and verdict. Each entry carries a track - adopt_and_run (licence is a gate) or study_and_rewrite (licence is provenance; spec_to_mine and clean_room are required).', required:['name','verdict','licence'], consumers:['procurement','security-review','roadmap','rewrite-track']}, {key:'external-dependency', name:'External Dependency Register', authority:'governance',kind:'decision', summary:'The declared egress surface required by self-sovereign architecture (SSA-2): every outbound service, with a justification and an exit path. An undeclared dependency is worse than a documented one.', required:['name','kind','endpoint'], consumers:['security-review','architecture','audit']} ] AS r MERGE (reg:Registry {key: r.key}) SET reg.name = r.name, reg.authority = r.authority, reg.kind = r.kind, reg.summary = r.summary, reg.required = r.required, reg.consumers = r.consumers, reg.updated = datetime(); // ── 4. Registry membership ────────────────────────────────────────────────── // A registry node also carries :Entry, so the closed-world check ("is this // thing registered?") is a single label lookup and the meta-registry is // self-describing. MATCH (r:Registry) SET r:Entry, r.registry = '_meta', r.key = r.key; MATCH (r:Registry), (reg:Registry {key: r.key}) WHERE r.key = reg.key MERGE (r)-[:IN_REGISTRY]->(reg); // ── 5. Prohibitions (enforced by convention + doctor, not by the DB) ──────── // Community edition has no RBAC or sub-graph access control. Until the // Enterprise decision (see the methodology doc §Licensing), write control is // by convention: exactly one writer per registry, declared above as `authority`. // The doctor query `unregistered_writer` surfaces violations. // ── 6. Seed the governing objective as the root strategy ──────────────────── MERGE (s:Entry:Strategy {registry:'strategy', key:'governing-objective'}) SET s.name = 'Governing objective', s.summary = 'Secure and compliant enough for the most sensitive high-risk environments — banks, governments, defence — with governance provisions that withstand the most complex regulatory environment.', s.horizon = 'now', s.status = 'active', s.source = 'founder:2026-10-05', s.updated = datetime(); MATCH (s:Entry {registry:'strategy', key:'governing-objective'}) MATCH (reg:Registry {key:'strategy'}) MERGE (s)-[:IN_REGISTRY]->(reg);