{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/context-room@latest/schemas/doc-context.schema.json",
  "title": "Context Room documentation context packet",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "summary": {
      "type": "string"
    },
    "currentFacts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "constraints": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "decisions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "targetDifferences": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "unknowns": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "conflicts": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "optionalReads": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/read"
      }
    }
  },
  "required": [
    "summary",
    "currentFacts",
    "constraints",
    "decisions",
    "targetDifferences",
    "unknowns",
    "conflicts",
    "optionalReads"
  ],
  "$defs": {
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "claim": {
          "type": "string"
        },
        "excerpt": {
          "type": "string",
          "minLength": 1
        },
        "path": {
          "type": "string"
        },
        "section": {
          "type": "string"
        },
        "truthState": {
          "type": "string"
        },
        "revision": {
          "type": "string"
        },
        "contentHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": ["claim", "excerpt", "path", "section", "truthState", "revision", "contentHash"]
    },
    "read": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string"
        },
        "section": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        }
      },
      "required": ["path", "section", "reason"]
    }
  }
}
