Build a top-10 FAQ with counts from 300 customer inquiries
Extract a top-10 FAQ from raw support inquiries without hallucinated topics. Map exact inquiry IDs to verify counts and ground answers in guide policies.
When a customer support (CS) team rebuilds an FAQ page from accumulated inquiry logs, asking a language model to simply "organize frequently asked questions" produces hallucinated questions unrelated to real tickets and fails to substantiate the actual inquiry volume.
AI excels at clustering similar inquiries and polishing phrasing, but estimating counts or inventing unsupported policies remains a major failure mode. Force the model to output the complete list of source ticket IDs for every cluster so you can tally the counts directly, and restrict answers exclusively to the official service guide. Comparing stated numbers and citations back to source text follows the same approach used in recomputing AI-stated numbers and verifying Claude summaries with quotes.
[1] Prepare the structured inquiry logs and the official service policy document. Here we use 300 anonymized customer inquiries (inquiries.en.txt) and a policy document with 10 operating rules (guide.en.txt) for BloomDaily, a fictional flower subscription service.
[TKT-001] Will direct sunlight cause the flowers to wilt quickly?[TKT-002] I want to cancel after receiving this month's orders, where do I do that?[TKT-003] Is there an annual limit on the total number of paused days?…[TKT-300] Can I unpause and resume deliveries whenever I want?The official guide contains established policies across 10 areas, including schedule change deadlines, care instructions, payment methods, pause limits, and damage compensation rules.
1. [Delivery Date and Frequency Changes]- Changes to delivery dates and frequencies (weekly, bi-weekly, or monthly) can be made directly in My Account > Subscription Management > Change Schedule up to 2 days prior to the scheduled delivery date at 6:00 PM. Changes cannot be made after this cutoff due to fulfillment preparation....10. [Receipts and Tax Invoices]- Credit card sales slips and receipts can be downloaded and printed immediately under My Account > Payment History > Print Receipt.[2] Construct the prompt. Following Anthropic's prompting best practices, place long background inputs (<service_guide> and <inquiry_log>) at the top, and put instructions and output formatting at the bottom. Apply the external knowledge restriction principle to prevent the model from inventing policies outside the guide.
<service_guide>(full guide.en.txt)</service_guide> <inquiry_log>(full inquiries.en.txt containing 300 tickets)</inquiry_log> Analyze all 300 customer inquiries in <inquiry_log> and identify the top 10 most frequent FAQ topics. Rules:1. Sort the top 10 FAQ topics in descending order of inquiry volume (Rank 1 to 10).2. For each FAQ topic, provide exactly these 4 fields: - Question: A clear, professional single-sentence FAQ question representing customer inquiries. - Count: The exact integer count of inquiries assigned to this topic. - Ticket IDs: The complete comma-separated list of inquiry IDs belonging to this topic (do not hallucinate IDs). - Answer: Provide an accurate answer grounded strictly and exclusively in the provided <service_guide>. Do not invent policies or assume external knowledge.3. Every ticket ID (TKT-001 to TKT-300) assigned must exist in <inquiry_log>, and each ticket ID must belong to only one FAQ topic.4. Strictly follow the output format below: [FAQ 1]- Question: ...- Count: ...- Ticket IDs: ...- Answer: ...(Repeat through FAQ 10)[3] Execute the prompt. Pass --tools "" and --setting-sources "" to process clean text without external tools or prompt modifications.
$ claude -p --model claude-sonnet-5-5 --max-turns 1 --tools "" --setting-sources "" --strict-mcp-config < run/faq.en.prompt.txt > run/faq.en.out.txtThe actual execution identified the top 10 FAQ topics. Long ticket lists for each cluster are truncated here for brevity.
[FAQ 1]- Question: How can I change my delivery date or delivery frequency?- Count: 42- Ticket IDs: TKT-013, TKT-014, TKT-015, TKT-016, TKT-020, …- Answer: You can change your delivery date and frequency (weekly, bi-weekly, or monthly) under My Account > Subscription Management > Change Schedule. Changes must be made at least 2 days before the scheduled delivery date by 6:00 PM. They cannot be made after this cutoff because the order is already in fulfillment preparation. [FAQ 2]- Question: How should I care for my flowers to keep them fresh and prevent wilting?- Count: 36- Ticket IDs: TKT-001, TKT-004, TKT-006, TKT-017, TKT-021, …- Answer: On arrival, trim 1-2 cm off the stem bottoms diagonally (at a 45-degree angle) under water. Remove only the lower foliage that would sit beneath the waterline, not all the leaves. Mix one packet of the enclosed flower food into 500 ml of cool water in a clean vase. Keep the flowers away from direct sunlight, air conditioning, and heating vents. Changing the vase water every 1 to 2 days maximizes vase life, so daily changes are not required.…[FAQ 10]- Question: How can I get payment receipts or tax invoices?- Count: 16- Ticket IDs: TKT-034, TKT-056, …- Answer: Credit card sales slips and receipts can be downloaded and printed immediately under My Account > Payment History > Print Receipt. For a corporate tax invoice, email a copy of your business registration certificate to customer support. Electronic tax invoices are issued within the first 10 days of the following month.[4] Write the verification script. It checks that there are 10 topics, that each has a count line and an ID line, that the reported count equals the number of IDs listed, that counts never rise from one rank to the next, and that every ID exists in the source log and appears in only one topic. It cannot tell whether an ID was put in the right topic or whether an answer matches the guide, so open a sample by hand.
import re, sys source_ids = set(re.findall(r"\[(TKT-\d+)\]", open(sys.argv[1], encoding="utf-8").read()))parts = re.split(r"^\[FAQ\s*(\d+)\]", open(sys.argv[2], encoding="utf-8").read().strip(), flags=re.M)faqs = [(int(parts[i]), parts[i + 1]) for i in range(1, len(parts), 2)] errors, seen, prev = [], {}, Nonefor rank, body in faqs: count = re.search(r"-\s*Count\s*:\s*(\d+)", body) idline = re.search(r"-\s*Ticket\s*IDs?\s*:\s*(.+)", body) if not (count and idline): errors.append(f"FAQ {rank}: missing count or ID line"); continue ids = re.findall(r"TKT-\d+", idline[1]) if int(count[1]) != len(ids): errors.append(f"FAQ {rank}: count {count[1]} != {len(ids)} IDs") if prev is not None and int(count[1]) > prev: errors.append(f"FAQ {rank}: count is larger than the previous rank") prev = int(count[1]) for x in ids: if x not in source_ids: errors.append(f"FAQ {rank}: ID {x} is not in the source") if x in seen: errors.append(f"FAQ {rank}: {x} is also in FAQ {seen[x]}") seen[x] = rank print(f"{len(faqs)} topics, {len(seen)} unique IDs assigned (of {len(source_ids)}), {len(errors)} errors")for e in errors: print(" " + e)sys.exit(1 if errors or len(faqs) != 10 else 0)[5] Run the verification. All checks passed with zero errors. 268 of the 300 tickets were assigned to a topic; the other 32 were not.
$ python run/verify_faq_en.py run/inquiries.en.txt run/faq.en.out.txt10 topics, 268 unique IDs assigned (of 300), 0 errorsTo test the detection, faq-bad.en.out.txt was built with three faults (not model output): the count in FAQ 1 changed from 42 to 45, TKT-001 in FAQ 2 replaced by an unknown ID (TKT-999), and TKT-013 from FAQ 1 repeated in FAQ 3 (which also makes FAQ 3's count of 33 disagree with its 34 IDs).
$ python run/verify_faq_en.py run/inquiries.en.txt run/faq-bad.en.out.txt10 topics, 268 unique IDs assigned (of 300), 4 errors FAQ 1: count 45 != 42 IDs FAQ 2: ID TKT-999 is not in the source FAQ 3: count 33 != 34 IDs FAQ 3: TKT-013 is also in FAQ 1All three faults were caught as 4 errors, with exit code 1.
[6] Observations from the runs and precautions:
- 32 of the 300 tickets were not assigned to any of the top 10 topics. Which tickets those were was not checked in this run.
- The English and Korean runs ranked topics differently. In the Korean run address changes were 7th (25 inquiries) and cancellations 8th (23); in the English run cancellations were 7th (23) and address changes 8th (20). The two input logs are not translations of each other, though: ticket 83, for example, asks about editing the message card deadline in the English log, while the same number in the Korean log asks about changing the recipient's contact and address. So this difference cannot be read as the model wavering, and the same log was not run twice, so whether the grouping changes between runs was not tested.
- When not to use: do not pass raw inquiry logs with real customer names, phone numbers or card numbers to an external cloud model. Replace customer identifiers with synthetic IDs like
TKT-001and mask personal data first.