{
 "library": "bootstrap",
 "version": "0.11.0",
 "root": "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5",
 "license": null,
 "slug": "PromptChain",
 "ref": "PromptChain#02b5",
 "hash": "sema:PromptChain#mh:SHA-256:02b5f2277c89d51e35336a8735f5a8bf26304332db887961bb23790c8c82b2f9",
 "stub": "02b5",
 "layer": "Society",
 "type": "Protocols",
 "summary": "Sequential LLM calls with validation gates",
 "mechanism": "Decomposes a Task#a850 into a fixed Sequence#0cae of LLM calls. Each step's output is validated against an AcceptSpec#37fa before it is passed to the next, and a failed output is never forwarded. After a failed validation, the chain invokes ReAttempt#1812 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 ToolInvoke#1096 calls and applies InputGuard#0ba7 validation at each boundary.",
 "invariants": [
  "No failed-forwarding: the Chain#3ba0 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#3ba0 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"
  }
 ],
 "signature": [],
 "preconditions": [],
 "postconditions": [],
 "failure_modes": [
  "Undetected error propagation: a flawed intermediate output passes validation and corrupts the next step.",
  "Validation brittleness: an overly narrow AcceptSpec#37fa rejects a valid intermediate output."
 ],
 "domain": "",
 "caution": "",
 "sources": [],
 "name": "PromptChain",
 "builds_on": [
  {
   "alias": "tool_invoke",
   "relation": "composes_with",
   "library": "bootstrap",
   "slug": "ToolInvoke",
   "ref": "ToolInvoke#1096",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/ToolInvoke"
  },
  {
   "alias": "input_guard",
   "relation": "composes_with",
   "library": "bootstrap",
   "slug": "InputGuard",
   "ref": "InputGuard#0ba7",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/InputGuard"
  },
  {
   "alias": "re_attempt",
   "relation": "composes_with",
   "library": "bootstrap",
   "slug": "ReAttempt",
   "ref": "ReAttempt#1812",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/ReAttempt"
  },
  {
   "alias": "accept_spec",
   "relation": "references",
   "library": "bootstrap",
   "slug": "AcceptSpec",
   "ref": "AcceptSpec#37fa",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/AcceptSpec"
  },
  {
   "alias": "chain",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Chain",
   "ref": "Chain#3ba0",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Chain"
  },
  {
   "alias": "sequence",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Sequence",
   "ref": "Sequence#0cae",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Sequence"
  },
  {
   "alias": "task",
   "relation": "accepts",
   "library": "bootstrap",
   "slug": "Task",
   "ref": "Task#a850",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Task"
  }
 ],
 "related": [],
 "used_by": [
  {
   "slug": "Compose",
   "relation": "references",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Compose"
  },
  {
   "slug": "MetaPrompt",
   "relation": "references",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/MetaPrompt"
  }
 ],
 "url": "https://semahash.org/vocabularies/bootstrap/patterns/PromptChain",
 "md_url": "https://semahash.org/vocabularies/bootstrap/patterns/PromptChain.md",
 "library_url": "https://semahash.org/vocabularies/bootstrap"
}
