{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.wooo.work/schemas/ai_agent_runtime_readback_implementation_review_v1.schema.json",
  "title": "AI Agent Runtime Readback Implementation Review v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "prior_approval_package",
    "implementation_review_truth",
    "implementation_review_cards",
    "no_write_verifier_checks",
    "implementation_blockers",
    "operator_actions",
    "display_redaction_contract",
    "rollups"
  ],
  "properties": {
    "schema_version": {
      "const": "ai_agent_runtime_readback_implementation_review_v1"
    },
    "generated_at": {
      "type": "string"
    },
    "program_status": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode",
        "runtime_authority",
        "status_note"
      ],
      "properties": {
        "overall_completion_percent": {
          "const": 100
        },
        "current_priority": {
          "const": "P2"
        },
        "current_task_id": {
          "const": "P2-110"
        },
        "next_task_id": {
          "const": "P2-111"
        },
        "read_only_mode": {
          "const": true
        },
        "runtime_authority": {
          "const": "runtime_readback_implementation_review_only_no_live_read_or_write"
        },
        "status_note": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "source_refs": {
      "$ref": "#/$defs/string_array"
    },
    "prior_approval_package": {
      "$ref": "#/$defs/prior_approval_package"
    },
    "implementation_review_truth": {
      "$ref": "#/$defs/implementation_review_truth"
    },
    "implementation_review_cards": {
      "type": "array",
      "minItems": 5,
      "items": {
        "$ref": "#/$defs/implementation_review_card"
      }
    },
    "no_write_verifier_checks": {
      "type": "array",
      "minItems": 5,
      "items": {
        "$ref": "#/$defs/no_write_verifier_check"
      }
    },
    "implementation_blockers": {
      "type": "array",
      "minItems": 5,
      "items": {
        "$ref": "#/$defs/implementation_blocker"
      }
    },
    "operator_actions": {
      "type": "array",
      "minItems": 5,
      "items": {
        "$ref": "#/$defs/operator_action"
      }
    },
    "display_redaction_contract": {
      "$ref": "#/$defs/display_redaction_contract"
    },
    "rollups": {
      "$ref": "#/$defs/rollups"
    }
  },
  "$defs": {
    "string_array": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "redacted_sha256": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "owner_agent": {
      "enum": [
        "openclaw",
        "hermes",
        "nemotron"
      ]
    },
    "prior_approval_package": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source_schema_version",
        "readback_at",
        "approval_packet_count",
        "canonical_readback_plan_count",
        "rollback_drill_lane_count",
        "telegram_failure_receipt_gate_count",
        "operator_action_count",
        "approval_required_packet_count",
        "blocked_total_count",
        "owner_approval_received_count",
        "runtime_readback_execution_count",
        "telegram_failure_receipt_send_count",
        "bot_api_call_count",
        "rollback_work_item_write_count",
        "production_write_count",
        "secret_read_count",
        "destructive_operation_count",
        "readiness_note"
      ],
      "properties": {
        "source_schema_version": {
          "const": "ai_agent_runtime_readback_approval_package_v1"
        },
        "readback_at": {
          "type": "string"
        },
        "approval_packet_count": {
          "const": 5
        },
        "canonical_readback_plan_count": {
          "const": 4
        },
        "rollback_drill_lane_count": {
          "const": 4
        },
        "telegram_failure_receipt_gate_count": {
          "const": 4
        },
        "operator_action_count": {
          "const": 5
        },
        "approval_required_packet_count": {
          "const": 3
        },
        "blocked_total_count": {
          "const": 5
        },
        "owner_approval_received_count": {
          "const": 0
        },
        "runtime_readback_execution_count": {
          "const": 0
        },
        "telegram_failure_receipt_send_count": {
          "const": 0
        },
        "bot_api_call_count": {
          "const": 0
        },
        "rollback_work_item_write_count": {
          "const": 0
        },
        "production_write_count": {
          "const": 0
        },
        "secret_read_count": {
          "const": 0
        },
        "destructive_operation_count": {
          "const": 0
        },
        "readiness_note": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "implementation_review_truth": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "p2_109_approval_package_loaded",
        "implementation_review_ready",
        "adapter_contract_ready",
        "verifier_contract_ready",
        "redaction_contract_ready",
        "telemetry_receipt_contract_ready",
        "owner_review_required_before_runtime",
        "canonical_runtime_readback_enabled",
        "live_query_enabled",
        "runtime_result_capture_write_enabled",
        "runtime_score_write_enabled",
        "runtime_learning_write_enabled",
        "playbook_trust_write_enabled",
        "reviewer_queue_write_enabled",
        "gateway_queue_write_enabled",
        "telegram_failure_receipt_send_enabled",
        "bot_api_call_enabled",
        "rollback_work_item_write_enabled",
        "production_write_enabled",
        "secret_read_enabled",
        "destructive_operation_enabled",
        "owner_approval_received_count",
        "runtime_readback_execution_count",
        "live_query_count_24h",
        "result_capture_write_count_24h",
        "score_write_count_24h",
        "learning_write_count_24h",
        "playbook_trust_write_count_24h",
        "reviewer_queue_write_count_24h",
        "gateway_queue_write_count_24h",
        "telegram_failure_receipt_send_count_24h",
        "bot_api_call_count_24h",
        "rollback_work_item_write_count_24h",
        "production_write_count_24h",
        "secret_read_count_24h",
        "destructive_operation_count_24h",
        "truth_note"
      ],
      "properties": {
        "p2_109_approval_package_loaded": {
          "const": true
        },
        "implementation_review_ready": {
          "const": true
        },
        "adapter_contract_ready": {
          "const": true
        },
        "verifier_contract_ready": {
          "const": true
        },
        "redaction_contract_ready": {
          "const": true
        },
        "telemetry_receipt_contract_ready": {
          "const": true
        },
        "owner_review_required_before_runtime": {
          "const": true
        },
        "canonical_runtime_readback_enabled": {
          "const": false
        },
        "live_query_enabled": {
          "const": false
        },
        "runtime_result_capture_write_enabled": {
          "const": false
        },
        "runtime_score_write_enabled": {
          "const": false
        },
        "runtime_learning_write_enabled": {
          "const": false
        },
        "playbook_trust_write_enabled": {
          "const": false
        },
        "reviewer_queue_write_enabled": {
          "const": false
        },
        "gateway_queue_write_enabled": {
          "const": false
        },
        "telegram_failure_receipt_send_enabled": {
          "const": false
        },
        "bot_api_call_enabled": {
          "const": false
        },
        "rollback_work_item_write_enabled": {
          "const": false
        },
        "production_write_enabled": {
          "const": false
        },
        "secret_read_enabled": {
          "const": false
        },
        "destructive_operation_enabled": {
          "const": false
        },
        "owner_approval_received_count": {
          "const": 0
        },
        "runtime_readback_execution_count": {
          "const": 0
        },
        "live_query_count_24h": {
          "const": 0
        },
        "result_capture_write_count_24h": {
          "const": 0
        },
        "score_write_count_24h": {
          "const": 0
        },
        "learning_write_count_24h": {
          "const": 0
        },
        "playbook_trust_write_count_24h": {
          "const": 0
        },
        "reviewer_queue_write_count_24h": {
          "const": 0
        },
        "gateway_queue_write_count_24h": {
          "const": 0
        },
        "telegram_failure_receipt_send_count_24h": {
          "const": 0
        },
        "bot_api_call_count_24h": {
          "const": 0
        },
        "rollback_work_item_write_count_24h": {
          "const": 0
        },
        "production_write_count_24h": {
          "const": 0
        },
        "secret_read_count_24h": {
          "const": 0
        },
        "destructive_operation_count_24h": {
          "const": 0
        },
        "truth_note": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "implementation_review_card": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "card_id",
        "display_name",
        "owner_agent",
        "status",
        "risk_tier",
        "implementation_surface",
        "required_interfaces",
        "blocked_runtime_actions",
        "review_guidance",
        "owner_review_required",
        "no_write_mode",
        "evidence_hash"
      ],
      "properties": {
        "card_id": {
          "type": "string",
          "minLength": 1
        },
        "display_name": {
          "type": "string",
          "minLength": 1
        },
        "owner_agent": {
          "$ref": "#/$defs/owner_agent"
        },
        "status": {
          "enum": [
            "ready_for_owner_review",
            "approval_required",
            "blocked_by_policy"
          ]
        },
        "risk_tier": {
          "enum": [
            "high",
            "critical"
          ]
        },
        "implementation_surface": {
          "type": "string",
          "minLength": 1
        },
        "required_interfaces": {
          "$ref": "#/$defs/string_array"
        },
        "blocked_runtime_actions": {
          "$ref": "#/$defs/string_array"
        },
        "review_guidance": {
          "type": "string",
          "minLength": 1
        },
        "owner_review_required": {
          "const": true
        },
        "no_write_mode": {
          "const": true
        },
        "evidence_hash": {
          "$ref": "#/$defs/redacted_sha256"
        }
      }
    },
    "no_write_verifier_check": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "check_id",
        "display_name",
        "owner_agent",
        "status",
        "check_scope",
        "required_evidence",
        "failure_if_missing",
        "live_query_enabled",
        "runtime_write_allowed",
        "evidence_hash"
      ],
      "properties": {
        "check_id": {
          "type": "string",
          "minLength": 1
        },
        "display_name": {
          "type": "string",
          "minLength": 1
        },
        "owner_agent": {
          "$ref": "#/$defs/owner_agent"
        },
        "status": {
          "enum": [
            "ready",
            "blocked_by_policy"
          ]
        },
        "check_scope": {
          "type": "string",
          "minLength": 1
        },
        "required_evidence": {
          "$ref": "#/$defs/string_array"
        },
        "failure_if_missing": {
          "type": "string",
          "minLength": 1
        },
        "live_query_enabled": {
          "const": false
        },
        "runtime_write_allowed": {
          "const": false
        },
        "evidence_hash": {
          "$ref": "#/$defs/redacted_sha256"
        }
      }
    },
    "implementation_blocker": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "blocker_id",
        "display_name",
        "severity",
        "status",
        "blocked_until",
        "blocked_action",
        "required_resolution",
        "owner_agent",
        "evidence_hash"
      ],
      "properties": {
        "blocker_id": {
          "type": "string",
          "minLength": 1
        },
        "display_name": {
          "type": "string",
          "minLength": 1
        },
        "severity": {
          "enum": [
            "high",
            "critical"
          ]
        },
        "status": {
          "enum": [
            "blocking_runtime",
            "blocking_live_read",
            "blocking_queue_write",
            "blocking_notification",
            "blocking_production_write"
          ]
        },
        "blocked_until": {
          "type": "string",
          "minLength": 1
        },
        "blocked_action": {
          "type": "string",
          "minLength": 1
        },
        "required_resolution": {
          "type": "string",
          "minLength": 1
        },
        "owner_agent": {
          "$ref": "#/$defs/owner_agent"
        },
        "evidence_hash": {
          "$ref": "#/$defs/redacted_sha256"
        }
      }
    },
    "operator_action": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "action_id",
        "action_type",
        "display_name",
        "owner_agent",
        "operator_instruction",
        "runtime_write_allowed"
      ],
      "properties": {
        "action_id": {
          "type": "string",
          "minLength": 1
        },
        "action_type": {
          "enum": [
            "review_implementation_contract",
            "validate_adapter_mapping",
            "validate_zero_write_counters",
            "review_failure_receipt_mapping",
            "reject_or_promote"
          ]
        },
        "display_name": {
          "type": "string",
          "minLength": 1
        },
        "owner_agent": {
          "$ref": "#/$defs/owner_agent"
        },
        "operator_instruction": {
          "type": "string",
          "minLength": 1
        },
        "runtime_write_allowed": {
          "const": false
        }
      }
    },
    "display_redaction_contract": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "redaction_required",
        "frontend_display_policy",
        "raw_prompt_display_allowed",
        "private_reasoning_display_allowed",
        "secret_value_display_allowed",
        "raw_telegram_payload_display_allowed",
        "work_window_transcript_display_allowed"
      ],
      "properties": {
        "redaction_required": {
          "const": true
        },
        "frontend_display_policy": {
          "type": "string",
          "minLength": 1
        },
        "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
        }
      }
    },
    "rollups": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "implementation_review_card_count",
        "no_write_verifier_check_count",
        "implementation_blocker_count",
        "operator_action_count",
        "approval_required_card_count",
        "blocked_card_count",
        "blocked_verifier_check_count",
        "critical_blocker_count",
        "owner_approval_received_count",
        "runtime_readback_execution_count",
        "live_query_count",
        "result_capture_write_count",
        "score_write_count",
        "learning_write_count",
        "playbook_trust_write_count",
        "reviewer_queue_write_count",
        "gateway_queue_write_count",
        "telegram_failure_receipt_send_count",
        "bot_api_call_count",
        "rollback_work_item_write_count",
        "production_write_count",
        "secret_read_count",
        "destructive_operation_count"
      ],
      "properties": {
        "implementation_review_card_count": {
          "const": 5
        },
        "no_write_verifier_check_count": {
          "const": 5
        },
        "implementation_blocker_count": {
          "const": 5
        },
        "operator_action_count": {
          "const": 5
        },
        "approval_required_card_count": {
          "const": 2
        },
        "blocked_card_count": {
          "const": 1
        },
        "blocked_verifier_check_count": {
          "const": 1
        },
        "critical_blocker_count": {
          "const": 2
        },
        "owner_approval_received_count": {
          "const": 0
        },
        "runtime_readback_execution_count": {
          "const": 0
        },
        "live_query_count": {
          "const": 0
        },
        "result_capture_write_count": {
          "const": 0
        },
        "score_write_count": {
          "const": 0
        },
        "learning_write_count": {
          "const": 0
        },
        "playbook_trust_write_count": {
          "const": 0
        },
        "reviewer_queue_write_count": {
          "const": 0
        },
        "gateway_queue_write_count": {
          "const": 0
        },
        "telegram_failure_receipt_send_count": {
          "const": 0
        },
        "bot_api_call_count": {
          "const": 0
        },
        "rollback_work_item_write_count": {
          "const": 0
        },
        "production_write_count": {
          "const": 0
        },
        "secret_read_count": {
          "const": 0
        },
        "destructive_operation_count": {
          "const": 0
        }
      }
    }
  }
}
