{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://corank-prompt-source-gap-triage.pages.dev/local-service-observation-ledger/schema.json",
  "title": "Local-service AI answer observation",
  "description": "A single source-level observation from a versioned AI-answer research run.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "observation_id",
    "prompt_id",
    "prompt_set_version",
    "answer_surface",
    "observed_at",
    "market",
    "brand_mentioned",
    "target_domain_cited",
    "entity_consistent",
    "source_role",
    "support_status",
    "is_synthetic"
  ],
  "properties": {
    "observation_id": {"type": "string", "minLength": 1},
    "prompt_id": {"type": "string", "minLength": 1},
    "prompt_set_version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
    "answer_surface": {"type": "string", "minLength": 1},
    "observed_at": {"type": "string", "format": "date-time"},
    "market": {"type": "string", "minLength": 1},
    "brand_mentioned": {"type": "boolean"},
    "target_domain_cited": {"type": "boolean"},
    "entity_consistent": {"type": ["boolean", "null"]},
    "cited_url": {"type": ["string", "null"], "format": "uri"},
    "normalized_hostname": {"type": ["string", "null"]},
    "source_role": {
      "enum": ["definition", "evidence", "comparison", "implementation", "entity", "experience", "unknown", "none"]
    },
    "support_status": {
      "enum": ["supports", "partial", "contradicts", "not_found", "needs_review", "not_applicable"]
    },
    "evidence_artifact": {"type": ["string", "null"], "format": "uri"},
    "is_synthetic": {"type": "boolean"},
    "review_notes": {"type": ["string", "null"]}
  }
}
