{
  "handle": "PromptChain",
  "mechanism": "Decomposes a {{task}} into a fixed {{sequence}} of LLM calls. Each step's output is validated against an {{accept_spec}} before it is passed to the next, and a failed output is never forwarded. After a failed validation, the chain invokes {{re_attempt}} on that step up to `max_retries_per_step`; when that budget is exhausted, it halts without executing the next step. A value of zero halts on the first failed validation. It orchestrates {{tool_invoke}} calls and applies {{input_guard}} validation at each boundary.",
  "gloss": "Sequential LLM calls with validation gates",
  "failure_modes": [
    "Undetected error propagation: a flawed intermediate output passes validation and corrupts the next step.",
    "Validation brittleness: an overly narrow {{accept_spec}} rejects a valid intermediate output."
  ],
  "invariants": [
    "No failed-forwarding: the {{chain}} never passes a failed step's output to the next step.",
    "Schema Continuity: Output(N) must satisfy InputSchema(N+1).",
    "Bounded recovery: a failed step is re-attempted no more than `max_retries_per_step`; exhaustion halts the {{chain}} before the next step executes."
  ],
  "parameters": [
    {
      "name": "max_retries_per_step",
      "type": "Integer",
      "range": "[0, 3]",
      "description": "Re-attempts allowed after a failed step; 0 halts on the first failure"
    }
  ],
  "_meta": {
    "tier": 2,
    "ring": 0,
    "supersedes": [
      "sema:PromptChain#mh:SHA-256:c872aab6147376a3ad76fc0a062b08baf8492651a478308fbb96f261f903cce0",
      "sema:PromptChain#mh:SHA-256:4ad5da823f52050a9e1959eaf054e9a5c4d5777f534c796ec6bc259db676e008",
      "sema:PromptChain#mh:SHA-256:50975454f45cce4e45ae4590cd99cee4401596df424ffac720c699609dcc01a6",
      "sema:PromptChain#mh:SHA-256:2543cc5972f02b5a21d776643ba485beda876462c57a10c8949d0072e54bd620",
      "sema:PromptChain#mh:SHA-256:5df25fb4edb7f8f3575a0b45a7c203f7f5ef1b66a5f83d9ec1049b5548cdf975",
      "sema:PromptChain#mh:SHA-256:61c81f623e0aadd0d6cde03bf3c5dbbc5ea3e0b527647552ca0e063c261e85e1"
    ],
    "path": [
      "Society",
      "Protocols"
    ]
  },
  "sema_id": "sema:PromptChain#mh:SHA-256:02b5f2277c89d51e35336a8735f5a8bf26304332db887961bb23790c8c82b2f9",
  "sema_ref": "PromptChain#02b5",
  "sema_stub": "02b5",
  "dependencies": {
    "accepts": {
      "task": "sema:Task#mh:SHA-256:a85010f508f85055170c396c8fa390125c1206888c565ac10651f3969a339f8d"
    },
    "composes_with": {
      "input_guard": "sema:InputGuard#mh:SHA-256:0ba715e91627fa1f6759a739da0d4159cac6404c8b45b6e97910d98ef0e8a079",
      "re_attempt": "sema:ReAttempt#mh:SHA-256:18128dc39f9e9174059b4058d4e1419eb6c4ba921dbad355fabc329bc3902c48",
      "tool_invoke": "sema:ToolInvoke#mh:SHA-256:1096039316801cc8ef6e2855a6300574bb8596bb8e57c2764fd3bee741fa217e"
    },
    "references": {
      "accept_spec": "sema:AcceptSpec#mh:SHA-256:37fa28b93d390f8c8eb171eaab54ff4f9e57a95ef67af024422f823545a291cc",
      "chain": "sema:Chain#mh:SHA-256:3ba084dba5cf36bbdd43d03306c187ca75a2e3f448b555e257c26aab9b71c4fb",
      "sequence": "sema:Sequence#mh:SHA-256:0cae6b0951c4e93742259ff81ded009a85283d250c948f97cce3b9b3b8e58e1a"
    }
  },
  "sema_layer": "Society",
  "sema_category": "Protocols",
  "used_by": {
    "references": {
      "Compose": "sema:Compose#mh:SHA-256:196091975a98531824eec411da641b3e07a8b11d7c807e5f666d45eda717f5f7",
      "MetaPrompt": "sema:MetaPrompt#mh:SHA-256:5d117201e4b2fe776f32e4effb8bb9b0d541e361ba37468250283f277026c974"
    }
  }
}
