{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://getzero.dev/contracts/zero.intent.v1.schema.json",
  "title": "zero.intent.v1",
  "description": "The composer's intent envelope (COMPOSER-SPEC §3.1). Idempotent, mortal, carries NO secret material. Emitted by source:composer; the engine re-derives class and is authoritative.",
  "type": "object",
  "required": [
    "schema",
    "intent_id",
    "source",
    "surface",
    "text",
    "class_floor",
    "idempotency_key",
    "expires_at",
    "attachments",
    "evidence_request",
    "signature"
  ],
  "additionalProperties": false,
  "properties": {
    "schema": { "const": "zero.intent.v1" },
    "intent_id": { "type": "string", "pattern": "^in_[0-9A-Z]{26}$" },
    "source": { "const": "composer" },
    "surface": { "enum": ["guest", "trade", "operate", "studio"] },
    "text": { "type": "string", "description": "the operator's words, VERBATIM — never rewritten" },
    "verb": { "type": ["string", "null"] },
    "target": { "type": ["string", "null"] },
    "args": { "type": "object" },
    "class_floor": { "type": "integer", "minimum": 0, "maximum": 5 },
    "tier": { "enum": ["T0", "T1", "T2", "T3", null] },
    "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
    "idempotency_key": { "type": "string", "minLength": 1 },
    "expires_at": { "type": "string", "format": "date-time" },
    "attachments": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "kind", "label"],
        "properties": {
          "id": { "type": "string" },
          "kind": { "enum": ["lens", "receipt", "replay", "policy", "account"] },
          "label": { "type": "string" }
        }
      }
    },
    "evidence_request": { "enum": ["live", "replay", "simulation"] },
    "signature": {
      "type": ["string", "null"],
      "description": "null at emit; a real fresh signature is bound engine-side at the gate. Never a secret."
    }
  }
}
