Module 02 · Reasoning Patterns
Breaking Multi-Step Tasks Into a Prompt Chain
Open lesson + course map
On this lesson
Course outline
Module 1 · Structural Prompt Frameworks
Module 2 · Reasoning Patterns
Module 3 · Few-Shot and Example-Driven Prompting
Module 4 · Reusable Instruction Systems
A prompt chain turns one complicated request into several small calls: each stage has one job, and its saved output becomes the next stage's input. This is useful when an outline should not be drafted until its evidence has passed a check.
By the end, you will have a documented three-stage chain for turning an approved source pack into a research summary, an outline, and a draft. You will also know where to place gates and how to recover without rebuilding the whole workflow blindly.
// concept
Decide Whether the Task Deserves a Chain
Use a chain for fixed, dependent stages with inspectable intermediate artifacts. Extra calls cost time, so a short email may need one prompt; a sourced client article benefits from separate evidence, structure, and writing stages.
| Question | One prompt is usually enough | A chain is safer |
|---|---|---|
| Can intermediate work be checked? | No useful checkpoint | Facts or outline can be checked |
| Can an early error spread? | Low impact | A bad fact shapes the draft |
| Are subtasks fixed? | One transformation | Extract, plan, then write |
This monolithic prompt hides evidence selection, planning, and writing inside one response:
Research the market for this product, decide the best angle, create an outline,
and write persuasive WhatsApp launch copy for Pakistani university students.
Make it engaging and include the strongest product benefits.It leaves sources and unsupported claims undefined. A chain makes those decisions visible through artifacts such as a fact table and claim map; it does not request private model reasoning.
// concept
Give Every Stage a Contract and a Handoff
A stage contract names its purpose, allowed input, output schema, validation gate, stop condition, and saved filename.
| Stage | Contract | Gate before handoff | Saved output |
|---|---|---|---|
| 1. Extract | Turn supplied sources into supported facts and unknowns | Every fact has a source ID; no outside claims | 01_evidence_v1.md |
| 2. Outline | Arrange approved facts for the audience and channel | Every section names supporting fact IDs | 02_outline_v1.md |
| 3. Draft | Write only from the approved state and outline | Claims map to fact IDs; prohibited claims absent | 03_draft_v1.md |
Use consistent labelled blocks or valid JSON. Instead of “use the previous answer,” paste or attach the saved artifact. Carry this state block:
STATE
workflow_id: bottle-launch-sample
state_version: 1
audience: Pakistani university students
channel: WhatsApp Business broadcast
approved_fact_ids: [F1, F2, F3, F4]
unknowns: [price, stock quantity, delivery outside Islamabad]
prohibited_claims: [temperature duration, health benefit, sales result]The block restores context in a fresh chat or after an interruption, and keeps old prices or unapproved claims out of later stages.
// concept
Put Validation Gates and Recovery Between Calls
A gate is a pass/fail test. Check required fields, source IDs, forbidden content, and format. A human must confirm facts; model self-checking is not independent verification.
If a gate fails, save the failure, repair that stage, and create 01_evidence_v2.md. Invalidate downstream files based on v1, then rerun affected stages. Do not patch stage 3 while leaving a false fact in stage 1.
Record: failed gate -> defect -> correction -> new version -> stages rerun.
// worked_example
Worked Example
This hypothetical Islamabad seller sample has four authorized statements: S1 “750 ml”; S2 “double-wall insulated”; S3 “free standard delivery within Islamabad”; S4 Pakistani university students and WhatsApp Business. Price, stock, other delivery, and temperature duration are unknown.
Stage 1 contract: accept S1-S4; return facts and unknowns; fail if any fact lacks a source ID.
You are Stage 1: evidence extractor.
INPUT (sample, authorized):
S1 Product sheet: Capacity is 750 ml.
S2 Product sheet: Construction is double-wall insulated.
S3 Approved offer note: Free standard delivery within Islamabad.
S4 Campaign brief: Audience is Pakistani university students; channel is
WhatsApp Business broadcast.
TASK:
1. Extract only facts supported by S1-S4 as {id, statement, source_id}.
2. List price, stock, other delivery, and temperature duration as unknowns.
3. Do not infer benefits, performance, popularity, or results.
OUTPUT FORMAT:
STATE_VERSION: 1
FACTS: one item per line as F# | statement | S#
UNKNOWNS: comma-separated list
GATE: PASS only if every fact has a valid S#; otherwise FAIL with the offending item.Sample output saved as 01_evidence_v1.md:
STATE_VERSION: 1
FACTS:
F1 | Capacity is 750 ml. | S1
F2 | Product is double-wall insulated. | S2
F3 | Free standard delivery is available within Islamabad. | S3
F4 | Audience is Pakistani university students; channel is WhatsApp Business. | S4
UNKNOWNS: price, stock, delivery outside Islamabad, temperature duration
GATE: PASSStage 2 contract: accept the evidence; return a three-part outline citing fact IDs; fail on an unknown or uncited claim.
You are Stage 2: campaign outliner.
INPUT EVIDENCE:
F1 | Capacity is 750 ml. | S1
F2 | Product is double-wall insulated. | S2
F3 | Free standard delivery is available within Islamabad. | S3
F4 | Audience is Pakistani university students; channel is WhatsApp Business. | S4
UNKNOWNS: price, stock, delivery outside Islamabad, temperature duration
TASK: Create a WhatsApp broadcast outline with exactly three parts:
1. audience-relevant opening, 2. supported product details, 3. reply-based call to action.
Write the supporting [F#] after every factual bullet. Do not add a price,
urgency, stock level, health benefit, or temperature-duration claim.
OUTPUT: OUTLINE_VERSION, three numbered parts, then GATE PASS/FAIL.Sample output saved as 02_outline_v1.md:
OUTLINE_VERSION: 1
1. Opening: A bottle option for university days. [F4]
2. Details: 750 ml capacity [F1]; double-wall insulated construction [F2].
3. CTA: Reply for ordering details; mention free standard delivery in Islamabad. [F3]
GATE: PASSStage 3 contract: accept the state and outline; write a broadcast and claim map; fail if a factual phrase lacks an F-ID.
You are Stage 3: constrained copywriter.
APPROVED STATE:
F1 = 750 ml; F2 = double-wall insulated; F3 = free standard delivery within
Islamabad; F4 = Pakistani university students on WhatsApp Business.
UNKNOWN: price, stock, other delivery areas, temperature duration.
APPROVED OUTLINE:
1. University-day opening [F4]
2. Capacity and construction [F1, F2]
3. Reply CTA and Islamabad delivery [F3]
TASK: Draft 45-65 words in plain English. Add a separate CLAIM MAP listing
each factual phrase and its F-ID. Do not mention any unknown.
OUTPUT: DRAFT, CLAIM MAP, then GATE PASS/FAIL.Draft one included “keeps your drink cold all day.” F2 does not prove duration, so the gate failed. The fix added “temperature-duration claims are prohibited,” saved 03_draft_failed_v1.md, and reran stage 3 from the passing outline.
The corrected sample saved as 03_draft_v2.md was: “Heading to class? Carry a 750 ml, double-wall insulated bottle for your university day. Free standard delivery is available within Islamabad. Reply for ordering details.” Its claim map linked those details to F1, F2, and F3. This demonstrates the process, not performance.
// failure_cases
Failure Cases to Diagnose
6 cases to diagnose
Unlabelled handoff
Stage 2 receives prose with no fact IDs. Fix it by enforcing the stage-1 schema before continuing.
Context loss
A new chat invents a price because it never received the unknowns list. Paste the saved state block into every downstream call.
Error cascade
An unsupported feature passes stage 1 and appears throughout the draft. Return to stage 1, version the repair, and invalidate later files.
Gate without a stop
The output says
FAIL, but automation still calls stage 3. MakePASSan explicit prerequisite in code or in your manual checklist.Schema drift
Stage 2 drops source IDs. Restate the schema and reject malformed output.
Mega-prompt in disguise
One stage still extracts, plans, writes, and reviews. Split it again when those subtasks need different evidence or separate approval.
// pakistan_angle
Pakistan Angle
For a Pakistani freelancer serving UK or US clients, save each approved handoff locally before sending the next prompt. Load-shedding or unstable mobile data can break a long chat, while small files such as 01_evidence_v1.md are easy to resume and share for client approval. Check the AI vendor's current official plan page before depending on paid context or file features; copy-and-paste text blocks remain the free-tier fallback.
WhatsApp commerce often mixes English, Urdu, and Roman Urdu, so put language choice in the state rather than translating casually at the final stage. Never place a customer's CNIC image, phone list, JazzCash or Easypaisa account details, or an unredacted client brief into an AI service without authorization. Use sample placeholders during prompt testing, then let the responsible Pakistani business owner approve claims and message wording.
// hands_on
Hands-On Exercise
6 steps
Build a documented three-step chain for one low-risk workflow you are allowed to use: source notes to evidence summary, evidence summary to outline, and outline to draft.
Create a redacted pack with three to five labelled statements.
Write a six-field contract for each stage: purpose, allowed input, output schema, gate, stop condition, and filename.
Run stage 1, save its raw output, and manually check every fact-to-source link.
Pass the approved state block into stage 2; reject any outline item that uses an unknown.
Pass the approved state and outline into stage 3; save the draft and its claim map.
Deliberately remove one fact ID, confirm the correct gate fails, then document the recovery and rerun path. Done means you saved three versioned outputs, three prompts, three gate results, and one recovery note naming invalid downstream files.
// completion_rubric
Completion Rubric
5 checks — tick as you verify
// sources
Sources
3 official sources — check every claim yourself
// check_yourself
Check yourself
4 questions · answers and options are taken word-for-word from this course
1 / 4 · diagnose
Your work shows this failure mode: “Unlabelled handoff.” The lesson describes it like this: “Stage 2 receives prose with no fact IDs.” What does the lesson tell you to do about it?