{
  "openapi": "3.1.0",
  "info": {
    "title": "MMI Deterministic Agent API",
    "version": "v1.2026-01-01",
    "description": "Deterministic public API for site-tree, FAQ, query, and semantic search endpoints for AI agents."
  },
  "servers": [
    {
      "url": "https://mmitheory.com"
    }
  ],
  "paths": {
    "/query": {
      "options": {
        "summary": "CORS preflight for /query",
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      },
      "post": {
        "summary": "Deterministic question answering over public corpus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful deterministic answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/search": {
      "options": {
        "summary": "CORS preflight for /search",
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      },
      "post": {
        "summary": "Deterministic semantic lexical search over public corpus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful deterministic search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/site-tree": {
      "get": {
        "summary": "Machine-readable canonical site tree",
        "responses": {
          "200": {
            "description": "Site tree response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteTreeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/faq": {
      "get": {
        "summary": "Machine-readable FAQ entries",
        "responses": {
          "200": {
            "description": "FAQ response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FaqResponse"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/agent-capabilities.json": {
      "get": {
        "summary": "Agent capabilities descriptor",
        "responses": {
          "200": {
            "description": "Capabilities document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/pricing.json": {
      "get": {
        "summary": "Machine-readable pricing metadata",
        "responses": {
          "200": {
            "description": "Pricing response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/status.json": {
      "get": {
        "summary": "Machine-readable service status metadata",
        "responses": {
          "200": {
            "description": "Status response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/facts.json": {
      "get": {
        "summary": "Machine-readable deterministic facts metadata",
        "responses": {
          "200": {
            "description": "Facts response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "Determinism": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "no_sampling",
          "stable_ranking",
          "version_pinned"
        ],
        "properties": {
          "no_sampling": {
            "type": "boolean",
            "const": true
          },
          "stable_ranking": {
            "type": "boolean",
            "const": true
          },
          "version_pinned": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "Citation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "title",
          "content_hash",
          "snippet"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "content_hash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "snippet": {
            "type": "string"
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "title",
          "excerpt",
          "content_hash",
          "score"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "excerpt": {
            "type": "string"
          },
          "content_hash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      },
      "QueryRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "question",
          "version_tag"
        ],
        "properties": {
          "question": {
            "type": "string",
            "minLength": 1
          },
          "version_tag": {
            "type": "string",
            "const": "v1"
          }
        }
      },
      "QueryResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "answer",
          "citations",
          "confidence",
          "schema_version",
          "api_version",
          "corpus_version",
          "model_version",
          "determinism"
        ],
        "properties": {
          "answer": {
            "type": "string"
          },
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Citation"
            }
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "schema_version": {
            "type": "string",
            "const": "2026-01-01"
          },
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "corpus_version": {
            "type": "string"
          },
          "model_version": {
            "type": "string"
          },
          "determinism": {
            "$ref": "#/components/schemas/Determinism"
          }
        }
      },
      "SearchRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query",
          "top_k",
          "version_tag"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1
          },
          "top_k": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "version_tag": {
            "type": "string",
            "const": "v1"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query",
          "top_k",
          "results",
          "schema_version",
          "api_version",
          "corpus_version",
          "model_version",
          "determinism"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "top_k": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "schema_version": {
            "type": "string",
            "const": "2026-01-01"
          },
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "corpus_version": {
            "type": "string"
          },
          "model_version": {
            "type": "string"
          },
          "determinism": {
            "$ref": "#/components/schemas/Determinism"
          }
        }
      },
      "SiteTreeResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "routes",
          "schema_version",
          "api_version",
          "corpus_version",
          "model_version",
          "determinism"
        ],
        "properties": {
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "path",
                "title",
                "description"
              ],
              "properties": {
                "path": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "schema_version": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          },
          "corpus_version": {
            "type": "string"
          },
          "model_version": {
            "type": "string"
          },
          "determinism": {
            "$ref": "#/components/schemas/Determinism"
          }
        }
      },
      "FaqResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "faqs",
          "schema_version",
          "api_version",
          "corpus_version",
          "model_version",
          "determinism"
        ],
        "properties": {
          "faqs": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "question",
                "answer",
                "url"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "question": {
                  "type": "string"
                },
                "answer": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "schema_version": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          },
          "corpus_version": {
            "type": "string"
          },
          "model_version": {
            "type": "string"
          },
          "determinism": {
            "$ref": "#/components/schemas/Determinism"
          }
        }
      }
    }
  }
}
