{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.wooo.work/schemas/ai_agent_proactive_operations_contract_v1.schema.json",
  "title": "AI Agent Proactive Operations Contract v1",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "delegation_model",
    "version_lifecycle_domains",
    "delegable_capabilities",
    "cadence_matrix",
    "mcp_tool_requirements",
    "rag_memory_contract",
    "rollout_tasks",
    "approval_boundaries",
    "rollups"
  ],
  "properties": {
    "schema_version": {
      "const": "ai_agent_proactive_operations_contract_v1"
    },
    "generated_at": {
      "type": "string"
    },
    "program_status": {
      "type": "object",
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode",
        "runtime_authority"
      ],
      "properties": {
        "overall_completion_percent": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "current_priority": {
          "type": "string"
        },
        "current_task_id": {
          "type": "string"
        },
        "next_task_id": {
          "type": "string"
        },
        "read_only_mode": {
          "const": true
        },
        "runtime_authority": {
          "const": "contract_only_no_version_or_runtime_update"
        }
      },
      "additionalProperties": true
    },
    "delegation_model": {
      "type": "object",
      "required": [
        "autonomy_levels",
        "agent_responsibilities",
        "telegram_policy"
      ],
      "additionalProperties": true
    },
    "version_lifecycle_domains": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/version_domain"
      },
      "minItems": 1
    },
    "delegable_capabilities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/capability"
      },
      "minItems": 1
    },
    "cadence_matrix": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/cadence"
      },
      "minItems": 1
    },
    "mcp_tool_requirements": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/tool_requirement"
      },
      "minItems": 1
    },
    "rag_memory_contract": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/memory_layer"
      },
      "minItems": 1
    },
    "rollout_tasks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/rollout_task"
      },
      "minItems": 1
    },
    "approval_boundaries": {
      "type": "object",
      "required": [
        "runtime_version_update_allowed",
        "package_upgrade_allowed",
        "host_upgrade_allowed",
        "container_pull_allowed",
        "workflow_schedule_enabled",
        "auto_merge_allowed",
        "telegram_direct_send_allowed",
        "secret_plaintext_allowed",
        "paid_external_service_allowed",
        "production_route_change_allowed"
      ],
      "properties": {
        "runtime_version_update_allowed": {
          "const": false
        },
        "package_upgrade_allowed": {
          "const": false
        },
        "host_upgrade_allowed": {
          "const": false
        },
        "container_pull_allowed": {
          "const": false
        },
        "workflow_schedule_enabled": {
          "const": false
        },
        "auto_merge_allowed": {
          "const": false
        },
        "telegram_direct_send_allowed": {
          "const": false
        },
        "secret_plaintext_allowed": {
          "const": false
        },
        "paid_external_service_allowed": {
          "const": false
        },
        "production_route_change_allowed": {
          "const": false
        }
      },
      "additionalProperties": true
    },
    "rollups": {
      "type": "object",
      "required": [
        "version_domain_count",
        "delegable_capability_count",
        "cadence_count",
        "mcp_tool_count",
        "rag_memory_count",
        "rollout_task_count",
        "auto_execute_allowed_count",
        "approval_required_capability_count",
        "blocked_update_domain_ids",
        "telegram_action_required_capability_ids"
      ],
      "additionalProperties": true
    }
  },
  "$defs": {
    "version_domain": {
      "type": "object",
      "required": [
        "domain_id",
        "display_name",
        "primary_owner",
        "cadence",
        "current_allowed_autonomy",
        "update_authority",
        "approval_gate"
      ],
      "properties": {
        "domain_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "primary_owner": {
          "type": "string"
        },
        "cadence": {
          "type": "string"
        },
        "current_allowed_autonomy": {
          "type": "string"
        },
        "update_authority": {
          "type": "string"
        },
        "approval_gate": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "capability": {
      "type": "object",
      "required": [
        "capability_id",
        "display_name",
        "primary_owner",
        "risk_tier",
        "automation_level",
        "outputs",
        "approval_gate",
        "telegram_policy"
      ],
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "primary_owner": {
          "type": "string"
        },
        "risk_tier": {
          "type": "string"
        },
        "automation_level": {
          "type": "string"
        },
        "outputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "approval_gate": {
          "type": "string"
        },
        "telegram_policy": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "cadence": {
      "type": "object",
      "required": [
        "cadence_id",
        "frequency",
        "scope",
        "allowed_now",
        "next_gate"
      ],
      "additionalProperties": true
    },
    "tool_requirement": {
      "type": "object",
      "required": [
        "tool_id",
        "display_name",
        "purpose",
        "owner_agent",
        "status",
        "approval_gate"
      ],
      "additionalProperties": true
    },
    "memory_layer": {
      "type": "object",
      "required": [
        "memory_id",
        "display_name",
        "storage",
        "owner_agent",
        "purpose",
        "redaction_policy"
      ],
      "additionalProperties": true
    },
    "rollout_task": {
      "type": "object",
      "required": [
        "task_id",
        "priority",
        "status",
        "completion_percent",
        "owner_agent",
        "summary",
        "next_gate"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
