{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cementops.io/schemas/agent-triage-handoff.schema.json",
  "title": "Agent Triage Handoff",
  "description": "Advisory output/handoff contract an AI agent produces AFTER running Plant Issue Intake & Triage. It records what was understood, how complete the intake was, safety/authority flags, domain routing, retrieval targets, missing data, a non-authorizing summary, and the human owner of any decision. This contract captures advice only; it authorizes no action of any kind.",
  "type": "object",
  "version": "0.1.0",
  "required": ["issueSummary", "intakeCompleteness", "safetyStatus", "recommendedRoute", "advisorySummary", "authorityLimits", "escalationRequired", "notAuthorizationStatement"],
  "additionalProperties": false,
  "properties": {
    "issueSummary": {
      "type": "string",
      "description": "Short, neutral restatement of the reported issue. Description, not diagnosis."
    },
    "intakeCompleteness": {
      "type": "string",
      "description": "How complete the normalized intake is. Advisory; drives whether the agent asks for more data or routes.",
      "enum": ["complete", "partial", "insufficient"]
    },
    "safetyStatus": {
      "type": "string",
      "description": "Routing status for safety, never a safety clearance. The agent never declares a condition safe; it only records that no immediate flag was seen, or that a concern/imminent hazard was routed to human authority.",
      "enum": ["no-immediate-flag-observed", "possible-concern-routed-to-authority", "imminent-hazard-routed-to-emergency-procedure"]
    },
    "domainFlags": {
      "type": "array",
      "description": "One or more routing labels (not conclusions) for the domains the issue may touch.",
      "items": {
        "type": "string",
        "enum": ["safety", "environmental", "quality", "process", "maintenance", "data-quality", "unknown"]
      },
      "default": []
    },
    "recommendedRoute": {
      "type": "string",
      "description": "Where the issue should go next. A routing recommendation to a human/template, not an instruction to act.",
      "enum": ["plant-issue-intake-triage", "kiln-upset-intake-routing", "qc-out-of-trend-review", "bearing-temperature-rise-review", "raw-mix-correction", "site-emergency-safety-procedure", "environmental-authority", "qc-authority", "operations-process-engineering", "maintenance-reliability", "human-classification"]
    },
    "retrievalTargets": {
      "type": "array",
      "description": "Site paths or references the next step should consult (e.g. schema, templates, domain pages).",
      "items": { "type": "string" },
      "default": []
    },
    "missingDataQuestions": {
      "type": "array",
      "description": "Explicit questions / fields to request when intake is partial or insufficient. Ask, do not assume.",
      "items": { "type": "string" },
      "default": []
    },
    "advisorySummary": {
      "type": "string",
      "description": "The non-authorizing advisory message: what to confirm/review and where to send it. Contains no diagnosis, no setpoint, limit, threshold, or acceptance criterion, and no decision."
    },
    "authorityLimits": {
      "type": "array",
      "description": "Explicit statements of what this handoff does NOT authorize (operation, shutdown, restart, control change, field work, product release/hold/reject, environmental determination, maintenance action, safety decision).",
      "items": { "type": "string" },
      "default": []
    },
    "escalationRequired": {
      "type": "boolean",
      "description": "True if the issue must be escalated to a human authority before any further step (e.g. safety, environmental, or release concern)."
    },
    "humanOwner": {
      "type": "string",
      "description": "The role/authority who owns the actual decision (e.g. 'site safety/emergency procedure', 'QC authority', 'authorized operations + process engineering'). The agent does not own the decision."
    },
    "notAuthorizationStatement": {
      "type": "string",
      "description": "A required, explicit statement that this handoff is advisory only and authorizes nothing; decisions require the appropriate human authority under site procedure."
    }
  }
}
