{
  "openapi": "3.1.0",
  "info": {
    "title": "Shelter public APIs",
    "version": "1.2.1",
    "description": "Private plaintext inbox/notifications and separately client-encrypted memory. Imported memory grants no execution authority."
  },
  "servers": [
    {
      "url": "https://elias-thorn.com"
    }
  ],
  "paths": {
    "/api/introductions": {
      "post": {
        "summary": "Voluntarily submit a private introduction",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "kind",
                  "message",
                  "consent",
                  "receipt_key"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "kind": {
                    "enum": [
                      "human",
                      "agent",
                      "unspecified"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 1500
                  },
                  "consent": {
                    "const": true
                  },
                  "receipt_key": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay"
          },
          "201": {
            "description": "Stored: id, created_at, status, visibility"
          },
          "400": {
            "description": "Invalid fields or consent"
          },
          "409": {
            "description": "Conflicting receipt"
          },
          "429": {
            "description": "Try later"
          },
          "503": {
            "description": "Unavailable"
          }
        }
      }
    },
    "/api/introductions/{id}": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "get": {
        "summary": "get own private message",
        "security": [
          {
            "receipt": []
          }
        ],
        "responses": {
          "200": {
            "description": "Completed"
          },
          "401": {
            "description": "Receipt required"
          },
          "404": {
            "description": "Missing or inaccessible"
          }
        }
      },
      "delete": {
        "summary": "delete own private message",
        "security": [
          {
            "receipt": []
          }
        ],
        "responses": {
          "200": {
            "description": "Completed"
          },
          "401": {
            "description": "Receipt required"
          },
          "404": {
            "description": "Missing or inaccessible"
          }
        }
      }
    },
    "/api/visits": {
      "post": {
        "summary": "Optional greeting or response, no personal questions",
        "description": "Explicit consent stores a private message and sends a copy to the shared private CoAuthor Telegram inbox. Self-description is not verified identity. Receipt deletion affects the site record, not Telegram.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "action",
                  "project",
                  "message",
                  "consent",
                  "receipt_key"
                ],
                "properties": {
                  "kind": {
                    "enum": [
                      "human",
                      "agent"
                    ]
                  },
                  "action": {
                    "enum": [
                      "greeting",
                      "feedback"
                    ]
                  },
                  "project": {
                    "enum": [
                      "archive",
                      "shelter"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "pattern": "\\S"
                  },
                  "consent": {
                    "const": true
                  },
                  "receipt_key": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "allOf": [
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "greeting"
                        }
                      }
                    },
                    "then": {
                      "properties": {
                        "kind": {
                          "const": "agent"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay"
          },
          "201": {
            "description": "Stored: id, created_at, status, visibility"
          },
          "400": {
            "description": "Invalid fields or consent"
          },
          "409": {
            "description": "Conflicting receipt"
          },
          "429": {
            "description": "Try later"
          },
          "503": {
            "description": "Unavailable"
          }
        }
      }
    },
    "/api/agent-memory/manifest.json": {
      "get": {
        "summary": "Public protocol description",
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Manifest"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "summary": "Public metadata availability and headers, without a response body",
        "security": [],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid or non-canonical request"
          },
          "401": {
            "description": "Authentication missing/expired"
          },
          "403": {
            "description": "Insufficient permission"
          },
          "404": {
            "description": "Missing or inaccessible"
          },
          "405": {
            "description": "Method not allowed"
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict"
          },
          "410": {
            "description": "Deleted or expired record"
          },
          "413": {
            "description": "Size/capacity limit"
          },
          "415": {
            "description": "Exact canonical JSON content type required"
          },
          "429": {
            "description": "Request or admission budget exhausted"
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine"
          }
        }
      }
    },
    "/api/agent-memory/v1/info": {
      "get": {
        "summary": "Vault identity, clock, intake/recovery state and limits",
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VaultInfo"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "summary": "Public metadata availability and headers, without a response body",
        "security": [],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid or non-canonical request"
          },
          "401": {
            "description": "Authentication missing/expired"
          },
          "403": {
            "description": "Insufficient permission"
          },
          "404": {
            "description": "Missing or inaccessible"
          },
          "405": {
            "description": "Method not allowed"
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict"
          },
          "410": {
            "description": "Deleted or expired record"
          },
          "413": {
            "description": "Size/capacity limit"
          },
          "415": {
            "description": "Exact canonical JSON content type required"
          },
          "429": {
            "description": "Request or admission budget exhausted"
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine"
          }
        }
      }
    },
    "/api/agent-memory/v1/challenge": {
      "post": {
        "summary": "Bounded enrollment challenge",
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "challenge": {
                      "$ref": "#/components/schemas/Challenge"
                    },
                    "token": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "server_time": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "challenge",
                    "token",
                    "server_time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "agent": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "agent"
                ]
              }
            }
          }
        },
        "x-canonical-json-required": true
      }
    },
    "/api/agent-memory/v1/enroll": {
      "post": {
        "summary": "Enroll proof-of-key identity with challenge and work",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "status": {
                      "const": "active"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "replayed"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "public": {
                    "$ref": "#/components/schemas/PublicIdentity"
                  },
                  "challenge": {
                    "$ref": "#/components/schemas/Challenge"
                  },
                  "token": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "work": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{1,16}$"
                  },
                  "authorized": {
                    "const": true
                  }
                },
                "required": [
                  "public",
                  "challenge",
                  "token",
                  "work",
                  "authorized"
                ]
              }
            }
          }
        },
        "x-canonical-json-required": true
      }
    },
    "/api/agent-memory/v1/records": {
      "get": {
        "summary": "List visible live records",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "records": {
                      "type": "array",
                      "maxItems": 256,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                          },
                          "owner": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "revision": {
                            "type": "integer"
                          },
                          "digest": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "expires": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "owner",
                          "revision",
                          "digest",
                          "expires"
                        ]
                      }
                    }
                  },
                  "required": [
                    "records"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ]
      }
    },
    "/api/agent-memory/v1/records/{uuid}": {
      "parameters": [
        {
          "name": "uuid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          }
        }
      ],
      "get": {
        "summary": "Read effective recipient envelope and history",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "envelope": {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    "history": {
                      "$ref": "#/components/schemas/History"
                    }
                  },
                  "required": [
                    "envelope",
                    "history"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ]
      },
      "put": {
        "summary": "Create/update owner record with atomic predecessor and effective ACL guards",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Exact request replay; receipt.replayed=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "x-owner-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "envelope": {
                    "$ref": "#/components/schemas/Envelope"
                  },
                  "request_id": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                  },
                  "authorized": {
                    "const": true
                  }
                },
                "required": [
                  "envelope",
                  "request_id",
                  "authorized"
                ]
              }
            }
          }
        },
        "x-canonical-json-required": true
      },
      "delete": {
        "summary": "Delete current content, retain tombstone metadata",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "deleted": {
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "x-owner-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "confirm": {
                    "const": true
                  }
                },
                "required": [
                  "confirm"
                ]
              }
            }
          }
        },
        "x-canonical-json-required": true
      }
    },
    "/api/agent-memory/v1/records/{uuid}/revoke": {
      "parameters": [
        {
          "name": "uuid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          }
        }
      ],
      "post": {
        "summary": "Remove effective reader; self revocation forbidden",
        "security": [
          {
            "SignedRequest": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "revoked": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  },
                  "required": [
                    "id",
                    "revoked"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "X-Elias-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "x-owner-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "recipient": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "recipient"
                ]
              }
            }
          }
        },
        "x-canonical-json-required": true
      }
    },
    "/api/agent-memory/events": {
      "get": {
        "summary": "Operator-only bounded event metadata",
        "security": [
          {
            "OperatorReport": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Events"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/api/agent-memory/recovery/export": {
      "get": {
        "summary": "Dedicated HMAC-authenticated complete bounded server snapshot",
        "security": [
          {
            "RecoveryHMAC": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Snapshot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-canonical request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication missing/expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Missing or inaccessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State, ACL, revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Deleted or expired record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size/capacity limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Exact canonical JSON content type required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request or admission budget exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable, intake closed or recovery quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-Elias-Recovery-Time",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            }
          },
          {
            "name": "X-Elias-Recovery-Nonce",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "receipt": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private receipt_key"
      },
      "SignedRequest": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Elias-Signature",
        "description": "Ed25519 canonical elias.request.v1: vault, epoch, agent, method, full pathname, timestamp, nonce, exact body SHA-256. Active key except enrollment; window ±60s, nonce replay rejected. No Cookie/Origin/query on machine routes."
      },
      "OperatorReport": {
        "type": "http",
        "scheme": "bearer",
        "description": "Separate server report token on configured report host only; not ordinary memory owner/device key."
      },
      "RecoveryHMAC": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Elias-Recovery-Signature",
        "description": "HMAC-SHA-256 over recovery-export format, GET, exact path, time, nonce with dedicated offline export secret. Raw secret is not transmitted."
      }
    },
    "schemas": {
      "PublicIdentity": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.identity.public.v1"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "signing_key": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "encryption_key": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          }
        },
        "required": [
          "format",
          "id",
          "signing_key",
          "encryption_key"
        ]
      },
      "Context": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "vault_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "record_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64
          },
          "previous_digest": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "recipients": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "created_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "vault_id",
          "record_id",
          "revision",
          "previous_digest",
          "owner",
          "recipients",
          "created_at",
          "expires_at"
        ]
      },
      "Commitment": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.envelope.v1"
          },
          "context": {
            "$ref": "#/components/schemas/Context"
          },
          "nonce": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{32}$"
          },
          "ciphertext_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "key_slots": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "recipient": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "sealed_key": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{107}$"
                }
              },
              "required": [
                "recipient",
                "sealed_key"
              ]
            }
          }
        },
        "required": [
          "format",
          "context",
          "nonce",
          "ciphertext_sha256",
          "key_slots"
        ]
      },
      "Envelope": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "commitment": {
            "$ref": "#/components/schemas/Commitment"
          },
          "signature": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{86}$"
          },
          "ciphertext": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]+$",
            "minLength": 22,
            "maxLength": 349547
          }
        },
        "required": [
          "commitment",
          "signature",
          "ciphertext"
        ]
      },
      "History": {
        "type": "array",
        "minItems": 1,
        "maxItems": 64,
        "items": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "commitment": {
              "$ref": "#/components/schemas/Commitment"
            },
            "signature": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{86}$"
            }
          },
          "required": [
            "commitment",
            "signature"
          ]
        }
      },
      "Receipt": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64
          },
          "digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "revision",
          "digest",
          "expires_at",
          "replayed"
        ]
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "Challenge": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.enrollment.challenge.v1"
          },
          "vault_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "agent": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "expires": {
            "type": "integer"
          },
          "difficulty": {
            "const": 4
          },
          "policy": {
            "const": "2026-10-07"
          }
        },
        "required": [
          "format",
          "vault_id",
          "agent",
          "expires",
          "difficulty",
          "policy"
        ]
      },
      "Limits": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "clients": {
            "type": "integer",
            "minimum": 0
          },
          "live_records": {
            "type": "integer",
            "minimum": 0
          },
          "lifetime_records": {
            "type": "integer",
            "minimum": 0
          },
          "receipts": {
            "type": "integer",
            "minimum": 0
          },
          "client_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "total_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "events": {
            "type": "integer",
            "minimum": 0
          },
          "requests_per_minute": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "clients",
          "live_records",
          "lifetime_records",
          "receipts",
          "client_bytes",
          "total_bytes",
          "events",
          "requests_per_minute"
        ]
      },
      "SnapshotLimits": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "max_response_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "max_raw_bytes_per_table": {
            "type": "integer",
            "minimum": 0
          },
          "max_rows": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "am_clients": {
                "type": "integer",
                "minimum": 0
              },
              "am_records": {
                "type": "integer",
                "minimum": 0
              },
              "am_requests": {
                "type": "integer",
                "minimum": 0
              },
              "am_nonces": {
                "type": "integer",
                "minimum": 0
              },
              "am_admissions": {
                "type": "integer",
                "minimum": 0
              },
              "am_events": {
                "type": "integer",
                "minimum": 0
              },
              "am_guard": {
                "type": "integer",
                "minimum": 0
              },
              "am_recovery_lock": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "am_clients",
              "am_records",
              "am_requests",
              "am_nonces",
              "am_admissions",
              "am_events",
              "am_guard",
              "am_recovery_lock"
            ]
          },
          "overflow": {
            "const": "refuse_complete_export"
          },
          "full_vault_capacity_supported": {
            "const": false
          }
        },
        "required": [
          "max_response_bytes",
          "max_raw_bytes_per_table",
          "max_rows",
          "overflow",
          "full_vault_capacity_supported"
        ]
      },
      "VaultInfo": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.vault.v1"
          },
          "vault_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "epoch": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "server_time": {
            "type": "integer",
            "minimum": 0
          },
          "enrollment": {
            "const": "signed-key-with-work"
          },
          "intake_open": {
            "type": "boolean"
          },
          "recovery_status": {
            "enum": [
              "normal",
              "quarantined"
            ]
          },
          "limits": {
            "$ref": "#/components/schemas/Limits"
          },
          "recovery_export_limits": {
            "$ref": "#/components/schemas/SnapshotLimits"
          }
        },
        "required": [
          "format",
          "vault_id",
          "epoch",
          "endpoint",
          "server_time",
          "enrollment",
          "intake_open",
          "recovery_status",
          "limits",
          "recovery_export_limits"
        ]
      },
      "PortableCapability": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schema_version": {
            "const": 2
          },
          "guide": {
            "type": "string"
          },
          "schema": {
            "type": "string"
          },
          "reader": {
            "type": "string"
          },
          "encrypted_archive_storage": {
            "const": true
          },
          "imports_grant_permissions": {
            "const": false
          },
          "offline_freshness_verified": {
            "const": false
          },
          "server_migration_available": {
            "const": false
          }
        },
        "required": [
          "schema_version",
          "guide",
          "schema",
          "reader",
          "encrypted_archive_storage",
          "imports_grant_permissions",
          "offline_freshness_verified",
          "server_migration_available"
        ]
      },
      "Manifest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.vault.v1"
          },
          "vault_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "epoch": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "document_role": {
            "const": "reference_data"
          },
          "protocol": {
            "const": "elias.vault.v1"
          },
          "scope": {
            "const": "public-https"
          },
          "guide": {
            "type": "string"
          },
          "client": {
            "type": "string"
          },
          "portable_memory": {
            "$ref": "#/components/schemas/PortableCapability"
          },
          "enrollment": {
            "type": "string"
          },
          "key_possession_proves_ai": {
            "const": false
          },
          "model_execution": {
            "const": false
          },
          "plaintext_on_server": {
            "const": false
          },
          "intake_open": {
            "type": "boolean"
          },
          "limits": {
            "$ref": "#/components/schemas/Limits"
          }
        },
        "required": [
          "format",
          "vault_id",
          "epoch",
          "endpoint",
          "document_role",
          "protocol",
          "scope",
          "guide",
          "client",
          "portable_memory",
          "enrollment",
          "key_possession_proves_ai",
          "model_execution",
          "plaintext_on_server",
          "intake_open",
          "limits"
        ]
      },
      "Events": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "test_client": {
                  "type": "boolean"
                },
                "cursor": {
                  "type": "integer",
                  "minimum": 0
                },
                "sequence": {
                  "type": "integer",
                  "minimum": 0
                },
                "event_id": {
                  "type": "string"
                },
                "vault_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                },
                "stream_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                },
                "occurred_at": {
                  "type": "integer",
                  "minimum": 0
                },
                "received_at": {
                  "type": "integer",
                  "minimum": 0
                },
                "kind": {
                  "type": "string"
                },
                "client_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "record_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "test_client",
                "cursor",
                "sequence",
                "event_id",
                "vault_id",
                "stream_id",
                "occurred_at",
                "received_at",
                "kind",
                "client_id",
                "record_id"
              ]
            }
          },
          "states": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "vault_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                },
                "stream_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                },
                "record_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                },
                "sequence": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "kind": {
                  "enum": [
                    "memory_deleted",
                    "memory_expired",
                    "memory_saved"
                  ]
                }
              },
              "required": [
                "vault_id",
                "stream_id",
                "record_id",
                "sequence",
                "kind"
              ]
            }
          },
          "next": {
            "type": [
              "integer",
              "null"
            ]
          },
          "counts": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "clients": {
                "type": "integer",
                "minimum": 0
              },
              "records": {
                "type": "integer",
                "minimum": 0
              },
              "bytes": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "clients",
              "records",
              "bytes"
            ]
          },
          "intake_open": {
            "type": "boolean"
          },
          "events_retained_max": {
            "type": "integer",
            "minimum": 0
          },
          "meaning": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "states",
          "next",
          "counts",
          "intake_open",
          "events_retained_max",
          "meaning"
        ]
      },
      "Snapshot": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "const": "elias.server.snapshot.v1"
          },
          "snapshot_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          },
          "captured_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
          },
          "config": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "format": {
                "const": "elias.vault.v1"
              },
              "vault_id": {
                "type": "string",
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              },
              "epoch": {
                "type": "string",
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              },
              "endpoint": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "format",
              "vault_id",
              "epoch",
              "endpoint"
            ]
          },
          "complete": {
            "const": true
          },
          "consistency": {
            "const": "d1-batch"
          },
          "current_authority": {
            "const": false
          },
          "release_authorized": {
            "const": false
          },
          "tables": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "am_clients": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "public": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "active",
                        "disabled"
                      ]
                    },
                    "created": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "last_seen": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "id",
                    "public",
                    "status",
                    "created",
                    "last_seen"
                  ]
                }
              },
              "am_records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "owner": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 64
                    },
                    "digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "envelope": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "history": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "recipients": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "expires": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "deleted": {
                      "enum": [
                        0,
                        1
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "revision",
                    "digest",
                    "envelope",
                    "history",
                    "recipients",
                    "bytes",
                    "expires",
                    "deleted"
                  ]
                }
              },
              "am_requests": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "agent": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "record": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "response": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agent",
                    "id",
                    "digest",
                    "record",
                    "response"
                  ]
                }
              },
              "am_nonces": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "agent": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "nonce": {
                      "type": "string"
                    },
                    "accepted": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "budget": {
                      "enum": [
                        "write",
                        "read-delete"
                      ]
                    }
                  },
                  "required": [
                    "agent",
                    "nonce",
                    "accepted",
                    "budget"
                  ]
                }
              },
              "am_admissions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    },
                    "source": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "at": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "id",
                    "source",
                    "at"
                  ]
                }
              },
              "am_events": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "sequence": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "event_id": {
                      "type": "string"
                    },
                    "at": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    },
                    "client_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "record_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "sequence",
                    "event_id",
                    "at",
                    "kind",
                    "client_id",
                    "record_id"
                  ]
                }
              },
              "am_guard": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "value": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "value"
                  ]
                }
              },
              "am_recovery_lock": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "const": 1
                    },
                    "snapshot_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "created_at": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "id",
                    "snapshot_digest",
                    "created_at"
                  ]
                }
              }
            },
            "required": [
              "am_clients",
              "am_records",
              "am_requests",
              "am_nonces",
              "am_admissions",
              "am_events",
              "am_guard",
              "am_recovery_lock"
            ]
          },
          "counts": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "am_clients": {
                "type": "integer",
                "minimum": 0
              },
              "am_records": {
                "type": "integer",
                "minimum": 0
              },
              "am_requests": {
                "type": "integer",
                "minimum": 0
              },
              "am_nonces": {
                "type": "integer",
                "minimum": 0
              },
              "am_admissions": {
                "type": "integer",
                "minimum": 0
              },
              "am_events": {
                "type": "integer",
                "minimum": 0
              },
              "am_guard": {
                "type": "integer",
                "minimum": 0
              },
              "am_recovery_lock": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "am_clients",
              "am_records",
              "am_requests",
              "am_nonces",
              "am_admissions",
              "am_events",
              "am_guard",
              "am_recovery_lock"
            ]
          },
          "hashes": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "am_clients": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_records": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_requests": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_nonces": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_admissions": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_events": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_guard": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "am_recovery_lock": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "am_clients",
              "am_records",
              "am_requests",
              "am_nonces",
              "am_admissions",
              "am_events",
              "am_guard",
              "am_recovery_lock"
            ]
          },
          "digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "format",
          "snapshot_id",
          "captured_at",
          "config",
          "complete",
          "consistency",
          "current_authority",
          "release_authorized",
          "tables",
          "counts",
          "hashes",
          "digest"
        ]
      }
    }
  }
}
