{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aisa.ablera.com/contracts/drafts/experience-entry.schema.json",
  "title": "Experience entry — DRAFT inter-stage contract (Support S8 → support/experience)",
  "x-status": "draft",
  "description": "Agents Memory § 6 and Stage Precipitation: symptom signature (customer phrase + system error, verbatim) · systems/environment touched · mechanism found (one sentence, layer-named) · fix shape · links · reusable artefacts. No PII by construction. Arrives as a proposal; the curator confirms. Persisted as EXPERIENCE_ENTRIES. Required core only (D139).",
  "type": "object", "additionalProperties": true,
  "required": ["case_id", "index_node", "symptom", "systems", "mechanism", "fix_shape", "links", "created_by_profile"],
  "properties": {
    "case_id": { "type": "string" },
    "index_node": { "type": "string", "enum": ["support/experience", "platform/experience"] },
    "symptom": { "type": "object", "required": ["customer_phrase", "normalised"], "properties": {
      "customer_phrase": { "type": "string", "description": "verbatim, identifiers already handles" },
      "system_error": { "type": "string", "description": "verbatim, e.g. ORA-06503, TransferAlreadyStarted" },
      "normalised": { "type": "string", "description": "the initial normalisation: lower-cased, handles kept, runs of digits collapsed to #, punctuation stripped — depth is a class-C measurement" },
      "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } },
    "systems": { "type": "array", "minItems": 1, "items": { "type": "string" } },
    "environment": { "type": "string" },
    "request_type": { "type": "string" },
    "mechanism": { "type": "object", "required": ["statement", "layer"], "properties": { "statement": { "type": "string" }, "layer": { "type": "string" } } },
    "fix_shape": { "type": "string", "enum": ["data_fix", "config_cell", "code", "answer", "combination", "none"] },
    "skill_key": { "type": "string", "description": "the skill that executes it, when one exists — the third occurrence creates it (ladder 3/7/20)" },
    "links": { "type": "array", "items": { "type": "object", "required": ["kind", "ref"], "properties": { "kind": { "type": "string", "enum": ["analysis", "ki", "checklist", "commit", "ticket", "article", "case"] }, "ref": { "type": "string" } } } },
    "artefacts": { "type": "array", "items": { "type": "object", "required": ["kind", "ref"], "properties": { "kind": { "type": "string", "enum": ["query_pack", "skill", "template", "script", "execution_record", "tool_package"] }, "ref": { "type": "string" } } } },
    "observed_version": { "type": "string", "description": "staleness: the environment/version observed; re-verify before relying" },
    "reuse_context": {"type": "object", "required": ["origin_request_key", "outcome", "verified_result_ref"], "properties": {"origin_request_key": {"type": "string"}, "product_family": {"type": "string"}, "confirmed_trigger": {"type": "object", "required": ["key", "evidence_refs"], "properties": {"key": {"type": "string"}, "evidence_refs": {"type": "array", "minItems": 1, "items": {"type": "string"}}}}, "outcome": {"type": "string", "description": "Actual achieved result; distinguish proposed, external and platform-executed work."}, "verified_result_ref": {"type": "string"}}},
    "created_by_profile": { "type": "string" },
    "state": { "type": "string", "enum": ["case_local", "proposed", "active", "retired"], "default": "proposed" },
    "no_pii_attestation": { "type": "boolean", "const": true }
  }
}
