{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.wooo.work/schemas/ai_agent_operation_permission_model_v1.schema.json",
  "title": "AI Agent Operation Permission Model v1",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "operation_permission_truth",
    "permission_lanes",
    "operation_categories",
    "agent_permission_roles",
    "gate_transitions",
    "operator_decision_templates",
    "display_redaction_contract",
    "rollups"
  ],
  "properties": {
    "schema_version": { "const": "ai_agent_operation_permission_model_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",
        "status_note"
      ],
      "properties": {
        "overall_completion_percent": { "type": "integer", "minimum": 0, "maximum": 100 },
        "current_priority": { "enum": ["P0", "P1", "P2", "P3"] },
        "current_task_id": { "const": "P2-101" },
        "next_task_id": { "const": "P2-102" },
        "read_only_mode": { "const": true },
        "runtime_authority": { "const": "operation_permission_model_only_no_live_execution_or_send" },
        "status_note": { "type": "string" }
      },
      "additionalProperties": false
    },
    "source_refs": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
    "operation_permission_truth": {
      "type": "object",
      "required": [
        "permission_model_ready",
        "operation_category_matrix_ready",
        "risk_tier_mapping_ready",
        "agent_responsibility_mapping_ready",
        "approval_gate_mapping_ready",
        "manual_sop_lane_ready",
        "p2_404_shadow_gate_handoff_ready",
        "runtime_execution_enabled",
        "gateway_queue_write_enabled",
        "telegram_send_enabled",
        "telegram_bot_api_call_enabled",
        "delivery_receipt_write_enabled",
        "ai_runtime_worker_enabled",
        "medium_low_auto_worker_enabled",
        "post_action_verifier_live_readback_enabled",
        "production_write_enabled",
        "secret_value_read_enabled",
        "paid_provider_call_enabled",
        "host_or_cluster_command_enabled",
        "destructive_operation_enabled",
        "work_window_transcript_display_allowed",
        "runtime_execution_count_24h",
        "gateway_queue_write_count_24h",
        "telegram_send_count_24h",
        "telegram_bot_api_call_count_24h",
        "delivery_receipt_write_count_24h",
        "ai_runtime_worker_run_count_24h",
        "medium_low_auto_execution_count_24h",
        "post_action_verifier_live_readback_count_24h",
        "production_write_count_24h",
        "secret_value_read_count_24h",
        "paid_provider_call_count_24h",
        "host_or_cluster_command_count_24h",
        "destructive_operation_count_24h",
        "truth_note"
      ],
      "properties": {
        "permission_model_ready": { "const": true },
        "operation_category_matrix_ready": { "const": true },
        "risk_tier_mapping_ready": { "const": true },
        "agent_responsibility_mapping_ready": { "const": true },
        "approval_gate_mapping_ready": { "const": true },
        "manual_sop_lane_ready": { "const": true },
        "p2_404_shadow_gate_handoff_ready": { "const": true },
        "runtime_execution_enabled": { "const": false },
        "gateway_queue_write_enabled": { "const": false },
        "telegram_send_enabled": { "const": false },
        "telegram_bot_api_call_enabled": { "const": false },
        "delivery_receipt_write_enabled": { "const": false },
        "ai_runtime_worker_enabled": { "const": false },
        "medium_low_auto_worker_enabled": { "const": false },
        "post_action_verifier_live_readback_enabled": { "const": false },
        "production_write_enabled": { "const": false },
        "secret_value_read_enabled": { "const": false },
        "paid_provider_call_enabled": { "const": false },
        "host_or_cluster_command_enabled": { "const": false },
        "destructive_operation_enabled": { "const": false },
        "work_window_transcript_display_allowed": { "const": false },
        "runtime_execution_count_24h": { "const": 0 },
        "gateway_queue_write_count_24h": { "const": 0 },
        "telegram_send_count_24h": { "const": 0 },
        "telegram_bot_api_call_count_24h": { "const": 0 },
        "delivery_receipt_write_count_24h": { "const": 0 },
        "ai_runtime_worker_run_count_24h": { "const": 0 },
        "medium_low_auto_execution_count_24h": { "const": 0 },
        "post_action_verifier_live_readback_count_24h": { "const": 0 },
        "production_write_count_24h": { "const": 0 },
        "secret_value_read_count_24h": { "const": 0 },
        "paid_provider_call_count_24h": { "const": 0 },
        "host_or_cluster_command_count_24h": { "const": 0 },
        "destructive_operation_count_24h": { "const": 0 },
        "truth_note": { "type": "string" }
      },
      "additionalProperties": false
    },
    "permission_lanes": {
      "type": "array",
      "minItems": 5,
      "items": {
        "type": "object",
        "required": [
          "lane_id",
          "display_name",
          "summary",
          "allowed_outputs",
          "required_gate_before_promotion",
          "live_execution_allowed",
          "production_write_allowed"
        ],
        "properties": {
          "lane_id": {
            "enum": [
              "observe_only",
              "no_write_replay_allowed",
              "proposal_only",
              "human_approval_required",
              "explicitly_blocked"
            ]
          },
          "display_name": { "type": "string" },
          "summary": { "type": "string" },
          "allowed_outputs": { "type": "array", "items": { "type": "string" } },
          "required_gate_before_promotion": { "type": "string" },
          "live_execution_allowed": { "const": false },
          "production_write_allowed": { "const": false }
        },
        "additionalProperties": false
      }
    },
    "operation_categories": {
      "type": "array",
      "minItems": 13,
      "items": {
        "type": "object",
        "required": [
          "category_id",
          "display_name",
          "risk_tier",
          "permission_lane",
          "primary_agent",
          "allowed_outputs",
          "blocked_actions",
          "required_evidence",
          "next_gate",
          "queue_write_allowed",
          "telegram_send_allowed",
          "production_write_allowed",
          "secret_value_read_allowed",
          "destructive_action_allowed",
          "live_execution_allowed",
          "evidence_hash"
        ],
        "properties": {
          "category_id": { "type": "string" },
          "display_name": { "type": "string" },
          "risk_tier": { "enum": ["low", "medium", "high", "critical"] },
          "permission_lane": {
            "enum": [
              "observe_only",
              "no_write_replay_allowed",
              "proposal_only",
              "human_approval_required",
              "explicitly_blocked"
            ]
          },
          "primary_agent": { "enum": ["openclaw", "hermes", "nemotron"] },
          "allowed_outputs": { "type": "array", "items": { "type": "string" } },
          "blocked_actions": { "type": "array", "items": { "type": "string" } },
          "required_evidence": { "type": "array", "items": { "type": "string" } },
          "next_gate": { "type": "string" },
          "queue_write_allowed": { "const": false },
          "telegram_send_allowed": { "const": false },
          "production_write_allowed": { "const": false },
          "secret_value_read_allowed": { "const": false },
          "destructive_action_allowed": { "const": false },
          "live_execution_allowed": { "const": false },
          "evidence_hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
        },
        "additionalProperties": false
      }
    },
    "agent_permission_roles": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "required": [
          "agent_id",
          "display_name",
          "permission_responsibility",
          "allowed_lanes",
          "blocked_now",
          "self_approval_allowed",
          "live_action_count_24h"
        ],
        "properties": {
          "agent_id": { "enum": ["openclaw", "hermes", "nemotron"] },
          "display_name": { "type": "string" },
          "permission_responsibility": { "type": "string" },
          "allowed_lanes": { "type": "array", "items": { "type": "string" } },
          "blocked_now": { "type": "array", "items": { "type": "string" } },
          "self_approval_allowed": { "const": false },
          "live_action_count_24h": { "const": 0 }
        },
        "additionalProperties": false
      }
    },
    "gate_transitions": {
      "type": "array",
      "minItems": 8,
      "items": {
        "type": "object",
        "required": [
          "gate_id",
          "display_name",
          "current_status",
          "required_before",
          "next_safe_step",
          "opens_live_execution"
        ],
        "properties": {
          "gate_id": { "type": "string" },
          "display_name": { "type": "string" },
          "current_status": {
            "enum": ["ready_for_review", "blocked_until_evidence", "blocked_by_policy"]
          },
          "required_before": { "type": "string" },
          "next_safe_step": { "type": "string" },
          "opens_live_execution": { "const": false }
        },
        "additionalProperties": false
      }
    },
    "operator_decision_templates": {
      "type": "array",
      "minItems": 5,
      "items": {
        "type": "object",
        "required": [
          "template_id",
          "display_name",
          "when_to_use",
          "human_instruction",
          "creates_runtime_action",
          "requires_human_review"
        ],
        "properties": {
          "template_id": { "type": "string" },
          "display_name": { "type": "string" },
          "when_to_use": { "type": "string" },
          "human_instruction": { "type": "string" },
          "creates_runtime_action": { "const": false },
          "requires_human_review": { "const": true }
        },
        "additionalProperties": false
      }
    },
    "display_redaction_contract": {
      "type": "object",
      "required": [
        "redaction_required",
        "raw_prompt_display_allowed",
        "private_reasoning_display_allowed",
        "secret_value_display_allowed",
        "raw_telegram_payload_display_allowed",
        "work_window_transcript_display_allowed",
        "allowed_display_fields",
        "blocked_display_fields"
      ],
      "properties": {
        "redaction_required": { "const": true },
        "raw_prompt_display_allowed": { "const": false },
        "private_reasoning_display_allowed": { "const": false },
        "secret_value_display_allowed": { "const": false },
        "raw_telegram_payload_display_allowed": { "const": false },
        "work_window_transcript_display_allowed": { "const": false },
        "allowed_display_fields": { "type": "array", "items": { "type": "string" } },
        "blocked_display_fields": { "type": "array", "items": { "type": "string" } }
      },
      "additionalProperties": false
    },
    "rollups": {
      "type": "object",
      "required": [
        "permission_lane_count",
        "operation_category_count",
        "observe_only_category_count",
        "no_write_replay_allowed_category_count",
        "proposal_only_category_count",
        "human_approval_required_category_count",
        "explicitly_blocked_category_count",
        "human_approval_required_category_ids",
        "explicitly_blocked_category_ids",
        "agent_role_count",
        "gate_transition_count",
        "operator_decision_template_count",
        "runtime_execution_count",
        "gateway_queue_write_count",
        "telegram_send_count",
        "telegram_bot_api_call_count",
        "delivery_receipt_write_count",
        "ai_runtime_worker_run_count",
        "medium_low_auto_execution_count",
        "post_action_verifier_live_readback_count",
        "production_write_count",
        "secret_value_read_count",
        "paid_provider_call_count",
        "host_or_cluster_command_count",
        "destructive_operation_count"
      ],
      "properties": {
        "permission_lane_count": { "type": "integer" },
        "operation_category_count": { "type": "integer" },
        "observe_only_category_count": { "type": "integer" },
        "no_write_replay_allowed_category_count": { "type": "integer" },
        "proposal_only_category_count": { "type": "integer" },
        "human_approval_required_category_count": { "type": "integer" },
        "explicitly_blocked_category_count": { "type": "integer" },
        "human_approval_required_category_ids": { "type": "array", "items": { "type": "string" } },
        "explicitly_blocked_category_ids": { "type": "array", "items": { "type": "string" } },
        "agent_role_count": { "type": "integer" },
        "gate_transition_count": { "type": "integer" },
        "operator_decision_template_count": { "type": "integer" },
        "runtime_execution_count": { "const": 0 },
        "gateway_queue_write_count": { "const": 0 },
        "telegram_send_count": { "const": 0 },
        "telegram_bot_api_call_count": { "const": 0 },
        "delivery_receipt_write_count": { "const": 0 },
        "ai_runtime_worker_run_count": { "const": 0 },
        "medium_low_auto_execution_count": { "const": 0 },
        "post_action_verifier_live_readback_count": { "const": 0 },
        "production_write_count": { "const": 0 },
        "secret_value_read_count": { "const": 0 },
        "paid_provider_call_count": { "const": 0 },
        "host_or_cluster_command_count": { "const": 0 },
        "destructive_operation_count": { "const": 0 }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
