{
  "node_type": "program",
  "source_line": 1,
  "source_column": 1,
  "personas": [],
  "contexts": [],
  "anchors": [],
  "tools": [],
  "memories": [],
  "types": [
    {
      "node_type": "type_def",
      "source_line": 10,
      "source_column": 1,
      "name": "PatientRecord",
      "fields": [
        {
          "node_type": "type_field",
          "source_line": 11,
          "source_column": 3,
          "name": "id",
          "type_name": "String",
          "generic_param": "",
          "optional": false
        },
        {
          "node_type": "type_field",
          "source_line": 12,
          "source_column": 3,
          "name": "ssn",
          "type_name": "String",
          "generic_param": "",
          "optional": false
        }
      ],
      "range_min": null,
      "range_max": null,
      "where_expression": "",
      "compliance": [
        "HIPAA",
        "GDPR"
      ]
    },
    {
      "node_type": "type_def",
      "source_line": 15,
      "source_column": 1,
      "name": "ClinicalTrial",
      "fields": [
        {
          "node_type": "type_field",
          "source_line": 16,
          "source_column": 3,
          "name": "trial_id",
          "type_name": "String",
          "generic_param": "",
          "optional": false
        },
        {
          "node_type": "type_field",
          "source_line": 17,
          "source_column": 3,
          "name": "participant_id",
          "type_name": "String",
          "generic_param": "",
          "optional": false
        }
      ],
      "range_min": null,
      "range_max": null,
      "where_expression": "",
      "compliance": [
        "HIPAA",
        "GxP"
      ]
    }
  ],
  "flows": [
    {
      "node_type": "flow",
      "source_line": 20,
      "source_column": 1,
      "name": "SummarizeRecord",
      "parameters": [
        {
          "node_type": "parameter",
          "source_line": 20,
          "source_column": 22,
          "name": "id",
          "type_name": "String",
          "generic_param": "",
          "optional": false
        }
      ],
      "return_type_name": "PatientRecord",
      "return_type_generic": "",
      "return_type_optional": false,
      "steps": [
        {
          "node_type": "step",
          "source_line": 21,
          "source_column": 3,
          "name": "Review",
          "persona_ref": "",
          "given": "",
          "ask": "Summarize",
          "use_tool": null,
          "probe": null,
          "reason": null,
          "weave": null,
          "output_type": "PatientRecord",
          "confidence_floor": null,
          "navigate_ref": "",
          "apply_ref": "",
          "body": []
        }
      ],
      "edges": [],
      "execution_levels": [
        [
          "Review"
        ]
      ]
    },
    {
      "node_type": "flow",
      "source_line": 131,
      "source_column": 1,
      "name": "SummarizeRecordUI",
      "parameters": [
        {
          "node_type": "parameter",
          "source_line": 131,
          "source_column": 24,
          "name": "rec",
          "type_name": "PatientRecord",
          "generic_param": "",
          "optional": false
        }
      ],
      "return_type_name": "PatientRecord",
      "return_type_generic": "",
      "return_type_optional": false,
      "steps": [
        {
          "node_type": "step",
          "source_line": 132,
          "source_column": 3,
          "name": "Review",
          "persona_ref": "",
          "given": "",
          "ask": "Summarize",
          "use_tool": null,
          "probe": null,
          "reason": null,
          "weave": null,
          "output_type": "PatientRecord",
          "confidence_floor": null,
          "navigate_ref": "",
          "apply_ref": "",
          "body": []
        }
      ],
      "edges": [],
      "execution_levels": [
        [
          "Review"
        ]
      ]
    }
  ],
  "runs": [],
  "imports": [],
  "agents": [],
  "shields": [
    {
      "node_type": "shield",
      "source_line": 27,
      "source_column": 1,
      "name": "PHIShield",
      "scan": [
        "prompt_injection",
        "pii_leak"
      ],
      "strategy": "pattern",
      "on_breach": "quarantine",
      "severity": "critical",
      "quarantine": "",
      "max_retries": 0,
      "confidence_threshold": 0.0,
      "allow_tools": [],
      "deny_tools": [],
      "sandbox": false,
      "redact": [
        "ssn"
      ],
      "log": "",
      "deflect_message": "",
      "compliance": [
        "HIPAA",
        "GDPR",
        "SOC2"
      ]
    }
  ],
  "daemons": [],
  "ots_specs": [],
  "pix_specs": [],
  "ledger_specs": [],
  "corpus_specs": [],
  "psyche_specs": [],
  "mandate_specs": [],
  "lambda_data_specs": [],
  "compute_specs": [],
  "axonstore_specs": [],
  "endpoints": [
    {
      "node_type": "endpoint",
      "source_line": 35,
      "source_column": 1,
      "name": "PatientAPI",
      "method": "POST",
      "path": "/patients",
      "body_type": "PatientRecord",
      "execute_flow": "SummarizeRecord",
      "output_type": "FlowEnvelope<PatientRecord>",
      "shield_ref": "PHIShield",
      "retries": 0,
      "timeout": "",
      "compliance": [
        "HIPAA",
        "GDPR"
      ]
    }
  ],
  "resources": [
    {
      "node_type": "resource",
      "source_line": 45,
      "source_column": 1,
      "name": "Ehr",
      "kind": "postgres",
      "endpoint": "ehr.internal:5432",
      "capacity": null,
      "lifetime": "linear",
      "certainty_floor": null,
      "shield_ref": ""
    },
    {
      "node_type": "resource",
      "source_line": 46,
      "source_column": 1,
      "name": "Cache",
      "kind": "redis",
      "endpoint": "",
      "capacity": null,
      "lifetime": "affine",
      "certainty_floor": null,
      "shield_ref": ""
    }
  ],
  "fabrics": [
    {
      "node_type": "fabric",
      "source_line": 48,
      "source_column": 1,
      "name": "ClinicalCloud",
      "provider": "aws",
      "region": "us-east-1",
      "zones": 3,
      "ephemeral": null,
      "shield_ref": ""
    }
  ],
  "manifests": [
    {
      "node_type": "manifest",
      "source_line": 50,
      "source_column": 1,
      "name": "Prod",
      "resources": [
        "Ehr",
        "Cache"
      ],
      "fabric_ref": "ClinicalCloud",
      "region": "us-east-1",
      "zones": 3,
      "compliance": [
        "HIPAA",
        "GDPR",
        "SOC2"
      ]
    }
  ],
  "observations": [
    {
      "node_type": "observe",
      "source_line": 58,
      "source_column": 1,
      "name": "Health",
      "target": "Prod",
      "sources": [
        "prometheus",
        "cloudwatch",
        "healthcheck"
      ],
      "quorum": 2,
      "timeout": "5s",
      "on_partition": "fail",
      "certainty_floor": 0.95
    },
    {
      "node_type": "observe",
      "source_line": 81,
      "source_column": 1,
      "name": "CacheHealth",
      "target": "Prod",
      "sources": [
        "cw2"
      ],
      "quorum": 1,
      "timeout": "",
      "on_partition": "fail",
      "certainty_floor": null
    }
  ],
  "intention_tree": {
    "node_type": "intention_tree",
    "source_line": 1,
    "source_column": 1,
    "operations": [
      {
        "node_type": "manifest",
        "source_line": 50,
        "source_column": 1,
        "name": "Prod",
        "resources": [
          "Ehr",
          "Cache"
        ],
        "fabric_ref": "ClinicalCloud",
        "region": "us-east-1",
        "zones": 3,
        "compliance": [
          "HIPAA",
          "GDPR",
          "SOC2"
        ]
      },
      {
        "node_type": "observe",
        "source_line": 58,
        "source_column": 1,
        "name": "Health",
        "target": "Prod",
        "sources": [
          "prometheus",
          "cloudwatch",
          "healthcheck"
        ],
        "quorum": 2,
        "timeout": "5s",
        "on_partition": "fail",
        "certainty_floor": 0.95
      },
      {
        "node_type": "observe",
        "source_line": 81,
        "source_column": 1,
        "name": "CacheHealth",
        "target": "Prod",
        "sources": [
          "cw2"
        ],
        "quorum": 1,
        "timeout": "",
        "on_partition": "fail",
        "certainty_floor": null
      }
    ]
  },
  "reconciles": [
    {
      "node_type": "reconcile",
      "source_line": 66,
      "source_column": 1,
      "name": "Reconciler",
      "observe_ref": "Health",
      "threshold": 0.9,
      "tolerance": 0.05,
      "on_drift": "provision",
      "shield_ref": "",
      "mandate_ref": "",
      "max_retries": 5
    }
  ],
  "leases": [
    {
      "node_type": "lease",
      "source_line": 74,
      "source_column": 1,
      "name": "EhrWrite",
      "resource_ref": "Ehr",
      "duration": "30m",
      "acquire": "on_demand",
      "on_expire": "release"
    }
  ],
  "ensembles": [
    {
      "node_type": "ensemble",
      "source_line": 86,
      "source_column": 1,
      "name": "ClusterTruth",
      "observations": [
        "Health",
        "CacheHealth"
      ],
      "quorum": 2,
      "aggregation": "byzantine",
      "certainty_mode": "harmonic"
    }
  ],
  "sessions": [
    {
      "node_type": "session",
      "source_line": 93,
      "source_column": 1,
      "name": "DbSession",
      "roles": [
        {
          "node_type": "session_role",
          "source_line": 94,
          "source_column": 3,
          "name": "client",
          "steps": [
            {
              "node_type": "session_step",
              "source_line": 94,
              "source_column": 12,
              "op": "send",
              "message_type": "Query"
            },
            {
              "node_type": "session_step",
              "source_line": 94,
              "source_column": 24,
              "op": "receive",
              "message_type": "Result"
            },
            {
              "node_type": "session_step",
              "source_line": 94,
              "source_column": 40,
              "op": "end",
              "message_type": ""
            }
          ]
        },
        {
          "node_type": "session_role",
          "source_line": 95,
          "source_column": 3,
          "name": "server",
          "steps": [
            {
              "node_type": "session_step",
              "source_line": 95,
              "source_column": 12,
              "op": "receive",
              "message_type": "Query"
            },
            {
              "node_type": "session_step",
              "source_line": 95,
              "source_column": 27,
              "op": "send",
              "message_type": "Result"
            },
            {
              "node_type": "session_step",
              "source_line": 95,
              "source_column": 40,
              "op": "end",
              "message_type": ""
            }
          ]
        }
      ]
    }
  ],
  "topologies": [
    {
      "node_type": "topology",
      "source_line": 98,
      "source_column": 1,
      "name": "ProdTopology",
      "nodes": [
        "Ehr",
        "Cache",
        "ClinicalCloud",
        "Prod",
        "Health"
      ],
      "edges": [
        {
          "node_type": "topology_edge",
          "source_line": 100,
          "source_column": 11,
          "source": "Health",
          "target": "Ehr",
          "session_ref": "DbSession"
        }
      ]
    }
  ],
  "immunes": [
    {
      "node_type": "immune",
      "source_line": 103,
      "source_column": 1,
      "name": "Vigil",
      "watch": [
        "Health"
      ],
      "sensitivity": 0.85,
      "baseline": "learned",
      "window": 100,
      "scope": "tenant",
      "tau": "60s",
      "decay": "exponential"
    }
  ],
  "reflexes": [
    {
      "node_type": "reflex",
      "source_line": 110,
      "source_column": 1,
      "name": "QuarantineBurst",
      "trigger": "Vigil",
      "on_level": "believe",
      "action": "quarantine",
      "scope": "tenant",
      "sla": "1ms"
    }
  ],
  "heals": [
    {
      "node_type": "heal",
      "source_line": 118,
      "source_column": 1,
      "name": "AutoPatch",
      "source": "Vigil",
      "on_level": "speculate",
      "mode": "human_in_loop",
      "scope": "tenant",
      "review_sla": "1h",
      "shield_ref": "",
      "max_patches": 3
    }
  ],
  "components": [
    {
      "node_type": "component",
      "source_line": 138,
      "source_column": 1,
      "name": "PatientCard",
      "renders": "PatientRecord",
      "via_shield": "PHIShield",
      "on_interact": "SummarizeRecordUI",
      "render_hint": "card"
    }
  ],
  "views": [
    {
      "node_type": "view",
      "source_line": 145,
      "source_column": 1,
      "name": "ClinicianDashboard",
      "title": "Clinician Dashboard",
      "components": [
        "PatientCard"
      ],
      "route": "/clinician"
    }
  ],
  "channels": [],
  "sockets": [],
  "effects": []
}