{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opentine.com/schemas/opentine-memory-1.schema.json",
  "title": "opentine.memory (memory_version 1)",
  "description": "One signed team-memory note (SPEC 4.22): a scope, a topic, at most 8 KiB of text, sorted distinct tags, an optional subject (run or blob) and an optional note it supersedes. `signature` is an Ed25519 tine-sig/3 block over `opentine.memory.v1:` + JCS({body, header}); a reader keeps notes its team's keys signed.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "kind",
    "memory_version",
    "scope",
    "topic",
    "text",
    "tags",
    "subject",
    "supersedes",
    "author",
    "created_at",
    "signature"
  ],
  "properties": {
    "kind": {
      "const": "opentine.memory"
    },
    "memory_version": {
      "const": 1
    },
    "scope": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
    },
    "topic": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
    },
    "text": {
      "type": "string",
      "minLength": 1
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9._:-]{0,63}$"
      },
      "maxItems": 32
    },
    "subject": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^(run|blob):sha256:[0-9a-f]{64}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "supersedes": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^blob:sha256:[0-9a-f]{64}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "author": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.:/@+-]{1,256}$"
    },
    "created_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "signature": {
      "$ref": "tine-sig-3.schema.json"
    }
  }
}
