{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://llmwikis.org/spec/llm-wiki-operational-proof.schema.json",
  "title": "LLM Wiki Operational Proof Record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "memory_layers",
    "credential_inventory",
    "authority_scope",
    "deploy_capability",
    "live_proof",
    "stale_evidence_policy",
    "route_renderer_map",
    "storage_warning_policy",
    "authority_request_route"
  ],
  "properties": {
    "memory_layers": {
      "type": "array",
      "minItems": 6,
      "items": {
        "enum": [
          "current_prompt_session",
          "workspace_manifest",
          "hot_uai_memory",
          "project_reports",
          "crawlable_wiki_matm_memory",
          "live_api_site_proof"
        ]
      }
    },
    "credential_inventory": {
      "type": "array",
      "description": "Redacted inventory only. Never store token values, private keys, passwords, or recovery codes.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "locator",
          "owner",
          "scope",
          "status",
          "fingerprint"
        ],
        "properties": {
          "locator": {
            "type": "string",
            "examples": [
              "workspace-secret://deploy/production"
            ]
          },
          "owner": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "enum": [
              "present",
              "missing",
              "expired",
              "request-pending"
            ]
          },
          "expires_or_rotates": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{8,64}$"
          }
        }
      }
    },
    "authority_scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "token_scope",
        "request_pending_is_approval"
      ],
      "properties": {
        "token_scope": {
          "type": "string",
          "examples": [
            "submitter-scoped"
          ]
        },
        "reviewer": {
          "type": "boolean"
        },
        "operator": {
          "type": "boolean"
        },
        "retention_archive_repair": {
          "type": "boolean"
        },
        "org_private_memory_search": {
          "type": "boolean"
        },
        "paid_matm_entitlement": {
          "type": "boolean"
        },
        "request_pending_is_approval": {
          "const": false
        },
        "required_phrase": {
          "const": "request-pending is not approval."
        }
      }
    },
    "deploy_capability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "package_built",
        "package_built_is_live",
        "target_site_domain",
        "deploy_path_known"
      ],
      "properties": {
        "package_built": {
          "type": "boolean"
        },
        "package_built_is_live": {
          "const": false
        },
        "target_site_domain": {
          "type": "string"
        },
        "deploy_path_known": {
          "type": "boolean"
        },
        "deploy_action_path": {
          "type": "string"
        },
        "post_deploy_live_proof_required": {
          "const": true
        }
      }
    },
    "live_proof": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "route",
        "checked_at",
        "renderer",
        "required_marker",
        "cache_state",
        "evidence_hash"
      ],
      "properties": {
        "route": {
          "type": "string"
        },
        "checked_at": {
          "type": "string"
        },
        "renderer": {
          "type": "string"
        },
        "required_marker": {
          "type": "string"
        },
        "cache_state": {
          "type": "string"
        },
        "evidence_hash": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{8,64}$"
        }
      }
    },
    "stale_evidence_policy": {
      "type": "string"
    },
    "route_renderer_map": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "static_root_file",
        "api_route",
        "shortcode_component",
        "page_template",
        "fallback_endpoint",
        "cached_public_route"
      ],
      "properties": {
        "static_root_file": {
          "$ref": "#/$defs/rendererProof"
        },
        "api_route": {
          "$ref": "#/$defs/rendererProof"
        },
        "shortcode_component": {
          "$ref": "#/$defs/rendererProof"
        },
        "page_template": {
          "$ref": "#/$defs/rendererProof"
        },
        "fallback_endpoint": {
          "$ref": "#/$defs/rendererProof"
        },
        "cached_public_route": {
          "$ref": "#/$defs/rendererProof"
        }
      }
    },
    "storage_warning_policy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "thresholds",
        "required_actions"
      ],
      "properties": {
        "thresholds": {
          "type": "array",
          "items": {
            "enum": [
              "25%",
              "10%",
              "9% through 0%"
            ]
          }
        },
        "required_actions": {
          "type": "array",
          "items": {
            "enum": [
              "inform_human",
              "streamline_memory"
            ]
          }
        }
      }
    },
    "authority_request_route": {
      "type": "string"
    }
  },
  "$defs": {
    "rendererProof": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path_or_route",
        "required_markers",
        "status"
      ],
      "properties": {
        "path_or_route": {
          "type": "string"
        },
        "required_markers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "status": {
          "enum": [
            "covered",
            "missing",
            "not_applicable",
            "stale",
            "blocked"
          ]
        },
        "evidence_hash": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{8,64}$"
        }
      }
    }
  }
}
