Vault / wiki/401/reverse-prompting-patterns.md
updated 2026-07-16Reverse Prompting Patterns in Apps
reverse-prompting-overview covers the theory; this note is the implementation catalog — how apps actually wire model-asks-user interactions.
Pattern 1 — System-prompt interviewing rule
Put the flipped-interaction instruction in the system prompt and carry multi-turn state in the messages array. The model stays in interviewer mode across turns because the rule sits above the conversation:
system = ("You are a requirements analyst. Ask exactly one question per "
"turn. When you can fully specify the feature, stop asking and "
"output the spec.")
messages = [
{"role": "user", "content": "I want a notification system."},
{"role": "assistant", "content": "Who receives notifications?"},
{"role": "user", "content": "Only workspace admins."},
# ...the array IS the interview state
]
Pattern 2 — Structured branching output
Free-text interviews are painful for app code. Force a machine-readable envelope so the app can branch on interview state (same discipline as tool-use schemas):
{"status": "need_info", "question": "What is your monthly budget?"}
{"status": "complete", "result": {"plan": "...", "budget": 400}}
if (res.status === "need_info") renderQuestion(res.question);
else renderResult(res.result); // exit the interview loop
The status discriminant turns a soft conversational behavior into a hard state machine.
Pattern 3 — The quiz-me loop
The retrieval-practice workhorse:
- Model generates one question on the target topic.
- User answers; model grades 0–5 against a rubric.
- Model explains the correct answer.
- Next question targets the weakest area observed so far.
Step 2 makes it active recall; step 4 makes it adaptive difficulty. This site's flashcard review implements the same loop with SM-2 persistence (see how-this-site-works).
Pattern 4 — Requirements-elicitation wizards
Onboarding flows, trip planners, and scoping bots run flipped interaction under Pattern 2's envelope: interview until a target schema is fully populated, then emit status: "complete" with the filled object. The termination condition becomes concrete — all required fields present — rather than the model's vibes.
Pattern 5 — Co-STORM's Moderator
co-storm institutionalizes reverse prompting at the system level: when discourse stalls, the Moderator injects questions built from retrieved-but-uncited snippets. The user is interviewed by proxy — shown questions they didn't know to ask. Useful template for any "help me explore X" product.
Pattern 6 — Reverse-engineering exemplar MCQs
Sense-2 reverse prompting (reverse-prompting-overview) applied to assessment: collect exemplar exam items, derive the prompt that generates items of that shape, then generate at scale. Evidence it works — and where it doesn't: a medical-education study found GPT-4-generated items complied with a mean 7.9 of 9 item-writing principles, with stem conciseness the weakest area, and concluded expert review is still required. That gap is exactly what the verification stages of storm-for-exams automate against.
Pattern selection
| You are building… | Reach for |
|---|---|
| Chat intake / scoping bot | Patterns 1 + 2 |
| Study tool | Pattern 3 |
| Form-like onboarding | Pattern 4 |
| Exploratory research UI | Pattern 5 |
| Item/content generator from exemplars | Pattern 6 |
Key terms
- Interviewing rule — a system-prompt instruction that holds the model in ask-one-question-per-turn mode while the messages array carries interview state.
- Structured branching output — constraining interview turns to a JSON envelope with a
statusdiscriminant (need_infovscomplete) so application code can branch deterministically. - Quiz-me loop — generate one question → grade 0–5 → explain → target weakest area; operationalizes active recall with adaptive difficulty.
- Adaptive difficulty — steering subsequent questions toward the learner's observed weak areas rather than sampling uniformly.
- Requirements-elicitation wizard — a flipped-interaction flow whose termination condition is "target schema fully populated."
- Moderator-as-interviewer — Co-STORM's pattern of injecting system-generated questions grounded in retrieved-but-uncited material, interviewing the user by proxy.
- Exemplar reverse-engineering — deriving a generation prompt from existing high-quality artifacts (e.g., exam items), then generating at scale under that prompt.
- Item-writing principles compliance — measured quality of generated MCQs against standard rules; GPT-4 scored mean 7.9/9 in a medical-ed study, weakest on stem conciseness, with expert review still required.
See also
- reverse-prompting-overview — the two senses and the learning science
- storm-for-exams — Pattern 6 industrialized with verification gates
- tool-use — the schema-first discipline Pattern 2 borrows