From 7d2e616d6eaebb011ddfefeb40d9db2df3909696 Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Tue, 28 Apr 2026 07:34:32 -0400 Subject: [PATCH 1/4] Trigger P0 GAIA contract fixture verification --- fixtures/verification/p0-gaia-contract-fixtures.trigger.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 fixtures/verification/p0-gaia-contract-fixtures.trigger.json diff --git a/fixtures/verification/p0-gaia-contract-fixtures.trigger.json b/fixtures/verification/p0-gaia-contract-fixtures.trigger.json new file mode 100644 index 0000000..d69a5c8 --- /dev/null +++ b/fixtures/verification/p0-gaia-contract-fixtures.trigger.json @@ -0,0 +1,5 @@ +{ + "verification": "p0-gaia-contract-fixtures", + "purpose": "Trigger PR-scoped Contract Fixtures workflow for chat-visible P0 verification.", + "non_product_artifact": true +} From 66b50aaaa7c622d52b4b0336d6e88f92445c1692 Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Wed, 6 May 2026 01:16:52 -0400 Subject: [PATCH 2/4] Add GAIA PAIRS-like layer governance ADR --- .../ADR-0002-pairs-like-layer-governance.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/decisions/ADR-0002-pairs-like-layer-governance.md diff --git a/docs/decisions/ADR-0002-pairs-like-layer-governance.md b/docs/decisions/ADR-0002-pairs-like-layer-governance.md new file mode 100644 index 0000000..3e522cd --- /dev/null +++ b/docs/decisions/ADR-0002-pairs-like-layer-governance.md @@ -0,0 +1,40 @@ +# ADR-0002: GAIA PAIRS-like Layer Governance + +Status: Proposed + +## Context + +GAIA already defines the repository spine for responsible Earth digital twinning: Curation Vault provenance, canonical ontology entrypoints, validation, declarative actions, generated reports, registry contracts, Workflow IR, and assessment scorecards. The PAIRS-like platform pattern we want to adopt is therefore not a new repository estate. It is a GAIA profile for spatiotemporal layers, generated operational artifacts, policy-aware query contracts, and auditable event envelopes. + +The operating failure mode we are avoiding is the hybrid memo becoming the operational database: a hand-authored document that mixes links, people, work items, client or domain context, dates, policy claims, and cost/usage fragments without machine-checkable provenance or classification. GAIA should make those artifacts generated views over structured records. + +## Decision + +Land the PAIRS-like layer/query/governance work inside `SocioProphet/gaia-world-model` as contracts, schemas, examples, report templates, and validation hooks. Do not create new repositories for `gaia-contracts`, `gaia-catalog`, `gaia-ledger`, `socioprophet-runsheet`, `socioprophet-query-plane`, or `socioprophet-policy-pdp` until the contracts prove that a runtime split is required. + +## Consequences + +- GAIA remains the semantic and provenance home for world-model layers. +- The Curation Vault remains the provenance/capture home for sources, manifests, hashes, and inventory. +- The Registry Contract remains the discovery/composition contract and is extended by identifier, event, classification, RunSheet, and layer-query profiles. +- Workflow IR remains the execution-shape home for ingest, normalize, register, evaluate policy, query, and report workflows. +- Reports become generated evidence artifacts with schemas and manifests rather than hand-maintained authority. + +## Non-goals + +- No production query service is introduced by this ADR. +- No new repository is created by this ADR. +- No claim is made that GAIA is a complete Earth simulator today. +- No network ingestion or external data fetch is required by the initial contract package. + +## Initial implementation package + +- `docs/contracts/IDENTIFIER_PROFILE.md` +- `docs/contracts/EVENT_ENVELOPE.md` +- `docs/contracts/SPATIOTEMPORAL_LAYER_QUERY.md` +- `docs/contracts/RUNSHEET_CONTRACT.md` +- `docs/policy/CLASSIFICATION_PROFILE.md` +- `schemas/jsonschema/**` +- `examples/**` +- `gaia/reports/templates/runsheet.v1.md` +- `scripts/validate_gaia_contract_examples.py` From 4a5ee4b44342d1f86b1e6bb878ab3e4c007e2120 Mon Sep 17 00:00:00 2001 From: mdheller <21163552+mdheller@users.noreply.github.com> Date: Wed, 6 May 2026 01:17:07 -0400 Subject: [PATCH 3/4] Add GAIA identifier profile contract --- docs/contracts/IDENTIFIER_PROFILE.md | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 docs/contracts/IDENTIFIER_PROFILE.md diff --git a/docs/contracts/IDENTIFIER_PROFILE.md b/docs/contracts/IDENTIFIER_PROFILE.md new file mode 100644 index 0000000..2174f50 --- /dev/null +++ b/docs/contracts/IDENTIFIER_PROFILE.md @@ -0,0 +1,39 @@ +# GAIA Identifier Profile v1 + +This profile narrows the existing registry `id` concept into stable identifiers used by GAIA layer, event, policy, workflow, and generated-report artifacts. + +## Purpose + +The profile exists so that GAIA artifacts can be joined without relying on prose, filenames, spreadsheet rows, or manually copied URLs. Every generated report, workflow run, layer query, and policy decision should carry identifiers that are stable, namespaced, and machine-checkable. + +## Identifier rules + +- Identifiers MUST be stable once published. +- Identifiers MUST be namespaced by domain or artifact family. +- Identifiers SHOULD be lowercase. +- Identifiers SHOULD use UUIDv7, ULID, or a deterministic content hash where time ordering or reproducibility matters. +- Identifiers MUST NOT encode secrets, credentials, access tokens, or private personal data. +- Identifiers MAY include human-readable prefixes when this improves reviewability. + +## Canonical fields + +| Field | Meaning | Example namespace | +|---|---|---| +| `artifact_ref` | Stable pointer to a generated artifact or manifest bundle | `gaia:artifact:` | +| `dataset_id` | Stable dataset identity independent of a specific version | `gaia:dataset:` | +| `layer_id` | Stable spatiotemporal layer identity | `gaia:layer:` | +| `layer_version_id` | Versioned layer artifact or manifest | `gaia:layer-version:` | +| `event_id` | Immutable event-envelope identity | `gaia:event:` | +| `run_id` | Workflow/action/query run identity | `gaia:run:` | +| `policy_id` | Policy or policy profile identity | `gaia:policy:` | +| `policy_decision_ref` | Audit pointer to a policy decision | `gaia:policy-decision:` | +| `work_item_id` | Work item, issue, request, or task identity | `gaia:work-item:` | +| `engagement_id` | Operational engagement or bounded collaboration identity | `gaia:engagement:` | + +## Relationship to existing registry contract + +This profile does not replace the Registry Contract. It specializes the `id`, `version`, `content_hash`, `origin`, `lineage`, `policy`, and `attestations` fields for GAIA-generated artifacts and PAIRS-like spatiotemporal layer workflows. + +## Validation posture + +Each identifier-bearing example SHOULD validate against `schemas/jsonschema/core/identifier-profile.v1.schema.json` directly or through a higher-level schema that imports the same field constraints. From 30c68cefa7d8ba4a8617a731576e063ac911ad96 Mon Sep 17 00:00:00 2001 From: Michael Heller <21163552+mdheller@users.noreply.github.com> Date: Tue, 30 Jun 2026 01:10:34 -0400 Subject: [PATCH 4/4] =?UTF-8?q?wip(muster):=20smart-economy=20domain=20(SM?= =?UTF-8?q?ART=5FECONOMY=5FDOMAIN,=20economy=20fixtures+schemas,=20validat?= =?UTF-8?q?or)=20=E2=80=94=20preserve=20[20260630]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/DOMAIN_MATRIX.md | 15 ++ docs/SMART_ECONOMY_DOMAIN.md | 127 ++++++++++ .../action-intent.policy-audit.v1.json | 24 ++ .../economy-network-topology.sample.v1.json | 60 +++++ .../economy-observation.sample.v1.json | 69 +++++ ...omy-observation.broken-ep-identity.v1.json | 46 ++++ .../policy-decision.policy-audit.v1.json | 11 + .../economy_network_topology.v1.schema.json | 95 +++++++ .../economy_observation.v1.schema.json | 102 ++++++++ scripts/validate_economy_fixtures.py | 236 ++++++++++++++++++ 10 files changed, 785 insertions(+) create mode 100644 docs/SMART_ECONOMY_DOMAIN.md create mode 100644 fixtures/economy/action-intent.policy-audit.v1.json create mode 100644 fixtures/economy/economy-network-topology.sample.v1.json create mode 100644 fixtures/economy/economy-observation.sample.v1.json create mode 100644 fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json create mode 100644 fixtures/economy/policy-decision.policy-audit.v1.json create mode 100644 schemas/economy/economy_network_topology.v1.schema.json create mode 100644 schemas/economy/economy_observation.v1.schema.json create mode 100644 scripts/validate_economy_fixtures.py diff --git a/docs/DOMAIN_MATRIX.md b/docs/DOMAIN_MATRIX.md index ef99970..f498eeb 100644 --- a/docs/DOMAIN_MATRIX.md +++ b/docs/DOMAIN_MATRIX.md @@ -14,3 +14,18 @@ | warehouse-logistics | pallets, docks, robots, shipments | observe / plan / actuate | draft | | farm-watershed | fields, soil, irrigation, forecast | observe / plan / actuate | draft | | hospital-clinic | rooms, devices, protocols, orders | observe / plan / actuate | draft | +| smart-economy | legal entities, lines of business, relationships, accounts, instruments | observe / audit / plan / actuate | draft | + +## smart-economy domain + +The `smart-economy` domain is GAIA's first non-geospatial domain. It does not +define its own economics — it **binds GAIA to the Economic Prophet framework** +(`SocioProphet/economic-prophet`), the canonical economic engine for the stack. + +- Value: **Economic Profit (EP)** — UVMC's canonical additive value measure. +- Measurement: Economic Prophet **UVMC measurement context** (period/scenario/model/lineage). +- Law/policy: Economic Prophet **policy simulation** (law modeled as friction on flows). +- GAIA contributes the world-model envelope, provenance, governance, and geo binding. + +See `docs/SMART_ECONOMY_DOMAIN.md` for the full design, the founding-notes mapping, +and source provenance. diff --git a/docs/SMART_ECONOMY_DOMAIN.md b/docs/SMART_ECONOMY_DOMAIN.md new file mode 100644 index 0000000..0fa92f9 --- /dev/null +++ b/docs/SMART_ECONOMY_DOMAIN.md @@ -0,0 +1,127 @@ +# smart-economy domain + +The `smart-economy` domain is GAIA's first non-geospatial domain. It does **not** +define its own economics — it **binds GAIA's world model to the Economic Prophet +framework** (`SocioProphet/economic-prophet`), which is the canonical economic +engine for the SocioProphet stack. GAIA supplies the world-model envelope, +provenance, and Earth/geo binding; Economic Prophet supplies value, profitability, +and policy simulation. + +It plugs into the standard GAIA pipeline: + +**CV (sources) → canonical ontology → validation → actions (observe/audit/plan/actuate) → reports** + +## Why bind, not reinvent + +An earlier draft of this domain introduced a parallel `value_model_record` +(`V = N + L + C`). That was withdrawn: Economic Prophet already formalizes the +same economics, and the SocioProphet stack standardizes on it. The founding +world-model design notes map onto Economic Prophet constructs as follows. + +| Founding notes (`drive-download-20260510T173010Z-3-001`) | Economic Prophet construct | +|---|---| +| `V = N + L + C` value algebra; "value" | **Economic Profit (EP)** — UVMC's canonical additive value measure (`ep_output.schema.json`) | +| Compositional `V = N(L)+L(C)+N(L(C))`, factor partitions | EP components + **UVMC** dimensions / industry overlays / KPI trees | +| Law as a friction operator on flows | **policy_simulation_profile** (actors, planner, reward functionals, triparty faces) | +| "All stats/models public"; open logic engine; provenance | **UVMC lineage** (`input_hash`/`output_hash`) + `uvmc_calculation_receipt` + policy `donor_corpus` license/attribution | +| Census/tax/demographics, demand, barriers | UVMC measured entities + governed `uvmc_dimension` reference records | +| `g2.gif` evidence decision tree | A declarative `audit` action over a `policy_simulation_profile` | + +## Canonical value identity + +Economic Profit is the additive backbone (UVMC design rule 1): + +``` +economic_profit = revenue - expected_loss - expense + - funding_costs + funding_credits - taxes - capital_charge +``` + +The bundled sample uses Economic Prophet's own synthetic numbers +(`examples/lineage_ep_output.json`): `1000 - 100 - 50 - 200 + 10 - 40 - 496.55 = 123.45`. +The validator enforces this identity and rejects the negative fixture +(`economic_profit = 999.99`). + +> The founding notes' conserved-residual sketch `r = n mod M` has no native +> Economic Prophet counterpart and was **not** carried into the schema; the EP +> additive identity is the real conservation law. The `r = n mod M` idea is +> preserved only in the founding-notes synthesis as an open question for the model +> author (see Open gaps). + +## Record shape + +A `EconomyObservation` (`schemas/economy/economy_observation.v1.schema.json`) is a +GAIA envelope wrapping Economic Prophet outputs: + +- `economic_prophet.ep_output` — conforms to economic-prophet `ep_output.schema.json`. +- `economic_prophet.measurement_context` — conforms to economic-prophet + `uvmc_measurement_context.schema.json` (object/period/scenario/model/parameter/ + formula + lineage). +- `economic_prophet.policy_simulation_profile_ref` — optional link to the law/policy layer. +- Standard GAIA `source` / `provenance` / `governance` / `classification`. + +## Law-as-action (policy audit) + +The `g2.gif` evidence-admissibility decision tree is realized as a GAIA `audit` +action over an Economic Prophet `policy_simulation_profile`: + +- `fixtures/economy/action-intent.policy-audit.v1.json` — a GAIA `ActionIntent` + (`verb=audit`) whose `constraints.decision_steps` encode the admissibility tree + (relevance → hearsay → opinion → tendency → credibility → identification → + privilege → discretionary-exclusion). +- `fixtures/economy/policy-decision.policy-audit.v1.json` — the resulting GAIA + `PolicyDecision` (`review`), citing the profile, its audit receipt, the triparty + face, and the audit action as `evidence_refs`. + +Law is thus a friction operator: the audit never self-releases when the triparty +face residual sits above threshold and the reward functional is advisory-only. + +## Network-of-networks topology + +The founding notes' coupled networks are schematized in +`schemas/economy/economy_network_topology.v1.schema.json`: + +- `networks` — the eight founding-notes networks (resource, distribution, labor, + capital, political, information, time, geographic). +- `nodes` — each binds to an Economic Prophet `economic_object_type` + `object_ref` + (and, for geographic nodes, a GAIA `geo_ref`); the political network's + `friction_model` points at a `policy_simulation_profile`. +- `edges` — typed flows (value, labor, capital, authority, location). + +The sample (`fixtures/economy/economy-network-topology.sample.v1.json`) is derived +from Economic Prophet's `examples/object_graph.json` (entity → line-of-business → +relationship → account → instrument) plus the political and geographic bindings. + +## Artifacts in this domain + +- `docs/DOMAIN_MATRIX.md` — `smart-economy` row + summary. +- `schemas/economy/economy_observation.v1.schema.json` — EP/UVMC binding schema. +- `schemas/economy/economy_network_topology.v1.schema.json` — network-of-networks schema. +- `fixtures/economy/economy-observation.sample.v1.json` — positive observation fixture. +- `fixtures/economy/economy-network-topology.sample.v1.json` — topology fixture. +- `fixtures/economy/action-intent.policy-audit.v1.json` + `…/policy-decision.policy-audit.v1.json` — law-as-action. +- `fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json` — negative fixture. +- `scripts/validate_economy_fixtures.py` — validator (EP identity + UVMC context + topology + referential integrity + policy-audit; cross-validates against a sibling + `economic-prophet` checkout when present). + +Run validation: + +```bash +python3 scripts/validate_economy_fixtures.py +``` + +## Open gaps (carried from the founding-notes synthesis) + +- **No growth/rate dynamics in GAIA's binding.** Economic Prophet is period/horizon + aware (EP per period, cadence), so time-evolution lives there; GAIA currently + records point-in-time observations and does not yet drive a multi-period roll-up. +- **Network-of-networks topology not yet schematized.** The founding notes' resource/ + distribution/labor/capital/political/information networks map to Economic Prophet's + object graph + UVMC dimensions, but GAIA has no topology record yet. +- **policy_simulation binding is by-reference only.** The law-as-friction layer is + linked, not embedded; a GAIA action template over `policy_simulation_profile` + (the `g2.gif` pattern) is the next artifact. +- **CV ingestion of real calibration data** (census/tax/land-sales) is not wired; the + sample fixture reuses Economic Prophet's synthetic example. +- **Conserved-quantity `r = n mod M`** from the notes is unmapped by design pending + author intent. diff --git a/fixtures/economy/action-intent.policy-audit.v1.json b/fixtures/economy/action-intent.policy-audit.v1.json new file mode 100644 index 0000000..8b8e229 --- /dev/null +++ b/fixtures/economy/action-intent.policy-audit.v1.json @@ -0,0 +1,24 @@ +{ + "id": "act:economy-policy-audit-0001", + "actor": "agent:economy-policy-auditor", + "verb": "audit", + "target": "economic-prophet:policy_simulation_profile:policy-sim-source-intake-001", + "constraints": { + "mode": "bounded", + "requires_review": true, + "framework_ref": "SocioProphet/economic-prophet@main", + "decision_procedure": "evidence-admissibility-decision-tree", + "decision_steps": [ + "relevance", + "hearsay", + "opinion", + "tendency-coincidence", + "credibility", + "identification", + "privilege", + "discretionary-exclusion" + ], + "reward_functional_ref": "ep-plus-release-quality", + "release_authority": "advisory_only" + } +} diff --git a/fixtures/economy/economy-network-topology.sample.v1.json b/fixtures/economy/economy-network-topology.sample.v1.json new file mode 100644 index 0000000..9ade952 --- /dev/null +++ b/fixtures/economy/economy-network-topology.sample.v1.json @@ -0,0 +1,60 @@ +{ + "record_version": "v1", + "record_type": "EconomyNetworkTopology", + "record_id": "gaia:economy:network-topology:synthetic-bank-holdco:v1", + "standards_refs": [ + "SocioProphet/gaia-world-model/docs/SMART_ECONOMY_DOMAIN.md", + "SocioProphet/economic-prophet/schemas/canonical_object.schema.json", + "SocioProphet/economic-prophet/schemas/policy_simulation_profile.schema.json" + ], + "networks": [ + {"network_id": "net-capital", "network_kind": "capital", "description": "Committed/liquid capital flows across the object graph."}, + {"network_id": "net-labor", "network_kind": "labor", "description": "Labor/life network supplying the value function L."}, + {"network_id": "net-resource", "network_kind": "resource", "description": "Land/resource network (Nature), demand/supply with legal/illegal frictions."}, + {"network_id": "net-distribution", "network_kind": "distribution", "description": "Distribution network with boundary-condition frictions."}, + {"network_id": "net-political", "network_kind": "political", "description": "Law/policy network; law modeled as friction on flows.", "friction_model": "economic-prophet:policy_simulation_profile:policy-sim-source-intake-001"}, + {"network_id": "net-information", "network_kind": "information", "description": "Information/communication network."}, + {"network_id": "net-time", "network_kind": "time", "description": "Time network: process/investment/travel/life horizons."}, + {"network_id": "net-geographic", "network_kind": "geographic", "description": "Geo-tag network binding economic nodes to GAIA Earth geometry."} + ], + "nodes": [ + {"node_id": "n-entity", "network_id": "net-capital", "economic_object_type": "legal_entity", "object_ref": "entity-bank-holdco"}, + {"node_id": "n-lob", "network_id": "net-capital", "economic_object_type": "line_of_business", "object_ref": "commercial-banking"}, + {"node_id": "n-rel", "network_id": "net-capital", "economic_object_type": "relationship", "object_ref": "rel-synthetic-001"}, + {"node_id": "n-account", "network_id": "net-capital", "economic_object_type": "account", "object_ref": "account-credit-001"}, + {"node_id": "n-instrument", "network_id": "net-capital", "economic_object_type": "instrument", "object_ref": "instrument-loan-001"}, + {"node_id": "n-labor-pool", "network_id": "net-labor", "economic_object_type": "other", "object_ref": "labor-pool-synthetic-001"}, + {"node_id": "n-policy-face", "network_id": "net-political", "economic_object_type": "triparty_face", "object_ref": "participant-planner-clearing-face"}, + {"node_id": "n-geo-site", "network_id": "net-geographic", "economic_object_type": "other", "geo_ref": "gaia:geo:site:synthetic-001"} + ], + "edges": [ + {"edge_id": "e-entity-lob", "from_node": "n-entity", "to_node": "n-lob", "flow_type": "capital", "network_id": "net-capital"}, + {"edge_id": "e-lob-rel", "from_node": "n-lob", "to_node": "n-rel", "flow_type": "capital", "network_id": "net-capital"}, + {"edge_id": "e-rel-account", "from_node": "n-rel", "to_node": "n-account", "flow_type": "capital", "network_id": "net-capital"}, + {"edge_id": "e-account-instrument", "from_node": "n-account", "to_node": "n-instrument", "flow_type": "value", "network_id": "net-capital"}, + {"edge_id": "e-labor-instrument", "from_node": "n-labor-pool", "to_node": "n-instrument", "flow_type": "labor", "network_id": "net-labor"}, + {"edge_id": "e-policy-instrument", "from_node": "n-policy-face", "to_node": "n-instrument", "flow_type": "authority", "network_id": "net-political"}, + {"edge_id": "e-geo-entity", "from_node": "n-geo-site", "to_node": "n-entity", "flow_type": "location", "network_id": "net-geographic"} + ], + "source": { + "source_id": "economic-prophet-object-graph", + "source_type": "EconomicProphetObjectGraph", + "license_ref": "internal-design-record", + "access_tier": "internal" + }, + "provenance": { + "chain": ["fixture:generated"], + "derived_from": ["SocioProphet/economic-prophet:examples/object_graph.json", "drive-download-20260510T173010Z-3-001:IMG_2747,IMG_2754"], + "runtime_boundary_id": "runtime:economy-network-topology:v0" + }, + "governance": { + "privacy_tier": "internal", + "safety_tier": "standard", + "retention_tier": "sample", + "redistribution": "restricted" + }, + "classification": { + "security_marking": "internal_sample", + "sensitive_geo_policy_ref": "policy:sensitive-geo:not-applicable-non-geospatial" + } +} diff --git a/fixtures/economy/economy-observation.sample.v1.json b/fixtures/economy/economy-observation.sample.v1.json new file mode 100644 index 0000000..b8ccbf2 --- /dev/null +++ b/fixtures/economy/economy-observation.sample.v1.json @@ -0,0 +1,69 @@ +{ + "record_version": "v1", + "record_type": "EconomyObservation", + "record_id": "gaia:economy:observation:instrument-loan-001:2026-04-24", + "standards_refs": [ + "SocioProphet/gaia-world-model/docs/SMART_ECONOMY_DOMAIN.md", + "SocioProphet/economic-prophet/schemas/ep_output.schema.json", + "SocioProphet/economic-prophet/schemas/uvmc_measurement_context.schema.json", + "SocioProphet/economic-prophet/docs/unified_value_measurement_calculus.md" + ], + "economic_prophet": { + "framework_ref": "SocioProphet/economic-prophet@main", + "ep_output": { + "object_id": "instrument-loan-001", + "as_of": "2026-04-24T00:00:00Z", + "horizon": "1Y", + "economic_profit": 123.45, + "components": { + "revenue": 1000.0, + "expected_loss": 100.0, + "expense": 50.0, + "funding_costs": 200.0, + "funding_credits": 10.0, + "taxes": 40.0, + "capital_charge": 496.55 + } + }, + "measurement_context": { + "measurement_context_id": "uvmc:ctx:instrument-loan-001:2026-04-24:base", + "object_id": "instrument-loan-001", + "object_type": "instrument", + "as_of": "2026-04-24T00:00:00Z", + "period_id": "2026-Q2", + "horizon": "1Y", + "scenario_id": "baseline", + "model_version": "ep-core-0.1", + "parameter_set": "default", + "formula_version": "uvmc-0.1", + "cadence": "daily", + "source_system": "synthetic-core-banking", + "lineage": { + "parent_chain": ["account-credit-001", "rel-synthetic-001", "commercial-banking", "entity-bank-holdco"], + "type_chain": ["instrument", "account", "relationship", "line_of_business", "legal_entity"] + } + }, + "policy_simulation_profile_ref": "economic-prophet:policy_simulation_profile:not-applicable-baseline" + }, + "source": { + "source_id": "economic-prophet-synthetic-run", + "source_type": "EconomicProphetEP", + "license_ref": "internal-design-record", + "access_tier": "internal" + }, + "provenance": { + "chain": ["fixture:generated"], + "derived_from": ["SocioProphet/economic-prophet:examples/lineage_ep_output.json"], + "runtime_boundary_id": "runtime:economic-prophet:ep:v0" + }, + "governance": { + "privacy_tier": "internal", + "safety_tier": "standard", + "retention_tier": "sample", + "redistribution": "restricted" + }, + "classification": { + "security_marking": "internal_sample", + "sensitive_geo_policy_ref": "policy:sensitive-geo:not-applicable-non-geospatial" + } +} diff --git a/fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json b/fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json new file mode 100644 index 0000000..75e718e --- /dev/null +++ b/fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json @@ -0,0 +1,46 @@ +{ + "record_version": "v1", + "record_type": "EconomyObservation", + "record_id": "gaia:economy:observation:negative-broken-ep-identity:v1", + "standards_refs": [ + "SocioProphet/gaia-world-model/docs/SMART_ECONOMY_DOMAIN.md", + "SocioProphet/economic-prophet/schemas/ep_output.schema.json" + ], + "economic_prophet": { + "framework_ref": "SocioProphet/economic-prophet@main", + "ep_output": { + "object_id": "instrument-loan-001", + "as_of": "2026-04-24T00:00:00Z", + "horizon": "1Y", + "economic_profit": 999.99, + "components": { + "revenue": 1000.0, + "expected_loss": 100.0, + "expense": 50.0, + "funding_costs": 200.0, + "funding_credits": 10.0, + "taxes": 40.0, + "capital_charge": 496.55 + } + }, + "measurement_context": { + "measurement_context_id": "uvmc:ctx:negative:base", + "object_id": "instrument-loan-001", + "object_type": "instrument", + "as_of": "2026-04-24T00:00:00Z", + "period_id": "2026-Q2", + "horizon": "1Y", + "scenario_id": "baseline", + "model_version": "ep-core-0.1", + "parameter_set": "default", + "formula_version": "uvmc-0.1", + "cadence": "daily", + "source_system": "synthetic-core-banking", + "lineage": {"parent_chain": ["account-credit-001"], "type_chain": ["instrument", "account"]} + } + }, + "source": {"source_id": "negative-fixture", "source_type": "EconomicProphetEP", "license_ref": "internal-design-record", "access_tier": "internal"}, + "provenance": {"chain": ["fixture:generated"], "derived_from": ["negative:broken-ep-identity"], "runtime_boundary_id": "runtime:economic-prophet:ep:v0"}, + "governance": {"privacy_tier": "internal", "safety_tier": "standard", "retention_tier": "sample", "redistribution": "restricted"}, + "classification": {"security_marking": "internal_sample", "sensitive_geo_policy_ref": "policy:sensitive-geo:not-applicable-non-geospatial"} +} diff --git a/fixtures/economy/policy-decision.policy-audit.v1.json b/fixtures/economy/policy-decision.policy-audit.v1.json new file mode 100644 index 0000000..b7100bb --- /dev/null +++ b/fixtures/economy/policy-decision.policy-audit.v1.json @@ -0,0 +1,11 @@ +{ + "id": "pol:economy-policy-audit-0001", + "decision": "review", + "reason": "triparty face 'participant-planner-clearing-face' is in state ReviewRequired with residual 0.4 above the release threshold; reward functional release_authority is advisory_only, so the audit cannot self-release and routes to review.", + "evidence_refs": [ + "economic-prophet:policy_simulation_profile:policy-sim-source-intake-001", + "economic-prophet:audit_receipt:policy-sim-source-intake-run-001", + "economic-prophet:triparty_face:participant-planner-clearing-face", + "act:economy-policy-audit-0001" + ] +} diff --git a/schemas/economy/economy_network_topology.v1.schema.json b/schemas/economy/economy_network_topology.v1.schema.json new file mode 100644 index 0000000..71bf8fe --- /dev/null +++ b/schemas/economy/economy_network_topology.v1.schema.json @@ -0,0 +1,95 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://gaia.socioprophet.ai/schemas/economy/economy_network_topology.v1.schema.json", + "title": "GAIA Economy Network Topology v1", + "description": "The founding world-model's network-of-networks, schematized as a graph bound to Economic Prophet. Nodes carry an Economic Prophet object_type and object_ref; the political network binds to a policy_simulation_profile; the geographic network binds to GAIA geo. Networks are the integration surface; Economic Profit (EP) flows over the edges.", + "type": "object", + "required": [ + "record_version", + "record_type", + "record_id", + "standards_refs", + "networks", + "nodes", + "edges", + "source", + "provenance", + "governance", + "classification" + ], + "properties": { + "record_version": {"type": "string", "const": "v1"}, + "record_type": {"type": "string", "const": "EconomyNetworkTopology"}, + "record_id": {"type": "string"}, + "standards_refs": {"type": "array", "items": {"type": "string"}}, + "networks": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["network_id", "network_kind", "description"], + "properties": { + "network_id": {"type": "string", "minLength": 1}, + "network_kind": { + "type": "string", + "enum": ["resource", "distribution", "labor", "capital", "political", "information", "time", "geographic"] + }, + "description": {"type": "string"}, + "friction_model": { + "type": "string", + "description": "How law/policy frictions apply to flows in this network (e.g. ref to a policy_simulation_profile)." + } + }, + "additionalProperties": true + } + }, + "nodes": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["node_id", "network_id", "economic_object_type"], + "properties": { + "node_id": {"type": "string", "minLength": 1}, + "network_id": {"type": "string", "minLength": 1}, + "economic_object_type": { + "type": "string", + "description": "Matches the Economic Prophet UVMC object_type enum.", + "enum": [ + "legal_entity", "line_of_business", "portfolio", "relationship", + "account", "instrument", "transaction_event", "collateral_set", + "funding_source", "hedge_set", "sphere", "edge", "triparty_face", "other" + ] + }, + "object_ref": {"type": "string", "description": "Economic Prophet object_id this node binds to."}, + "uvmc_dimension_ref": {"type": "string"}, + "geo_ref": {"type": "string", "description": "GAIA geospatial reference for geographic-network nodes."} + }, + "additionalProperties": true + } + }, + "edges": { + "type": "array", + "items": { + "type": "object", + "required": ["edge_id", "from_node", "to_node", "flow_type", "network_id"], + "properties": { + "edge_id": {"type": "string", "minLength": 1}, + "from_node": {"type": "string", "minLength": 1}, + "to_node": {"type": "string", "minLength": 1}, + "flow_type": { + "type": "string", + "description": "What flows over the edge (e.g. value, labor, capital, goods, authority)." + }, + "network_id": {"type": "string", "minLength": 1} + }, + "additionalProperties": true + } + }, + "source": {"type": "object"}, + "provenance": {"type": "object"}, + "governance": {"type": "object"}, + "classification": {"type": "object"} + }, + "additionalProperties": true +} diff --git a/schemas/economy/economy_observation.v1.schema.json b/schemas/economy/economy_observation.v1.schema.json new file mode 100644 index 0000000..bd0ed24 --- /dev/null +++ b/schemas/economy/economy_observation.v1.schema.json @@ -0,0 +1,102 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://gaia.socioprophet.ai/schemas/economy/economy_observation.v1.schema.json", + "title": "GAIA Economy Observation v1", + "description": "GAIA smart-economy domain record. It does NOT redefine value; it binds GAIA's world model to the Economic Prophet framework (SocioProphet/economic-prophet). Economic Profit (EP) is the canonical additive value measure (UVMC rule 1); the embedded ep_output conforms to economic-prophet's ep_output schema and the measurement_context conforms to its UVMC measurement context schema.", + "type": "object", + "required": [ + "record_version", + "record_type", + "record_id", + "standards_refs", + "economic_prophet", + "source", + "provenance", + "governance", + "classification" + ], + "properties": { + "record_version": {"type": "string", "const": "v1"}, + "record_type": {"type": "string", "const": "EconomyObservation"}, + "record_id": {"type": "string"}, + "standards_refs": {"type": "array", "items": {"type": "string"}}, + "economic_prophet": { + "type": "object", + "description": "Outputs consumed from the Economic Prophet framework. EP is the value backbone; UVMC supplies the measurement context; policy_simulation supplies the law/policy layer.", + "required": ["framework_ref", "ep_output", "measurement_context"], + "properties": { + "framework_ref": { + "type": "string", + "description": "Pinned reference to the producing framework, e.g. SocioProphet/economic-prophet@." + }, + "ep_output": { + "type": "object", + "description": "Conforms to economic-prophet ep_output.schema.json. EP additive identity: economic_profit = revenue - expected_loss - expense - funding_costs + funding_credits - taxes - capital_charge.", + "required": ["object_id", "as_of", "horizon", "economic_profit", "components"], + "properties": { + "object_id": {"type": "string"}, + "as_of": {"type": "string"}, + "horizon": {"type": "string"}, + "economic_profit": {"type": "number"}, + "components": { + "type": "object", + "required": ["revenue", "expected_loss", "expense", "funding_costs", "funding_credits", "taxes", "capital_charge"], + "properties": { + "revenue": {"type": "number"}, + "expected_loss": {"type": "number"}, + "expense": {"type": "number"}, + "funding_costs": {"type": "number"}, + "funding_credits": {"type": "number"}, + "taxes": {"type": "number"}, + "capital_charge": {"type": "number"} + }, + "additionalProperties": true + } + }, + "additionalProperties": true + }, + "measurement_context": { + "type": "object", + "description": "Conforms to economic-prophet uvmc_measurement_context.schema.json (subset of required fields enforced here).", + "required": ["measurement_context_id", "object_id", "object_type", "as_of", "period_id", "horizon", "scenario_id", "model_version", "parameter_set", "formula_version", "cadence", "source_system", "lineage"], + "properties": { + "measurement_context_id": {"type": "string", "minLength": 1}, + "object_id": {"type": "string", "minLength": 1}, + "object_type": {"type": "string"}, + "as_of": {"type": "string"}, + "period_id": {"type": "string", "minLength": 1}, + "horizon": {"type": "string", "minLength": 1}, + "scenario_id": {"type": "string", "minLength": 1}, + "model_version": {"type": "string", "minLength": 1}, + "parameter_set": {"type": "string", "minLength": 1}, + "formula_version": {"type": "string", "minLength": 1}, + "cadence": {"type": "string"}, + "source_system": {"type": "string", "minLength": 1}, + "lineage": { + "type": "object", + "required": ["parent_chain", "type_chain"], + "properties": { + "parent_chain": {"type": "array", "items": {"type": "string"}}, + "type_chain": {"type": "array", "items": {"type": "string"}}, + "input_hash": {"type": "string"}, + "output_hash": {"type": "string"} + }, + "additionalProperties": true + } + }, + "additionalProperties": true + }, + "policy_simulation_profile_ref": { + "type": "string", + "description": "Optional ref to an economic-prophet policy_simulation_profile (the law/policy layer; law modeled as friction on flows)." + } + }, + "additionalProperties": true + }, + "source": {"type": "object"}, + "provenance": {"type": "object"}, + "governance": {"type": "object"}, + "classification": {"type": "object"} + }, + "additionalProperties": true +} diff --git a/scripts/validate_economy_fixtures.py b/scripts/validate_economy_fixtures.py new file mode 100644 index 0000000..e791a0e --- /dev/null +++ b/scripts/validate_economy_fixtures.py @@ -0,0 +1,236 @@ +#!/usr/bin/env python3 +"""Validate GAIA smart-economy domain fixtures. + +The smart-economy domain binds GAIA to the Economic Prophet framework +(SocioProphet/economic-prophet). This validator mirrors the dependency-light +style of scripts/validate_multidomain_fixtures.py and proves that: + +- records carry the GAIA envelope (record_type, standards_refs, provenance, governance); +- the embedded ep_output carries Economic Prophet's required EP components; +- the EP additive identity holds: + economic_profit = revenue - expected_loss - expense + - funding_costs + funding_credits - taxes - capital_charge + (Economic Profit is UVMC's canonical additive value measure); +- the embedded UVMC measurement_context carries its required fields + lineage; +- the bundled negative fixture (broken EP identity) is correctly rejected. + +If a sibling economic-prophet checkout is found, the embedded ep_output and +measurement_context are additionally validated against that repo's canonical +JSON schemas (when `jsonschema` is installed). +""" + +from __future__ import annotations + +import json +from pathlib import Path +from typing import Any, Dict, Iterable + +ROOT = Path(__file__).resolve().parents[1] + +SCHEMA = "schemas/economy/economy_observation.v1.schema.json" +RECORD_TYPE = "EconomyObservation" +REQUIRED = [ + "record_version", "record_type", "record_id", "standards_refs", + "economic_prophet", "source", "provenance", "governance", "classification", +] +EP_COMPONENTS = [ + "revenue", "expected_loss", "expense", + "funding_costs", "funding_credits", "taxes", "capital_charge", +] +UVMC_REQUIRED = [ + "measurement_context_id", "object_id", "object_type", "as_of", "period_id", + "horizon", "scenario_id", "model_version", "parameter_set", "formula_version", + "cadence", "source_system", "lineage", +] + +POSITIVE_FIXTURES = ["fixtures/economy/economy-observation.sample.v1.json"] +NEGATIVE_FIXTURES = ["fixtures/economy/negative/economy-observation.broken-ep-identity.v1.json"] + +TOPOLOGY_SCHEMA = "schemas/economy/economy_network_topology.v1.schema.json" +TOPOLOGY_FIXTURE = "fixtures/economy/economy-network-topology.sample.v1.json" + +ACTION_INTENT_SCHEMA = "schemas/actions/action-intent.schema.json" +POLICY_DECISION_SCHEMA = "schemas/policy/policy-decision.schema.json" +POLICY_AUDIT_ACTION = "fixtures/economy/action-intent.policy-audit.v1.json" +POLICY_AUDIT_DECISION = "fixtures/economy/policy-decision.policy-audit.v1.json" + +EP_REPO_CANDIDATES = [ + ROOT.parent / "economic-prophet", + ROOT.parent / "SocioProphet__economic-prophet", +] + + +class CheckError(Exception): + pass + + +def fail(message: str) -> None: + raise SystemExit(f"ERROR: {message}") + + +def load_json(path: Path) -> Dict[str, Any]: + try: + with path.open("r", encoding="utf-8") as handle: + value = json.load(handle) + except FileNotFoundError: + fail(f"missing file: {path}") + except json.JSONDecodeError as exc: + fail(f"invalid JSON in {path}: {exc}") + if not isinstance(value, dict): + fail(f"expected top-level object in {path}") + return value + + +def check_required(path: str, doc: Dict[str, Any], required: Iterable[str]) -> None: + missing = [field for field in required if field not in doc] + if missing: + raise CheckError(f"{path} missing required fields: {', '.join(missing)}") + + +def ep_additive_value(components: Dict[str, float]) -> float: + return ( + components["revenue"] + - components["expected_loss"] + - components["expense"] + - components["funding_costs"] + + components["funding_credits"] + - components["taxes"] + - components["capital_charge"] + ) + + +def validate(path: str) -> None: + doc = load_json(ROOT / path) + check_required(path, doc, REQUIRED) + if doc.get("record_type") != RECORD_TYPE: + raise CheckError(f"{path} expected record_type={RECORD_TYPE}, got {doc.get('record_type')!r}") + if not doc.get("provenance", {}).get("derived_from"): + raise CheckError(f"{path} missing provenance.derived_from") + governance = doc.get("governance", {}) + for field in ["privacy_tier", "safety_tier", "retention_tier", "redistribution"]: + if field not in governance: + raise CheckError(f"{path} governance missing {field}") + + ep = doc["economic_prophet"] + check_required(f"{path}:economic_prophet", ep, ["framework_ref", "ep_output", "measurement_context"]) + + ep_output = ep["ep_output"] + check_required(f"{path}:ep_output", ep_output, ["object_id", "as_of", "horizon", "economic_profit", "components"]) + components = ep_output["components"] + check_required(f"{path}:ep_output.components", components, EP_COMPONENTS) + expected = ep_additive_value(components) + if abs(expected - ep_output["economic_profit"]) > 1e-6: + raise CheckError( + f"{path}: EP additive identity violated — components imply {round(expected, 6)}, " + f"economic_profit is {ep_output['economic_profit']}" + ) + + ctx = ep["measurement_context"] + check_required(f"{path}:measurement_context", ctx, UVMC_REQUIRED) + check_required(f"{path}:measurement_context.lineage", ctx["lineage"], ["parent_chain", "type_chain"]) + + +def cross_validate_against_economic_prophet() -> str: + repo = next((p for p in EP_REPO_CANDIDATES if p.exists()), None) + if repo is None: + return "skipped (no sibling economic-prophet checkout)" + try: + import jsonschema # type: ignore + except ImportError: + return f"skipped (jsonschema not installed; found {repo.name})" + ep_schema = load_json(repo / "schemas" / "ep_output.schema.json") + ctx_schema = load_json(repo / "schemas" / "uvmc_measurement_context.schema.json") + doc = load_json(ROOT / POSITIVE_FIXTURES[0]) + ep = doc["economic_prophet"] + jsonschema.Draft202012Validator(ep_schema).validate(ep["ep_output"]) + # measurement_context schema forbids additionalProperties; validate the shared subset. + ctx = {k: ep["measurement_context"][k] for k in ep["measurement_context"] if k in ctx_schema["properties"]} + jsonschema.Draft202012Validator(ctx_schema).validate(ctx) + return f"ok (validated against {repo.name} canonical schemas)" + + +def validate_topology() -> None: + doc = load_json(ROOT / TOPOLOGY_FIXTURE) + try: + import jsonschema # type: ignore + jsonschema.Draft202012Validator(load_json(ROOT / TOPOLOGY_SCHEMA)).validate(doc) + except ImportError: + check_required(TOPOLOGY_FIXTURE, doc, ["networks", "nodes", "edges"]) + network_ids = {n["network_id"] for n in doc["networks"]} + node_ids = {n["node_id"] for n in doc["nodes"]} + for node in doc["nodes"]: + if node["network_id"] not in network_ids: + raise CheckError(f"{TOPOLOGY_FIXTURE}: node {node['node_id']} references unknown network {node['network_id']}") + for edge in doc["edges"]: + for endpoint in ("from_node", "to_node"): + if edge[endpoint] not in node_ids: + raise CheckError(f"{TOPOLOGY_FIXTURE}: edge {edge['edge_id']} {endpoint} references unknown node {edge[endpoint]}") + if edge["network_id"] not in network_ids: + raise CheckError(f"{TOPOLOGY_FIXTURE}: edge {edge['edge_id']} references unknown network {edge['network_id']}") + + +def validate_policy_audit() -> None: + action = load_json(ROOT / POLICY_AUDIT_ACTION) + decision = load_json(ROOT / POLICY_AUDIT_DECISION) + try: + import jsonschema # type: ignore + jsonschema.Draft202012Validator(load_json(ROOT / ACTION_INTENT_SCHEMA)).validate(action) + jsonschema.Draft202012Validator(load_json(ROOT / POLICY_DECISION_SCHEMA)).validate(decision) + except ImportError: + check_required(POLICY_AUDIT_ACTION, action, ["id", "actor", "verb"]) + check_required(POLICY_AUDIT_DECISION, decision, ["id", "decision"]) + if action.get("verb") != "audit": + raise CheckError(f"{POLICY_AUDIT_ACTION}: expected verb=audit, got {action.get('verb')!r}") + if decision.get("decision") not in {"allow", "deny", "constrain", "review"}: + raise CheckError(f"{POLICY_AUDIT_DECISION}: invalid decision {decision.get('decision')!r}") + refs = decision.get("evidence_refs", []) + if action["id"] not in refs: + raise CheckError(f"{POLICY_AUDIT_DECISION}: evidence_refs must cite the audit action {action['id']}") + if action["target"] not in refs: + raise CheckError(f"{POLICY_AUDIT_DECISION}: evidence_refs must cite the audited target {action['target']}") + + +def main() -> int: + schema = load_json(ROOT / SCHEMA) + schema_required = schema.get("required") + if isinstance(schema_required, list): + for field in REQUIRED: + if field not in schema_required: + fail(f"{SCHEMA} does not declare expected required field {field}") + + checked = 0 + for fixture in POSITIVE_FIXTURES: + try: + validate(fixture) + except CheckError as exc: + fail(str(exc)) + checked += 1 + + for fixture in NEGATIVE_FIXTURES: + try: + validate(fixture) + except CheckError: + checked += 1 + continue + fail(f"negative fixture {fixture} unexpectedly passed validation") + + try: + validate_topology() + except CheckError as exc: + fail(str(exc)) + checked += 1 + + try: + validate_policy_audit() + except CheckError as exc: + fail(str(exc)) + checked += 1 + + cross = cross_validate_against_economic_prophet() + print(f"validated {checked} GAIA smart-economy fixture(s) (observation, topology, policy-audit; incl. negative cases)") + print(f"economic-prophet cross-validation: {cross}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())