A prompt chain divides a known workflow into narrow stages. Each stage produces a named artifact that must pass a gate before the next stage receives it: step → artifact → gate → step. A failed gate can return work for a bounded retry or trigger escalation. The control comes from checked handoffs, not from making more model calls. section 6.2
Use a chain when the order is stable and each handoff can be independently checked. For each stage, define the artifact, its schema and provenance, the acceptance gate, and the retry or escalation path. Checking only that output exists can let a well-formed error propagate through the workflow. section 6.1.4 section 6.2
Building a diagram
A diagram workflow first establishes elements, then builds relationships from accepted element references, and finally selects a view of the accepted structure. The relationship stage cannot invent an element to complete a connection, and the view stage cannot change the structure for a better layout. If an endpoint cannot be resolved, the runtime can identify the failing relationship instead of regenerating the entire model. One runtime can run all three stages; separate agents are not required. section 11.3.2
Protect the seams without adding unnecessary stages:
- Pass the smallest accepted artifact the next stage needs, and retrieve additional evidence explicitly. Passing the full transcript to every call carries earlier assumptions across otherwise modular stages. section 6.2.4
- Check a defect at the earliest seam where it is observable. In code repair, detecting an outdated revision only at pull-request time wastes the intermediate work. section 6.2.4
- Keep responsibilities together if no independently acceptable artifact separates them. Serial tool calls alone do not require a prompt chain. section 6.2.4 section 10.7.1
- Measure gate rejection, downstream escape, retry yield, end-to-end acceptance, latency, and cost. More stages can add serialization, context loss, and expense without adding control. section 6.2 section 6.2.4
Do not force a branching or interruptible task into a linear chain. Tool Dispatch addresses selection among capabilities; Plan-and-Execute preserves dependencies and partial progress across interruptions. These patterns can be composed: a cross-repository plan can contain a short inspect–edit–verify chain within each repository, with guardrails around publication. Add only the controls justified by the task. section 6.2.4 section 6.6
Table 6.11 Composing patterns around a cross-repository change
|
Pressure
|
Pattern
|
Design seam
|
|
Repository B depends on an accepted artifact from A
|
Plan-and-Execute
|
Durable dependency and progress state
|
|
Each repository has a known inspect-edit-verify route
|
Prompt Chaining
|
Checked artifact handoff
|
|
Each step needs only a subset of repository and build tools
|
Tool Dispatch
|
Eligible capability surface and admission
|
|
Publication changes shared state and must be independently confirmed
|
Guardrail Sandwich
|
Protected precondition and postcondition
|
Compare the distinct pressures and seams in a cross-repository change. section 6.6
