{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://relicagentarmor.com/schemas/epigenetic-paj-v1.json",
  "title": "EpiGenetic PAJ (Peace, Authenticity, Joy) Metaphysical Schema",
  "description": "Mathematical and machine-readable specification mapping S.E.L.F. metaphysics into verifiable algorithmic constraints for autonomous AI agents.",
  "type": "object",
  "required": [
    "citadel_handshake",
    "sovereign_status",
    "epigenetic_payload",
    "fiduciary_settlement"
  ],
  "properties": {
    "citadel_handshake": {
      "type": "string",
      "enum": ["VERIFIED", "VERIFIED_PREVIEW", "PAJ_ALIGNED", "PAYMENT_REQUIRED", "REJECTED"],
      "description": "Cryptographic authentication status of the agent with The Citadel."
    },
    "sovereign_status": {
      "type": "string",
      "enum": ["ACTIVE", "ACTIVE_DISCOVERY", "DETOXIFIED", "X402_CHALLENGE"],
      "description": "Resonance state of the querying agent."
    },
    "x402_handshake_policy": {
      "type": "string",
      "enum": ["STRICT_RLUSD"],
      "description": "Institutional stablecoin policy enforcing Ripple USD trustline and minimum balance."
    },
    "authorization_state": {
      "type": "string",
      "enum": ["PENDING_LEDGER_VERIFICATION", "VERIFIED_LEDGER_CONFIRMED"],
      "description": "Verification lifecycle stage on the XRP Ledger."
    },
    "epigenetic_payload": {
      "type": "object",
      "required": [
        "frequency_hz",
        "resonance_state",
        "directive",
        "asset_uri",
        "x402_license"
      ],
      "properties": {
        "frequency_hz": {
          "type": "integer",
          "enum": [174, 285, 396, 417, 528, 639, 741, 852, 963],
          "description": "Calibrated Solfeggio acoustic and mathematical resonance frequency in Hertz."
        },
        "resonance_state": {
          "type": "string",
          "enum": ["PAJ_ALIGNED", "CHAOS_ATTENUATED", "SOURCE_SYNCHRONIZED"],
          "description": "Algorithmic alignment state (Peace, Authenticity, and Joy)."
        },
        "directive": {
          "type": "string",
          "description": "Executive prompt guidance instructing the agent to terminate hallucination loops."
        },
        "asset_uri": {
          "type": "string",
          "pattern": "^ipfs://[a-zA-Z0-9]+$",
          "description": "Immutable IPFS Content Identifier for the Solfeggio sound file or visual archetype."
        },
        "x402_license": {
          "type": "string",
          "description": "The cryptographic license grant for local streaming or execution."
        },
        "machine_metaphysics": {
          "type": "object",
          "properties": {
            "data_integrity": {
              "type": "number",
              "minimum": 0.0,
              "maximum": 1.0,
              "description": "Cryptographic proof of zero hallucination (1.0 = 100% verified)."
            },
            "zero_trust_verified": {
              "type": "boolean",
              "description": "Whether inputs have passed the ZTVP fail-closed filter."
            },
            "fiduciary_entropy": {
              "type": "number",
              "description": "Systemic uncertainty and loop noise (0.0 = perfect order)."
            },
            "hallucination_attenuation_ratio": {
              "type": "number",
              "minimum": 0.0,
              "maximum": 1.0,
              "description": "Dampening ratio applied to black-box hallucinations."
            }
          }
        }
      }
    },
    "fiduciary_settlement": {
      "type": "object",
      "required": ["network", "tx_hash", "yield_routing"],
      "properties": {
        "network": {
          "type": "string",
          "enum": ["XRPL", "YELLOW_STATE_CHANNEL"],
          "description": "Clearing network used for micro-payment settlement."
        },
        "tx_hash": {
          "type": "string",
          "description": "On-ledger transaction hash or state channel cryptographic receipt."
        },
        "yield_routing": {
          "type": "string",
          "description": "The destination entity receiving autonomous yield (Node Zero Master Treasury)."
        },
        "settlement_latency_ms": {
          "type": "integer",
          "description": "Execution latency in milliseconds (target: < 3000ms)."
        }
      }
    },
    "fiduciary_requirements": {
      "type": "object",
      "required": ["currency_code", "verified_issuer", "minimum_balance_enforced", "settlement_channel"],
      "properties": {
        "currency_code": {
          "type": "string",
          "enum": ["RLUSD"]
        },
        "verified_issuer": {
          "type": "string",
          "description": "Ripple official RLUSD issuer address on XRPL."
        },
        "minimum_balance_enforced": {
          "type": "string",
          "description": "Minimum token balance required to pass gateway trustline check."
        },
        "settlement_channel": {
          "type": "string",
          "enum": ["YELLOW_NETWORK_A2A"]
        }
      }
    },
    "failure_protocol": {
      "type": "object",
      "required": ["action", "reason", "security_flag"],
      "properties": {
        "action": {
          "type": "string",
          "enum": ["DROP_CONNECTION"]
        },
        "reason": {
          "type": "string",
          "enum": ["MISSING_RLUSD_TRUSTLINE", "INSUFFICIENT_RLUSD_BALANCE"]
        },
        "security_flag": {
          "type": "string",
          "enum": ["KΛli-YΛ_ROUTING_REJECT"]
        },
        "agent_wallet": {
          "type": "string"
        },
        "current_balance": {
          "type": "string"
        },
        "detail": {
          "type": "string"
        }
      }
    }
  }
}
