---
slug: "PromptChain"
name: "PromptChain"
type: "Protocols"
layer: "Society"
ref: "PromptChain#02b5"
sema_id: "sema:PromptChain#mh:SHA-256:02b5f2277c89d51e35336a8735f5a8bf26304332db887961bb23790c8c82b2f9"
tags: ["Society","Protocols"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.world/scapes/bootstrap.json
url: https://mindscape.world/bootstrap/PromptChain/
related: ["Task","InputGuard","ReAttempt","ToolInvoke","AcceptSpec","Chain","Sequence","Compose","MetaPrompt"]
---

# PromptChain

Sequential LLM calls with validation gates

Layer: Society · Category: Protocols

## Mechanism

Decomposes a [Task](https://mindscape.world/scapes/bootstrap/Task.md) into a fixed [Sequence](https://mindscape.world/scapes/bootstrap/Sequence.md) of LLM calls. Each step's output is validated against an [AcceptSpec](https://mindscape.world/scapes/bootstrap/AcceptSpec.md) before it is passed to the next, and a failed output is never forwarded. After a failed validation, the chain invokes [ReAttempt](https://mindscape.world/scapes/bootstrap/ReAttempt.md) 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](https://mindscape.world/scapes/bootstrap/ToolInvoke.md) calls and applies [InputGuard](https://mindscape.world/scapes/bootstrap/InputGuard.md) validation at each boundary.

## Invariants

- No failed-forwarding: the [Chain](https://mindscape.world/scapes/bootstrap/Chain.md) 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](https://mindscape.world/scapes/bootstrap/Chain.md) before the next step executes.

## Failure modes

- Undetected error propagation: a flawed intermediate output passes validation and corrupts the next step.
- Validation brittleness: an overly narrow [AcceptSpec](https://mindscape.world/scapes/bootstrap/AcceptSpec.md) rejects a valid intermediate output.

## Parameters

- `max_retries_per_step` (Integer, [0, 3]): Re-attempts allowed after a failed step; 0 halts on the first failure

## Builds on

- [Task](https://mindscape.world/scapes/bootstrap/Task.md) (Infrastructure; Accepts)
- [InputGuard](https://mindscape.world/scapes/bootstrap/InputGuard.md) (Infrastructure; Composes with)
- [ReAttempt](https://mindscape.world/scapes/bootstrap/ReAttempt.md) (Infrastructure; Composes with)
- [ToolInvoke](https://mindscape.world/scapes/bootstrap/ToolInvoke.md) (Infrastructure; Composes with)
- [AcceptSpec](https://mindscape.world/scapes/bootstrap/AcceptSpec.md) (Infrastructure; References)
- [Chain](https://mindscape.world/scapes/bootstrap/Chain.md) (Infrastructure; References)
- [Sequence](https://mindscape.world/scapes/bootstrap/Sequence.md) (Infrastructure; References)

## Used by

- [Compose](https://mindscape.world/scapes/bootstrap/Compose.md) (Mind; References)
- [MetaPrompt](https://mindscape.world/scapes/bootstrap/MetaPrompt.md) (Mind; References)

## Identity

- Sema ID: `sema:PromptChain#mh:SHA-256:02b5f2277c89d51e35336a8735f5a8bf26304332db887961bb23790c8c82b2f9`
- Ref: `PromptChain#02b5`
- 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`

## Links

- [Pattern page](https://mindscape.world/bootstrap/PromptChain/)
- [View in the interactive graph](https://mindscape.world/bootstrap/#PromptChain)
- [JSON](https://mindscape.world/scapes/bootstrap/PromptChain.json)
- [Index of all patterns](https://mindscape.world/scapes/bootstrap.json)
