Prompt chaining with gates

artifactclosed gatemissing citation
1. Outline2. Draft3. PolishGate 1 · schemaGate 2 · citations
  1. Task decomposition: outline, draft, polish.
  2. Gate 1: programmatic schema validation passes.
  3. Gate 2 fails on a missing citation; retry is local.
  4. Validation passes; the artifact enters the final stage.
Notes & references

Use when

Fixed subtasks with cheap programmatic validators.

Avoid

Dynamic decomposition or tight latency budgets.

outline = llm("Write an outline", topic)
assert has_all_sections(outline)      # check 1: plain code

for attempt in range(3):
    draft = llm("Write the draft", outline)
    if has_sources(draft):            # check 2: plain code
        break

return llm("Polish the text", draft)