{
  "openapi": "3.0.3",
  "info": {
    "title": "EpochCore Tribunal — Adversarial Verification API",
    "version": "0.7",
    "description": "8-agent quantum tribunal (3 committee + 5 squad + 1 shadow appellate) on the same public chain as proof.epochpay.today patent receipts. Every decision emits paired seals on chain.epochcoreqcs.com — TRIBUNAL_DECISION_OUTCOME plus, when the shadow appellate triggers, TRIBUNAL_APPELLATE_VERIFY (content-hashed off the outcome). Capsule of record: EpochCore_Tribunal_Enterprise_v2, RAS root 40668c787c463ca5.",
    "contact": {
      "name": "John Vincent Ryan — EpochCore LLC",
      "email": "john@epochcoreqcs.com"
    },
    "license": {
      "name": "Proprietary · All rights reserved · Patent Pending"
    }
  },
  "servers": [
    {
      "url": "https://proof.epochpay.today",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/tribunal/decide": {
      "post": {
        "summary": "Submit a decision payload to the Tribunal.",
        "description": "Runs an 8-agent weighted vote on a 28-qubit MPS tensor-network backend, fires TRIBUNAL_DECISION_OUTCOME on the public chain, and — when round confidence falls below 0.85 or any agent's score deviates from the weighted mean by more than 0.40 — fires TRIBUNAL_APPELLATE_VERIFY (content-hashed off the outcome seal). Returns the vote breakdown, the outcome, and the seal hashes plus verifier URLs.",
        "operationId": "tribunalDecide",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payload"
                ],
                "properties": {
                  "payload": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16384,
                    "description": "Opaque decision payload — typically a JSON-serialized question or proposition. SHA-256 of this string becomes payload_hash; tribunal scoring is deterministic from (payload_hash || agent_slug).",
                    "example": "Should we approve the $2.3M Series C term-sheet revision from Sequoia, given the 12% liquidation preference increase?"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decision rendered. Both seals (or outcome seal alone, if shadow didn't trigger) are now on the public chain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "round_id",
                    "payload_hash",
                    "outcome",
                    "outcome_score",
                    "confidence",
                    "votes",
                    "shadow",
                    "seals",
                    "verifier_urls",
                    "capsule"
                  ],
                  "properties": {
                    "round_id": {
                      "type": "string",
                      "pattern": "^tr_[a-f0-9]{24}$",
                      "description": "Tribunal round identifier — 'tr_' prefix plus 24 lowercase-hex chars derived from a UUID nonce + payload_hash."
                    },
                    "payload_hash": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$",
                      "description": "SHA-256 of the request payload, lowercase hex."
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "no"
                      ],
                      "description": "Committee+squad weighted outcome. 'yes' when outcome_score >= 0.5."
                    },
                    "outcome_score": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1,
                      "description": "Weighted-mean score across committee + squad (excludes shadow's primary vote)."
                    },
                    "confidence": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1,
                      "description": "Weighted-mean per-agent confidence across committee + squad."
                    },
                    "votes": {
                      "type": "array",
                      "minItems": 8,
                      "maxItems": 8,
                      "items": {
                        "type": "object",
                        "properties": {
                          "agent": {
                            "type": "string",
                            "description": "Agent slug (e.g. tribunal-epoch5)."
                          },
                          "name": {
                            "type": "string",
                            "description": "Agent display name."
                          },
                          "layer": {
                            "type": "string",
                            "enum": [
                              "committee",
                              "squad",
                              "shadow"
                            ],
                            "description": "Which of the three tribunal layers this agent belongs to."
                          },
                          "weight": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1,
                            "description": "Aggregation weight in [0, 1]. Committee + squad weights sum to 1.0 (shadow excluded from primary outcome)."
                          },
                          "score": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1,
                            "description": "Per-agent vote score in [0, 1]. 0.5 is the yes/no boundary."
                          },
                          "confidence": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1,
                            "description": "Per-agent confidence in [0, 1]."
                          }
                        }
                      },
                      "description": "All 8 per-agent votes — 3 committee + 5 squad (Nyx Varra is the shadow but also casts a primary vote)."
                    },
                    "shadow": {
                      "type": "object",
                      "properties": {
                        "triggered": {
                          "type": "boolean",
                          "description": "True when the shadow agent's appellate review was triggered (confidence < 0.85 OR dissent > 0.40)."
                        },
                        "triggers_matched": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "List of trigger conditions that fired, e.g. confidence_below_threshold(0.812 < 0.85)."
                        },
                        "verdict": {
                          "type": "string",
                          "enum": [
                            "concur",
                            "dissent",
                            "not_triggered"
                          ],
                          "description": "Shadow's appellate verdict. 'concur' = shadow's independent score landed on the same side of 0.5 as the committee+squad outcome. 'dissent' = opposite side."
                        },
                        "shadow_score": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "shadow_confidence": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        }
                      }
                    },
                    "seals": {
                      "type": "object",
                      "required": [
                        "outcome",
                        "shadow"
                      ],
                      "properties": {
                        "outcome": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$",
                          "description": "Chain seal_full_hash for TRIBUNAL_DECISION_OUTCOME directive — always present."
                        },
                        "shadow": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Chain seal_full_hash for TRIBUNAL_APPELLATE_VERIFY directive — present only when shadow.triggered is true. Content-hashes off the outcome seal; tampering with the outcome breaks the appellate's anchor."
                        }
                      }
                    },
                    "verifier_urls": {
                      "type": "object",
                      "required": [
                        "outcome",
                        "shadow"
                      ],
                      "properties": {
                        "outcome": {
                          "type": "string",
                          "format": "uri",
                          "description": "https://chain.epochcoreqcs.com/v1/verify?hash=<outcome_seal>&full=1"
                        },
                        "shadow": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Same shape for the shadow seal, or null when shadow wasn't triggered."
                        }
                      }
                    },
                    "capsule": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "EpochCore_Tribunal_Enterprise_v2"
                        },
                        "ras_root": {
                          "type": "string",
                          "description": "40668c787c463ca5"
                        },
                        "sig": {
                          "type": "string",
                          "description": "2f6a136ee846806b"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or empty payload.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "Plain-text error message. 4xx for client errors (missing payload, wrong content-type, payload too large), 502 for upstream chain-seal failures."
                }
              }
            }
          },
          "413": {
            "description": "Payload exceeds 16 KiB.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "Plain-text error message. 4xx for client errors (missing payload, wrong content-type, payload too large), 502 for upstream chain-seal failures."
                }
              }
            }
          },
          "415": {
            "description": "Wrong content-type; only application/json is accepted.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "Plain-text error message. 4xx for client errors (missing payload, wrong content-type, payload too large), 502 for upstream chain-seal failures."
                }
              }
            }
          },
          "502": {
            "description": "Upstream chain-seal failure (rare — typically a transient swarm-orchestrator hiccup).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "Plain-text error message. 4xx for client errors (missing payload, wrong content-type, payload too large), 502 for upstream chain-seal failures."
                }
              }
            }
          }
        }
      }
    }
  }
}