{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://titancapability.com/schemas/titan-cockpit-export-v28.schema.json",
  "title": "Titan Cockpit state export 28.0",
  "description": "Current local-first Cockpit state. Product releases may advance without changing this state schema. Personal Science records are non-clinical personal comparisons and cannot promote a Titan claim.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion", "sourceAuthority", "integrityStatus", "safety", "constraints",
    "coreProfileOutcome", "coreProfile", "currentCoreProfileHistory", "coreScores",
    "moduleAssessments", "declarations", "assessmentHistory", "safetyEvents",
    "activeModule", "legacyCapabilityScores", "legacyActiveCapability", "migratedFrom",
    "legacyImports", "coreProfileHistory", "stateCheckins", "experiments", "forecasts",
    "sensorySessions", "capabilitySessions", "aiComparisons", "intentions", "runbooks",
    "arguments", "repairs", "teamPulses"
  ],
  "properties": {
    "schemaVersion": { "const": "titan-cockpit/28.0.0" },
    "sourceAuthority": { "$ref": "#/$defs/sourceAuthority" },
    "integrityStatus": {
      "type": "object",
      "additionalProperties": false,
      "required": ["localDeclarationDigest", "externalDeclarationReceipt", "ghostmarkSigning"],
      "properties": {
        "localDeclarationDigest": { "const": "implemented-local-only" },
        "externalDeclarationReceipt": { "const": "unavailable" },
        "ghostmarkSigning": { "const": "disabled" }
      }
    },
    "safety": { "type": "object", "additionalProperties": { "enum": ["", "N", "Y", "?"] } },
    "constraints": { "$ref": "#/$defs/stringArray" },
    "coreProfileOutcome": { "type": "string" },
    "coreProfile": { "type": "object" },
    "currentCoreProfileHistory": { "$ref": "#/$defs/recordArray" },
    "coreScores": { "$ref": "#/$defs/nullableNumberMap" },
    "moduleAssessments": {
      "type": "object",
      "propertyNames": { "$ref": "#/$defs/currentActionableModuleId" },
      "additionalProperties": { "type": "object" }
    },
    "declarations": { "$ref": "#/$defs/currentModuleRecordArray" },
    "assessmentHistory": { "$ref": "#/$defs/currentModuleRecordArray" },
    "safetyEvents": { "$ref": "#/$defs/knownLineageModuleRecordArray" },
    "activeModule": { "oneOf": [{ "const": "" }, { "$ref": "#/$defs/currentActionableModuleId" }] },
    "legacyCapabilityScores": { "$ref": "#/$defs/nullableNumberMap" },
    "legacyActiveCapability": { "type": "string" },
    "migratedFrom": { "type": "string" },
    "legacyImports": { "$ref": "#/$defs/recordArray" },
    "coreProfileHistory": { "$ref": "#/$defs/recordArray" },
    "stateCheckins": { "$ref": "#/$defs/recordArray" },
    "experiments": {
      "type": "array",
      "items": { "$ref": "#/$defs/personalScienceRecord" }
    },
    "forecasts": { "$ref": "#/$defs/recordArray" },
    "sensorySessions": { "type": "array", "maxItems": 0 },
    "capabilitySessions": { "$ref": "#/$defs/currentModuleRecordArray" },
    "aiComparisons": { "$ref": "#/$defs/recordArray" },
    "intentions": { "$ref": "#/$defs/recordArray" },
    "runbooks": { "$ref": "#/$defs/recordArray" },
    "arguments": { "$ref": "#/$defs/recordArray" },
    "repairs": { "$ref": "#/$defs/recordArray" },
    "teamPulses": { "$ref": "#/$defs/recordArray" }
  },
  "$defs": {
    "sourceAuthority": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "release", "releaseSha256", "docxSha256", "pdfSha256",
        "cockpitRelease", "cockpitSchema", "frozenCoreDomains", "operationalModules",
        "governedModuleIdentities", "currentActionableModules", "conceptualReadOnlyModuleIdentities",
        "currentAuthorityOverlay", "currentAuthorityPath", "heldModuleIds", "operationalActionabilityForHeldModules"
      ],
      "properties": {
        "release": { "const": "Revision 7K" },
        "releaseSha256": { "const": "68b48a8b72a954a45b27509d5f09f96e9233097d0ab7282572f16a87d28c822f" },
        "docxSha256": { "const": "fc58914cba88dc0d103a39a0d3b908bfcfe1dcc7b99f1ba128c1e9670313c8bd" },
        "pdfSha256": { "const": "8d47a44e81a9a61de7028d89b42865adcc25893062925161b407e8cd3df90b80" },
        "cockpitRelease": { "const": "28.0.0" },
        "cockpitSchema": { "const": "titan-cockpit/28.0.0" },
        "frozenCoreDomains": { "const": 24 },
        "operationalModules": { "const": 16 },
        "governedModuleIdentities": { "const": 16 },
        "currentActionableModules": { "const": 15 },
        "conceptualReadOnlyModuleIdentities": { "const": 1 },
        "currentAuthorityOverlay": { "const": "titan.pwr078.correction_status.v1" },
        "currentAuthorityPath": { "const": "/data/titan_pwr078_correction_status_v1.json" },
        "heldModuleIds": { "const": ["MOD-SENSORY-DISCRIMINATION"] },
        "operationalActionabilityForHeldModules": { "const": false }
      }
    },
    "currentActionableModuleId": {
      "enum": [
        "MOD-SPATIAL-SIMULATION", "MOD-SENSORIMOTOR-RESILIENCE", "MOD-LEARNING-TRANSFER",
        "MOD-METACOGNITIVE-CALIBRATION", "MOD-CREATIVE-COGNITION", "MOD-PROSPECTIVE-MEMORY",
        "MOD-FORECASTING", "MOD-CAUSAL-EXPERIMENTAL", "MOD-ARGUMENTATION",
        "MOD-TEACHING-NEGOTIATION", "MOD-TEAM-ORCHESTRATION", "MOD-TOOL-REPAIR",
        "MOD-OPERATIONAL-SYSTEMS", "MOD-HUMAN-AI-COMPLEMENTARITY", "MOD-ASSISTIVE-FIT"
      ]
    },
    "knownLineageModuleId": {
      "oneOf": [
        { "$ref": "#/$defs/currentActionableModuleId" },
        { "const": "MOD-SENSORY-DISCRIMINATION" }
      ]
    },
    "currentModuleRecordArray": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["moduleId"],
        "properties": { "moduleId": { "$ref": "#/$defs/currentActionableModuleId" } }
      }
    },
    "knownLineageModuleRecordArray": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["moduleId"],
        "properties": { "moduleId": { "$ref": "#/$defs/knownLineageModuleId" } }
      }
    },
    "recordArray": {
      "type": "array",
      "items": { "type": "object" }
    },
    "stringArray": {
      "type": "array",
      "items": { "type": "string" }
    },
    "nullableNumberMap": {
      "type": "object",
      "additionalProperties": { "type": ["number", "null"] }
    },
    "personalScienceRecord": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id", "startDate", "question", "hypothesis", "variable", "functionalOutcome",
        "measurementType", "outcome", "instrument", "deviceVersion", "baseline",
        "minimumMeaningfulChange", "comparisonPlan", "duration", "washout", "confounders",
        "missingDataRule", "burdenAndCost", "reversibility", "contraindications",
        "privacyAndOwnership", "stopRule", "result", "delayedRetest", "verdict", "adverse",
        "generalisationBoundary"
      ],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "startDate": { "type": "string" },
        "question": { "type": "string" },
        "hypothesis": { "type": "string" },
        "variable": { "type": "string" },
        "functionalOutcome": { "type": "string" },
        "measurementType": { "enum": ["Direct performance", "Proxy", "Subjective report", "Biomarker"] },
        "outcome": { "type": "string" },
        "instrument": { "type": "string" },
        "deviceVersion": { "type": "string" },
        "baseline": { "type": "string" },
        "minimumMeaningfulChange": { "type": "string" },
        "comparisonPlan": { "type": "string" },
        "duration": { "type": "string" },
        "washout": { "type": "string" },
        "confounders": { "type": "string" },
        "missingDataRule": { "type": "string" },
        "burdenAndCost": { "type": "string" },
        "reversibility": { "type": "string" },
        "contraindications": { "type": "string" },
        "privacyAndOwnership": { "type": "string" },
        "stopRule": { "type": "string" },
        "result": { "type": "string" },
        "delayedRetest": { "type": "string" },
        "verdict": { "enum": ["Preregistered", "In progress", "Benefit observed", "Null result", "Inconclusive", "Harm observed", "Stopped"] },
        "adverse": { "type": "string" },
        "generalisationBoundary": { "type": "string" }
      }
    }
  }
}
