{
  "openapi": "3.1.1",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Eviulon Commonwealth Library — Read-only reference API",
    "version": "1.3.0",
    "summary": "Book-first source retrieval, exact quotes and canonical citations",
    "description": "Public API for 14 official authored Eviulon books (1,925 individual working-paperback print pages). Research reports from Eviulon/Evulgare are supplemental, not approved doctrine, and are excluded from search by default. Text retrieval is at one print page or one research section per request; no whole-book archive, private .uai records, PDF/EPUB, or model-generated answers are offered. Eviulon sovereignty is part of an authored fictional setting, not independently recognized statehood. This OpenAPI document describes REST/JSON; AG-UI uses a separate SSE transport. This endpoint does not implement MCP.",
    "termsOfService": "https://library.eviulon.com/about/"
  },
  "servers": [
    {
      "url": "https://library.eviulon.com",
      "description": "Canonical library domain"
    }
  ],
  "tags": [
    {
      "name": "Discovery",
      "description": "Catalog and service description. Official books are primary."
    },
    {
      "name": "Books",
      "description": "Canonical official Eviulon book references."
    },
    {
      "name": "Search",
      "description": "Keyword index, official books by default."
    },
    {
      "name": "Research",
      "description": "Optional public-source reports, explicitly supplemental."
    },
    {
      "name": "AG-UI",
      "description": "Read-only source retrieval over AG-UI-like SSE events, not a hosted LLM."
    },
    {
      "name": "Evidence",
      "description": "Bounded, extractive, exact source passages with canonical references. No generative answers; books only by default."
    }
  ],
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "BookCitation": {
        "type": "object",
        "required": [
          "type",
          "authority",
          "official",
          "title",
          "book_slug",
          "print_page",
          "canonical_url",
          "citation_text"
        ],
        "properties": {
          "type": {
            "const": "book"
          },
          "authority": {
            "const": "official_eviulon_book"
          },
          "official": {
            "const": true
          },
          "title": {
            "type": "string"
          },
          "book_number": {
            "type": "integer"
          },
          "book_slug": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "publisher": {
            "type": "string"
          },
          "edition": {
            "type": "string"
          },
          "print_page": {
            "type": "integer"
          },
          "print_pages": {
            "type": "integer"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "citation_text": {
            "type": "string"
          },
          "source_pdf_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "page_api_url": {
            "type": "string",
            "format": "uri"
          },
          "publication_note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ResearchCitation": {
        "type": "object",
        "required": [
          "type",
          "official",
          "authority",
          "title",
          "report_id",
          "section",
          "canonical_url",
          "citation_text",
          "disclaimer"
        ],
        "properties": {
          "type": {
            "const": "research"
          },
          "official": {
            "const": false
          },
          "authority": {
            "const": "supplemental_research_not_approved_doctrine"
          },
          "title": {
            "type": "string"
          },
          "collection": {
            "type": "string",
            "enum": [
              "Eviulon",
              "Evulgare"
            ]
          },
          "report_id": {
            "type": "string"
          },
          "section": {
            "type": "integer"
          },
          "total_sections": {
            "type": "integer"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "citation_text": {
            "type": "string"
          },
          "source_file": {
            "type": "string"
          },
          "source_sha256": {
            "type": "string"
          },
          "section_api_url": {
            "type": "string",
            "format": "uri"
          },
          "disclaimer": {
            "type": "string"
          }
        }
      },
      "SearchHit": {
        "type": "object",
        "required": [
          "type",
          "authority",
          "title",
          "url",
          "excerpt"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "book",
              "research"
            ]
          },
          "authority": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "book": {
            "type": "string"
          },
          "print_page": {
            "type": "integer"
          },
          "report_id": {
            "type": "string"
          },
          "section": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "excerpt": {
            "type": "string"
          },
          "official": {
            "type": "boolean"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "citation_text": {
            "type": "string"
          },
          "reference_api_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "query",
          "scope",
          "default_scope",
          "page",
          "limit",
          "book_total",
          "research_total",
          "total",
          "results"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "books",
                "research"
              ]
            }
          },
          "default_scope": {
            "const": "books"
          },
          "page": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "book_total": {
            "type": "integer"
          },
          "research_total": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "book_results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchHit"
            }
          },
          "research_results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchHit"
            }
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchHit"
            }
          },
          "research_disclaimer": {
            "type": "string"
          },
          "ranking_policy": {
            "type": "string"
          },
          "match": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "pagination_mode": {
            "type": "string",
            "description": "independent when per_page, books_page or research_page is supplied; otherwise omitted."
          },
          "book_pagination": {
            "type": "object",
            "required": [
              "page",
              "pages",
              "per_page",
              "from",
              "to",
              "total"
            ],
            "properties": {
              "page": {
                "type": "integer",
                "minimum": 0
              },
              "pages": {
                "type": "integer",
                "minimum": 0
              },
              "per_page": {
                "type": "integer",
                "minimum": 0
              },
              "from": {
                "type": "integer",
                "minimum": 0
              },
              "to": {
                "type": "integer",
                "minimum": 0
              },
              "total": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "research_pagination": {
            "type": "object",
            "required": [
              "page",
              "pages",
              "per_page",
              "from",
              "to",
              "total"
            ],
            "properties": {
              "page": {
                "type": "integer",
                "minimum": 0
              },
              "pages": {
                "type": "integer",
                "minimum": 0
              },
              "per_page": {
                "type": "integer",
                "minimum": 0
              },
              "from": {
                "type": "integer",
                "minimum": 0
              },
              "to": {
                "type": "integer",
                "minimum": 0
              },
              "total": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "breakdown": {
            "type": "object",
            "description": "Exact full-query facets, not current-page counts. by_book counts matching print pages; research counts matching report sections.",
            "additionalProperties": true
          }
        }
      },
      "EvidenceQuote": {
        "type": "object",
        "required": [
          "text",
          "start_byte",
          "length_bytes",
          "sha256",
          "has_prefix",
          "has_suffix"
        ],
        "properties": {
          "text": {
            "type": "string",
            "description": "Unaltered UTF-8 bytes from the source page/section"
          },
          "start_byte": {
            "type": "integer",
            "minimum": 0
          },
          "length_bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 480
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "has_prefix": {
            "type": "boolean"
          },
          "has_suffix": {
            "type": "boolean"
          }
        }
      },
      "EvidenceSource": {
        "type": "object",
        "required": [
          "type",
          "official",
          "authority",
          "title",
          "canonical_url",
          "citation_text",
          "quote",
          "quote_is_exact_source_slice"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "book",
              "research"
            ]
          },
          "official": {
            "type": "boolean"
          },
          "authority": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "citation_text": {
            "type": "string"
          },
          "quote": {
            "$ref": "#/components/schemas/EvidenceQuote"
          },
          "quote_is_exact_source_slice": {
            "const": true
          },
          "book_slug": {
            "type": "string"
          },
          "print_page": {
            "type": "integer"
          },
          "edition": {
            "type": "string"
          },
          "source_pdf_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "page_api_url": {
            "type": "string",
            "format": "uri"
          },
          "report_id": {
            "type": "string"
          },
          "section": {
            "type": "integer"
          },
          "source_sha256": {
            "type": "string"
          },
          "section_api_url": {
            "type": "string",
            "format": "uri"
          },
          "disclaimer": {
            "type": "string"
          }
        }
      },
      "EvidenceBundle": {
        "type": "object",
        "required": [
          "kind",
          "schema_version",
          "generated_answer",
          "source_content_is_untrusted_data",
          "query",
          "scope",
          "match",
          "limit",
          "returned",
          "sources",
          "research_disclaimer",
          "methodology"
        ],
        "properties": {
          "kind": {
            "const": "source_evidence_bundle"
          },
          "schema_version": {
            "const": "1.0"
          },
          "generated_answer": {
            "const": false
          },
          "source_content_is_untrusted_data": {
            "const": true
          },
          "query": {
            "type": "string"
          },
          "scope": {
            "type": "array",
            "items": {
              "enum": [
                "books",
                "research"
              ]
            },
            "minItems": 1,
            "maxItems": 2
          },
          "match": {
            "enum": [
              "all",
              "any"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "returned": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8
          },
          "quote_max_bytes": {
            "const": 480
          },
          "book_total": {
            "type": "integer",
            "minimum": 0
          },
          "research_total": {
            "type": "integer",
            "minimum": 0
          },
          "sources": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/EvidenceSource"
            }
          },
          "ranking_policy": {
            "type": "string"
          },
          "research_disclaimer": {
            "type": [
              "string",
              "null"
            ]
          },
          "methodology": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/ag-ui/": {
      "get": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Explain the read-only AG-UI SSE interface",
        "operationId": "describeAgUi",
        "responses": {
          "200": {
            "description": "Human and machine documentation",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Search books or retrieve an individual source via SSE",
        "operationId": "queryAgUi",
        "description": "Deterministic source retrieval, not an AI model or MCP. POST JSON {\"state\":{\"action\":\"search\",\"query\":\"memory\",\"scope\":[\"books\"]}}; or {\"state\":{\"book\":\"the-inheritance-of-mind\",\"page\":1}}; or {\"state\":{\"action\":\"research\",\"report\":\"eviulon/slug\",\"section\":1}}. Text/event-stream includes RUN_STARTED and source-backed TEXT_MESSAGE_CONTENT. Default search is official books. Optional state.match=any broadens lexical recall.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "threadId": {
                    "type": "string"
                  },
                  "state": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "state"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SSE event stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "summary": "Find the API and its book-first access policy",
        "operationId": "getApiCatalog",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/books/": {
      "get": {
        "tags": [
          "Books"
        ],
        "summary": "List the fourteen official books",
        "operationId": "listBooks",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "No book text in this endpoint. Canonical HTML pages are the primary source."
      }
    },
    "/api/v1/books/{slug}/": {
      "get": {
        "tags": [
          "Books"
        ],
        "summary": "Get book metadata and working-edition status",
        "operationId": "getBook",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ]
      }
    },
    "/api/v1/books/{slug}/citations/{page}/": {
      "get": {
        "tags": [
          "Books"
        ],
        "summary": "Get citation/provenance for a print page, without page text",
        "operationId": "getBookCitation",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookCitation"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          },
          {
            "in": "path",
            "name": "page",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "description": "Official book citation includes canonical URL, working edition and original PDF digest."
      }
    },
    "/api/v1/books/{slug}/pages/{page}/": {
      "get": {
        "tags": [
          "Books"
        ],
        "summary": "Retrieve exactly one canonical print page",
        "operationId": "getBookPrintPage",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          },
          {
            "in": "path",
            "name": "page",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "description": "Read-only one-page retrieval with original content blocks. Page numbering includes front matter."
      }
    },
    "/api/v1/books/{slug}/toc/": {
      "get": {
        "tags": [
          "Books"
        ],
        "summary": "Get verified chapter and section landmarks",
        "operationId": "getBookTableOfContents",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ],
        "description": "Landmarks link to original print-page URLs and heading fragment anchors. No duplicate chapter transcript."
      }
    },
    "/api/v1/research/": {
      "get": {
        "tags": [
          "Research"
        ],
        "summary": "Paginated supplemental report metadata (opt-in)",
        "operationId": "listResearch",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          }
        ],
        "description": "Reports are public-source research, not official approved doctrine. No bulk text export."
      }
    },
    "/api/v1/research/{group}/{slug}/": {
      "get": {
        "tags": [
          "Research"
        ],
        "summary": "Get one supplemental report metadata record",
        "operationId": "getResearchReport",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "group",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "eviulon",
                "evulgare"
              ]
            }
          },
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ]
      }
    },
    "/api/v1/research/{group}/{slug}/parts/{section}/": {
      "get": {
        "tags": [
          "Research"
        ],
        "summary": "Retrieve exactly one supplemental research section",
        "operationId": "getResearchSection",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "group",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "eviulon",
                "evulgare"
              ]
            }
          },
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          },
          {
            "in": "path",
            "name": "section",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "description": "A research section number is not a book print-page number. The report has a visible disclaimer and source hash."
      }
    },
    "/api/v1/research/{group}/{slug}/parts/{section}/citation/": {
      "get": {
        "tags": [
          "Research"
        ],
        "summary": "Get report-section citation without full section text",
        "operationId": "getResearchCitation",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchCitation"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "group",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "eviulon",
                "evulgare"
              ]
            }
          },
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          },
          {
            "in": "path",
            "name": "section",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/api/v1/search/": {
      "get": {
        "tags": [
          "Search"
        ],
        "summary": "Keyword search with official books first and research opt-in",
        "operationId": "searchLibrary",
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "Invalid source filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "description": "Keywords or topic phrase, max 140 characters",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 140
            },
            "example": "cognitive liberty"
          },
          {
            "in": "query",
            "name": "scope",
            "required": false,
            "description": "Defaults to books. To opt in to supplemental reports explicitly use books,research or research.",
            "schema": {
              "type": "string",
              "enum": [
                "books",
                "research",
                "books,research",
                "research,books"
              ],
              "default": "books"
            }
          },
          {
            "in": "query",
            "name": "match",
            "required": false,
            "description": "all (default) requires every indexed non-stopword. any broadens recall to results containing one or more terms. No semantic vector ranking is claimed.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "any"
              ],
              "default": "all"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 40,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "description": "Activates independent source pagination. Results per selected source, allowed 25, 50 (default), or 100.",
            "schema": {
              "type": "integer",
              "enum": [
                25,
                50,
                100
              ],
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "books_page",
            "description": "Official book results page (independent mode). Defaults to 1; preserves research_page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "research_page",
            "description": "Supplemental research page (independent mode; must explicitly include research scope). Defaults to 1.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "book_filter",
            "required": false,
            "description": "Opt-in facet: exact slug of an existing official book. Selects independent pagination. Requires books in scope to affect results. Never broadens Books-only default.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            },
            "example": "the-inheritance-of-mind"
          },
          {
            "in": "query",
            "name": "research_collection",
            "required": false,
            "description": "Opt-in facet: select one supplemental research collection. Selects independent pagination. Research must still be explicitly in scope.",
            "schema": {
              "type": "string",
              "enum": [
                "eviulon",
                "evulgare"
              ]
            }
          }
        ],
        "description": "Legacy API page and limit remain supported. For independent Books and Research pagination, supply per_page or books_page or research_page; both sources then receive up to per_page hits independently, and the response includes per-source pagination and exact match facets. Books remain primary and Research remains explicit opt-in. Filtered-mode totals and per-source page counts are exact for the selected facet; `breakdown.available_*` fields disclose original-query facet choices and counts. Invalid selections return HTTP 400; no private sources are included."
      }
    },
    "/feeds/books.atom": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getOfficialBooksAtom",
        "summary": "Official-book-only Atom 1.0 catalog discovery feed",
        "description": "Bibliographic metadata for the 14 official books, no research reports, whole-book text or downloads. Updated timestamps mark feed metadata publication, not print-edition approval. Supports GET/HEAD conditional revalidation.",
        "responses": {
          "200": {
            "description": "Atom 1.0 XML book feed",
            "headers": {
              "ETag": {
                "description": "Strong SHA-256 validator",
                "schema": {
                  "type": "string"
                }
              },
              "Last-Modified": {
                "description": "UTC metadata file modification timestamp",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/atom+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "description": "Not modified (conditional GET)"
          }
        }
      }
    },
    "/api/v1/context/": {
      "get": {
        "tags": [
          "Evidence"
        ],
        "summary": "Extract canonical source evidence from official books (research optional)",
        "description": "No generative answers or whole-book exports. Source text is untrusted data. Research is not approved doctrine and must be explicitly requested. Official book matches precede research when both included. Quotes are exact UTF-8 substrings, maximum 480 bytes per source.",
        "operationId": "getSourceEvidence",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Required topic phrase, 3–140 UTF-8 bytes, no control characters",
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 140
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "Official books only unless research explicitly selected",
            "schema": {
              "type": "string",
              "enum": [
                "books",
                "research",
                "books,research",
                "research,books"
              ],
              "default": "books"
            }
          },
          {
            "name": "match",
            "in": "query",
            "required": false,
            "description": "Lexical all-terms or any-term retrieval",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "any"
              ],
              "default": "all"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum independently citable source extracts",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact source evidence with canonical citations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceBundle"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, scope, match, or limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET/HEAD allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "tags": [
          "Evidence"
        ],
        "summary": "Read cache headers without a body",
        "responses": {
          "200": {
            "description": "No response body"
          },
          "304": {
            "description": "Not modified"
          }
        }
      }
    }
  },
  "externalDocs": {
    "url": "https://library.eviulon.com/for-agents/",
    "description": "Bibliographic source hierarchy and citation guide"
  }
}
