{
  "components": {
    "schemas": {
      "AssertFactRequest": {
        "description": "REST API request body for POST /v1/facts.",
        "properties": {
          "data": {
            "additionalProperties": true,
            "title": "Data",
            "type": "object"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "template",
          "data"
        ],
        "title": "AssertFactRequest",
        "type": "object"
      },
      "AssertFactResponse": {
        "description": "REST API response body from POST /v1/facts.",
        "properties": {
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "title": "AssertFactResponse",
        "type": "object"
      },
      "CompileRequest": {
        "description": "REST API request body for the compile endpoint.",
        "properties": {
          "yaml_content": {
            "maxLength": 1000000,
            "title": "Yaml Content",
            "type": "string"
          }
        },
        "required": [
          "yaml_content"
        ],
        "title": "CompileRequest",
        "type": "object"
      },
      "CompileResponse": {
        "description": "REST API response body from the compile endpoint.",
        "properties": {
          "clips": {
            "title": "Clips",
            "type": "string"
          },
          "errors": {
            "items": {
              "type": "string"
            },
            "title": "Errors",
            "type": "array"
          }
        },
        "required": [
          "clips"
        ],
        "title": "CompileResponse",
        "type": "object"
      },
      "EvaluateRequest": {
        "description": "REST API request body for the evaluate endpoint.",
        "properties": {
          "facts": {
            "items": {
              "$ref": "#/components/schemas/FactInput"
            },
            "title": "Facts",
            "type": "array"
          },
          "ruleset": {
            "title": "Ruleset",
            "type": "string"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          }
        },
        "required": [
          "facts",
          "ruleset"
        ],
        "title": "EvaluateRequest",
        "type": "object"
      },
      "EvaluateResponse": {
        "description": "REST API response body from the evaluate endpoint.",
        "properties": {
          "attestation_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Attestation Token"
          },
          "decision": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision"
          },
          "duration_us": {
            "title": "Duration Us",
            "type": "integer"
          },
          "module_trace": {
            "items": {
              "type": "string"
            },
            "title": "Module Trace",
            "type": "array"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "rule_trace": {
            "items": {
              "type": "string"
            },
            "title": "Rule Trace",
            "type": "array"
          }
        },
        "required": [
          "decision",
          "reason",
          "rule_trace",
          "module_trace",
          "duration_us"
        ],
        "title": "EvaluateResponse",
        "type": "object"
      },
      "FactInput": {
        "description": "REST API input for a single fact assertion.",
        "properties": {
          "data": {
            "additionalProperties": true,
            "title": "Data",
            "type": "object"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "template",
          "data"
        ],
        "title": "FactInput",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "QueryFactsRequest": {
        "description": "REST API request body for POST /v1/query.",
        "properties": {
          "filter": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filter"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "template"
        ],
        "title": "QueryFactsRequest",
        "type": "object"
      },
      "QueryFactsResponse": {
        "description": "REST API response body from POST /v1/query.",
        "properties": {
          "facts": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Facts",
            "type": "array"
          }
        },
        "required": [
          "facts"
        ],
        "title": "QueryFactsResponse",
        "type": "object"
      },
      "RetractFactsRequest": {
        "description": "REST API request body for DELETE /v1/facts.",
        "properties": {
          "filter": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filter"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "template"
        ],
        "title": "RetractFactsRequest",
        "type": "object"
      },
      "RetractFactsResponse": {
        "description": "REST API response body from DELETE /v1/facts.",
        "properties": {
          "retracted_count": {
            "title": "Retracted Count",
            "type": "integer"
          }
        },
        "required": [
          "retracted_count"
        ],
        "title": "RetractFactsResponse",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Deterministic reasoning runtime for AI agents",
    "title": "Fathom Rules Engine",
    "version": "0.3.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/health": {
      "get": {
        "description": "Health check endpoint.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Health Health Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Health"
      }
    },
    "/v1/compile": {
      "post": {
        "description": "Compile YAML content into CLIPS constructs.",
        "operationId": "compile_yaml_v1_compile_post",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompileResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Compile Yaml"
      }
    },
    "/v1/evaluate": {
      "post": {
        "description": "Evaluate facts against a ruleset (stateless or stateful).",
        "operationId": "evaluate_v1_evaluate_post",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvaluateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Evaluate"
      }
    },
    "/v1/facts": {
      "delete": {
        "description": "Retract facts matching template + optional filter from working memory.\n\nThe ``session_id`` must reference an existing session created via\n``/v1/evaluate``. Unknown session ids return 404. Retract is by\ntemplate + filter (matches the gRPC surface), not by fact index.",
        "operationId": "retract_facts_v1_facts_delete",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetractFactsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetractFactsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Retract Facts"
      },
      "post": {
        "description": "Assert a single fact into a session's working memory.\n\nUnlike ``/v1/evaluate``, this endpoint does **not** create sessions on\nthe fly \u2014 the ``session_id`` must reference a session previously\ncreated via ``/v1/evaluate``. Unknown session ids return 404.",
        "operationId": "assert_fact_v1_facts_post",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssertFactRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssertFactResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Assert Fact"
      }
    },
    "/v1/modules": {
      "get": {
        "description": "Return all registered module definitions for a session.",
        "operationId": "list_modules_v1_modules_get",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Session-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Session-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Modules V1 Modules Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Modules"
      }
    },
    "/v1/query": {
      "post": {
        "description": "Query a session's working memory for facts matching template + filter.\n\nThe ``session_id`` must reference an existing session created via\n``/v1/evaluate``. Unknown session ids return 404.",
        "operationId": "query_facts_v1_query_post",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryFactsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryFactsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Query Facts"
      }
    },
    "/v1/rules": {
      "get": {
        "description": "Return all loaded rule definitions for a session.",
        "operationId": "list_rules_v1_rules_get",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Session-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Session-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Rules V1 Rules Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Rules"
      }
    },
    "/v1/templates": {
      "get": {
        "description": "Return all registered template definitions for a session.",
        "operationId": "list_templates_v1_templates_get",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Session-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Session-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Templates V1 Templates Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Templates"
      }
    }
  }
}