oikos phase 0: ontology + inventory + policy seeds, OpenAPI contract, ADRs

- seeds/ontology.yaml: 59 entity types (5 abstract, is-a hierarchy), 46
  relationship types with cardinality, 6 lifecycles with terminal states
  and named precondition checks
- seeds/inventory.yaml: 110 entities / 142 relationships translated from
  legacy inventory.yaml (fleet, services, ingress, storage, governance,
  archaeology); thin spots marked for backfill
- seeds/policy.yaml: 4 risk classes, 27 approval rules (hierarchy-aware,
  per-entity overrides), autonomy kill-switch off (cold start)
- api/openapi.yaml: full v1 REST contract (40 paths), RFC 9457 errors,
  cursor pagination, idempotency, ETag/If-Match, scopes; redocly-clean
- docs/adr/0001-0010: initial architecture decision records
- scripts/validate-seeds.py: Phase 0 gate — hierarchy, lifecycles,
  endpoints, cardinality, policy cross-refs (0 errors)
- plan: layer CHECK gains 'meta' (root type), cardinality gains
  'many-to-one'

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 00:17:15 +02:00
parent ea3b2c3662
commit 18cb79caf9
18 changed files with 3741 additions and 3 deletions

View File

@@ -711,7 +711,8 @@ CREATE TABLE entity_types (
is_abstract BOOLEAN NOT NULL DEFAULT false, -- abstract types can't be instantiated
domain TEXT NOT NULL, -- 'physical','compute','network','storage',
-- 'software','identity','policy','cognition'
layer TEXT NOT NULL CHECK (layer IN ('infrastructure','governance','cognition')),
layer TEXT NOT NULL CHECK (layer IN ('meta','infrastructure','governance','cognition')),
-- 'meta' is reserved for the abstract root type 'entity'
description TEXT,
lifecycle_id TEXT REFERENCES lifecycle_defs(id),
attribute_schema JSONB, -- JSON Schema for entities.attributes (D2)
@@ -727,8 +728,8 @@ CREATE TABLE relationship_types (
inverse TEXT,
source_type TEXT NOT NULL REFERENCES entity_types(name), -- MAY be abstract;
target_type TEXT NOT NULL REFERENCES entity_types(name), -- validation walks hierarchy
cardinality TEXT NOT NULL CHECK (cardinality IN
('one-to-one','one-to-many','many-to-many')),
cardinality TEXT NOT NULL CHECK (cardinality IN -- source→target multiplicity
('one-to-one','one-to-many','many-to-one','many-to-many')),
description TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);