{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://graph-paper.io/docs/schema/export-envelope.schema.json",
  "title": "Graph Paper export file envelope",
  "description": "The top-level `.json` export file (see https://graph-paper.io/docs/notebook-file-format.md §2). Wraps one or more documents. A `type: \"notebook\"` entry's `content` should additionally validate against notebook-content.schema.json.",
  "type": "object",
  "required": ["formatVersion", "documents"],
  "properties": {
    "formatVersion": { "const": 1 },
    "exportedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (informational)."
    },
    "documents": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["title", "type", "contentHash", "createdAt", "content"],
        "properties": {
          "title": { "type": "string" },
          "type": {
            "type": "string",
            "description": "e.g. \"notebook\" or \"plot\"."
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Lowercase hex SHA-256 of the stable-stringified `content` (§4)."
          },
          "createdAt": { "type": "string" },
          "content": { "type": "object" },
          "cache": {
            "type": "object",
            "description": "RESERVED, OPTIONAL cached-output sidecar (Notebook Format Evolution §8) — a non-authoritative, derived bag of last compute outputs that may travel BESIDE `content`. It is OUTSIDE `contentHash` by construction (the hash covers `content` only) and is IGNORED on import (a local performance hint, not portable state). Phase 1 exporters OMIT it; an importer that does not understand it ignores it."
          }
        }
      }
    }
  }
}
