Synthesize interview notes into themes with counts and quotes
Synthesize 8 user interviews into themes while preventing fabricated quotes and exaggerated claims. Verify exact quotes and participant counts with a script.
When synthesizing notes from 8 user interviews into thematic summaries, AI models often fabricate quotes or overgeneralize isolated comments into widespread consensus. While models group shared issues quickly, they tend to invent smooth quotations from memory and describe two comments as something "most users request". Forcing the prompt to extract verbatim quotes alongside participant IDs and counts produces dependable qualitative synthesis that an automated script can audit. Similar quote verification workflows are covered in quote verification.
This prompt applies principles from Anthropic's official hallucination reduction guide. Rather than asking the model to synthesize raw text directly, it requires extracting verbatim quotes first and grounding every insight strictly in those citations. In accordance with prompt engineering best practices, wrap each transcript in an <interview id="..."> tag to maintain distinct document boundaries.
[1] Prepare transcripts from 8 user interviews for a fictional houseplant care app, tagged with anonymized participant IDs (P1 through P8).
<interviews><interview id="P1">I have been growing over ten houseplants for the past three years. My biggest issue with the app right now is the watering schedule. It counts days instead of checking soil moisture, which caused two of my plants to die from overwatering. Pot sizes and seasons completely change drying times, but the app sends rigid alerts every three days. Also, I don't want community features; they feel exhausting and I only want a private plant diary. I want a clean record without clutter.</interview><interview id="P2">I'm a complete beginner trying to keep a single monstera alive. Honestly, I prefer having rigid weekday schedules without fiddling with complex sensor readings, because it keeps me on track. Simple is better than complicated for beginners. Instead, I really want a feature where I snap a photo of yellowing leaf tips and immediately get a disease diagnosis. Right now, searching web forums manually takes too much time.</interview>... (P3-P8 omitted: full text in run/prompt_en.prompt.txt)</interviews>[2] Construct the prompt. Prohibit vague quantifiers and enforce 5 table columns.
The following <interviews> block contains 8 user interview transcripts. Each transcript is wrapped in an <interview id="..."> tag.Synthesize these interview records into common themes. Rules:1. For each theme, provide the list of participant IDs and the exact participant count. The participant count must match the number of IDs.2. Include at least one verbatim quote copied character-for-character from the interview text for each theme. Do not paraphrase or alter words.3. Identify any dissenting or minority opinions where a participant expressed a conflicting view or different preference. Include their participant ID and verbatim quote. If none exists, write "None".4. Do not use vague quantifiers like "most users" or "many participants". Rely strictly on exact counts and IDs.5. Output ONLY a single Markdown table with the following exact columns and no extra commentary:| Theme | Participant IDs | Count | Representative Quote (Verbatim) | Dissenting / Minority Opinion (ID & Quote) | {8 interview transcripts above}[3] Run the prompt. Disable tools with --tools "" to receive clean tabular text.
$ claude -p --model claude-sonnet-5-5 --max-turns 1 --tools "" --setting-sources "" --strict-mcp-config < run/prompt_en.prompt.txt > run/out_en.1.out.txt$ cat run/out_en.1.out.txt| Theme | Participant IDs | Count | Representative Quote (Verbatim) | Dissenting / Minority Opinion (ID & Quote) ||---|---|---|---|---|| Watering reminders are rigid and ignore real conditions (soil moisture, weather, season, home environment) | P1, P3, P5, P7 | 4 | "It counts days instead of checking soil moisture, which caused two of my plants to die from overwatering." (P1) | P2: "I prefer having rigid weekday schedules without fiddling with complex sensor readings, because it keeps me on track." || Want photo-based diagnosis of plant disease, pests, or nutrient problems | P2, P4, P6 | 3 | "When brown spots appear on leaves, an instant photo check to distinguish fungal infection from nutrient deficiency is essential." (P6) | P8: "AI photo diagnosis is unreliable and misleading when accuracy drops." || Want community features for sharing plant progress and swapping cuttings | P3, P7 | 2 | "having a neighborhood feature to share plant progress and adopt surplus cuttings would keep our group engaged." (P7) | P1: "I don't want community features; they feel exhausting and I only want a private plant diary." |Across 2 runs, both executions identified the same 3 core themes with identical participant counts (4, 3, 2). Minor variation occurred in quote boundaries (the second run captured longer clauses such as "Honestly, I prefer..."), but all citations passed the check in step 4 (each quote is in a listed participant's transcript).
[4] Write an audit script. It reads each participant's transcript separately from the prompt file (<interview id="P1"> ...) and, for every table row, checks that:
- the Count equals the number of IDs, with no repeated ID and no ID missing from the transcripts
- each representative quote appears verbatim in some participant's transcript, and that participant is in the row's ID list; a trailing tag like
(P7)must name a participant whose transcript contains the quote - the dissent is written as
P2: "quote", the quote is in P2's transcript, and P2 is not in the row's main ID list
Pasting one participant's words under another participant fails. Whether a participant really spoke to the theme, or whether a dissent really disagrees, is beyond the script.
#!/usr/bin/env python3"""usage: python verify_quotes_en.py <prompt file> <output file>"""import re, sys norm = lambda s: " ".join(s.split())prompt = open(sys.argv[1], encoding="utf-8").read()people = {m.group(1): norm(m.group(2)) for m in re.finditer(r'<interview id="(P\d+)">(.*?)</interview>', prompt, re.S)}out = open(sys.argv[2], encoding="utf-8").read()rows = [[c.strip() for c in l.strip().strip("|").split("|")] for l in out.splitlines() if l.strip().startswith("|")]rows = [r for r in rows if not all(re.fullmatch(r":?-+:?", c) for c in r if c)][1:] def sources(q): q = norm(q.strip(" \"'“”")) return {pid for pid, text in people.items() if q and q in text} err = []if not rows: err.append("no table rows")for n, r in enumerate(rows, 1): if len(r) != 5: err.append(f"row {n}: {len(r)} columns"); continue theme, id_col, count_col, quote_col, other_col = r ids = re.findall(r"P\d+", id_col) if len(ids) != len(set(ids)): err.append(f"row {n}: duplicate ID") if any(i not in people for i in ids): err.append(f"row {n}: ID not in the transcripts") if not re.fullmatch(r"\d+", count_col) or int(count_col) != len(ids): err.append(f"row {n}: count {count_col} != {len(ids)} IDs") quotes = re.findall(r'["“]([^"”]+)["”](?:\s*\((P\d+)\))?', quote_col) if not quotes: err.append(f"row {n}: no representative quote") for q, tag in quotes: src = sources(q) if not src: err.append(f"row {n}: quote not in any transcript: {q[:15]}...") elif not src & set(ids): err.append(f"row {n}: quote comes from {sorted(src)}, not in the ID list") elif tag and tag not in src: err.append(f"row {n}: quote tagged {tag} but found in {sorted(src)}") if other_col not in ("None", "none", "-"): pairs = re.findall(r'(P\d+)\s*:\s*["“]([^"”]+)["”]', other_col) if not pairs: err.append(f"row {n}: dissent is not in 'ID: \"quote\"' form") for pid, q in pairs: if pid in ids: err.append(f"row {n}: dissenter {pid} is also in the main ID list") if pid not in sources(q): err.append(f"row {n}: dissent quote not in {pid}'s transcript") for e in err: print("[error]", e)if err: sys.exit(1)print(f"{len(rows)} rows checked: counts, quote sources and dissent sources all match")[5] Run the audit. Both outputs pass with exit code 0.
$ python run/verify_quotes_en.py run/prompt_en.prompt.txt run/out_en.1.out.txt3 rows checked: counts, quote sources and dissent sources all match$ python run/verify_quotes_en.py run/prompt_en.prompt.txt run/out_en.2.out.txt3 rows checked: counts, quote sources and dissent sources all matchFour hand-made bad files (not model output) all exit with code 1: a quote with "two of my plants" changed to "several plants" (out_en_bad_quote.txt), a count of 5 (out_en_bad_count.txt), row 3's IDs changed so the quote's source is outside the list (out_en_bad_source.txt), and P2's dissent quote labeled as P1 (out_en_bad_dissent.txt). The wrong-source case:
$ python run/verify_quotes_en.py run/prompt_en.prompt.txt run/out_en_bad_source.txt[error] row 3: quote comes from ['P7'], not in the ID list[6] Where it falls short, as seen in these two English outputs:
- Both runs appended a tag such as
(P1)after each quote in the quote column. The script above reads that tag and checks it against the quote's source. - Both runs produced 3 themes, and
P8appears only as a dissenter, never in a theme's ID list. - The script passes any dissent whose quote is in that participant's transcript, so a quote that does not actually oppose the theme would pass. This did not occur in these English runs, and the script would not notice it if it did.
Two rule lines you can try. A run with them was not tested here.
6. Synthesize themes mentioned by at least 2 participants; omit standalone single-person remarks.7. Select exactly 1 representative quote that best illustrates the theme, without appending participant IDs inside the quote string.Only 8 transcripts were run. What happens with many more transcripts in one call was not tested.