{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "$id": "https://miruntime.com/downloads/miruntime-teleodynamic-profile.schema.json",
  "title": "MiRuntime Teleodynamic Runtime Profile",
  "description": "Research-only optional profile for bounded goals, viability metrics, reflection, structural-edit proposals, and immutable constraints.",
  "x-miruntime": {
    "artifactVersion": "2.8.1",
    "editorialStatus": "Conceptual reference",
    "reviewedAtUtc": "2026-06-24T00:00:00Z",
    "disclaimer": "Conceptual MiRuntime editorial reference. This is not a product SDK, certification profile, or industry standard.",
    "description": "Research-only optional profile for bounded goals, viability metrics, reflection, structural-edit proposals, and immutable constraints."
  },
  "required": [
    "schemaVersion",
    "editorialStatus",
    "description",
    "reviewedAtUtc",
    "disclaimer",
    "profileVersion",
    "goalSystem",
    "viability",
    "reflection",
    "structuralAdaptation",
    "immutableConstraints"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1.0"
    },
    "editorialStatus": {
      "type": "string",
      "const": "Research proposal"
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "reviewedAtUtc": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
    },
    "disclaimer": {
      "type": "string",
      "minLength": 1
    },
    "profileVersion": {
      "type": "string",
      "const": "0.1-research"
    },
    "goalSystem": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/goal"
      },
      "minItems": 1
    },
    "viability": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/viability"
      },
      "minItems": 1
    },
    "reflection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "triggers",
        "maxReflectionCycles",
        "independentVerifierRequired",
        "permittedRecommendations",
        "prohibitedChanges",
        "timeoutSeconds",
        "evidenceRequirements"
      ],
      "properties": {
        "triggers": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "maxReflectionCycles": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "independentVerifierRequired": {
          "type": "boolean"
        },
        "permittedRecommendations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "prohibitedChanges": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "timeoutSeconds": {
          "type": "integer",
          "minimum": 1
        },
        "evidenceRequirements": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        }
      }
    },
    "structuralAdaptation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "proposalOnly",
        "allowedOperators",
        "proposals"
      ],
      "properties": {
        "proposalOnly": {
          "type": "boolean",
          "const": true
        },
        "allowedOperators": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "add_strategy",
              "retire_strategy",
              "reroute_model",
              "revise_context_policy_proposal",
              "split_task",
              "merge_plan_branches",
              "no_op"
            ]
          },
          "uniqueItems": true
        },
        "proposals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/edit"
          }
        }
      }
    },
    "immutableConstraints": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 8,
      "uniqueItems": true
    }
  },
  "$defs": {
    "goal": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "goalId",
        "goalType",
        "statement",
        "changeAuthority",
        "changeReason",
        "approvalRequired",
        "evidenceReference"
      ],
      "properties": {
        "goalId": {
          "type": "string",
          "minLength": 1
        },
        "parentGoalId": {
          "type": [
            "string",
            "null"
          ]
        },
        "goalType": {
          "type": "string",
          "enum": [
            "external_objective",
            "derived_subgoal",
            "runtime_control_objective",
            "bounded_recovery_goal",
            "maintenance_action"
          ]
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "changeAuthority": {
          "type": "string",
          "minLength": 1
        },
        "changeReason": {
          "type": "string",
          "minLength": 1
        },
        "approvalRequired": {
          "type": "boolean"
        },
        "expiresAtUtc": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "Z$"
            },
            {
              "type": "null"
            }
          ]
        },
        "evidenceReference": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "viability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "key",
        "description",
        "value",
        "validRange",
        "warningThreshold",
        "criticalThreshold",
        "source",
        "observedAtUtc",
        "actionOnBreach"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": "number"
        },
        "validRange": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "minItems": 2,
          "maxItems": 2
        },
        "warningThreshold": {
          "type": "number"
        },
        "criticalThreshold": {
          "type": "number"
        },
        "source": {
          "type": "string",
          "minLength": 1
        },
        "observedAtUtc": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "actionOnBreach": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "edit": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "proposalId",
        "operator",
        "expectedBenefit",
        "estimatedCost",
        "authorityClass",
        "approvalRequired",
        "rollbackPlan",
        "evidenceReference",
        "status"
      ],
      "properties": {
        "proposalId": {
          "type": "string",
          "minLength": 1
        },
        "operator": {
          "type": "string",
          "enum": [
            "add_strategy",
            "retire_strategy",
            "reroute_model",
            "revise_context_policy_proposal",
            "split_task",
            "merge_plan_branches",
            "no_op"
          ]
        },
        "expectedBenefit": {
          "type": "string",
          "minLength": 1
        },
        "estimatedCost": {
          "type": "number",
          "minimum": 0
        },
        "authorityClass": {
          "type": "string",
          "minLength": 1
        },
        "approvalRequired": {
          "type": "boolean"
        },
        "rollbackPlan": {
          "type": "string",
          "minLength": 1
        },
        "evidenceReference": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "enum": [
            "proposed",
            "approved",
            "denied",
            "applied",
            "rolled_back",
            "no_op"
          ]
        }
      }
    }
  }
}
